@cloudbase/oauth 0.1.1-alpha → 0.1.1-alpha.2
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/Dockerfile +15 -0
- package/README.md +1 -1
- package/_exmaple/assets/scripts/function/function.ts +99 -0
- package/_exmaple/assets/scripts/index.ts +99 -0
- package/_exmaple/assets/scripts/request.ts +11 -0
- package/_exmaple/index.html +15 -0
- package/_exmaple/package.json +33 -0
- package/_exmaple/tsconfig.json +71 -0
- package/_exmaple/typings.d.ts +0 -0
- package/_exmaple/webpack.config.js +42 -0
- package/cdnjs/1.0.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.0.0/cloudbase.database.js +8 -0
- package/cdnjs/1.0.0/cloudbase.full.js +8 -0
- package/cdnjs/1.0.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.0.0/cloudbase.js +1 -0
- package/cdnjs/1.0.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.0.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.0.1/cloudbase.database.js +8 -0
- package/cdnjs/1.0.1/cloudbase.full.js +8 -0
- package/cdnjs/1.0.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.0.1/cloudbase.js +1 -0
- package/cdnjs/1.0.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.0.2/cloudbase.auth.js +1 -0
- package/cdnjs/1.0.2/cloudbase.database.js +8 -0
- package/cdnjs/1.0.2/cloudbase.full.js +8 -0
- package/cdnjs/1.0.2/cloudbase.functions.js +1 -0
- package/cdnjs/1.0.2/cloudbase.js +1 -0
- package/cdnjs/1.0.2/cloudbase.storage.js +1 -0
- package/cdnjs/1.0.3/cloudbase.auth.js +1 -0
- package/cdnjs/1.0.3/cloudbase.database.js +8 -0
- package/cdnjs/1.0.3/cloudbase.full.js +8 -0
- package/cdnjs/1.0.3/cloudbase.functions.js +1 -0
- package/cdnjs/1.0.3/cloudbase.js +1 -0
- package/cdnjs/1.0.3/cloudbase.storage.js +1 -0
- package/cdnjs/1.0.4/cloudbase.auth.js +1 -0
- package/cdnjs/1.0.4/cloudbase.database.js +8 -0
- package/cdnjs/1.0.4/cloudbase.full.js +8 -0
- package/cdnjs/1.0.4/cloudbase.functions.js +1 -0
- package/cdnjs/1.0.4/cloudbase.js +1 -0
- package/cdnjs/1.0.4/cloudbase.storage.js +1 -0
- package/cdnjs/1.1.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.1.0/cloudbase.database.js +8 -0
- package/cdnjs/1.1.0/cloudbase.full.js +8 -0
- package/cdnjs/1.1.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.1.0/cloudbase.js +1 -0
- package/cdnjs/1.1.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.1.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.1.1/cloudbase.database.js +8 -0
- package/cdnjs/1.1.1/cloudbase.full.js +8 -0
- package/cdnjs/1.1.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.1.1/cloudbase.js +1 -0
- package/cdnjs/1.1.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.1.2/cloudbase.auth.js +1 -0
- package/cdnjs/1.1.2/cloudbase.database.js +8 -0
- package/cdnjs/1.1.2/cloudbase.full.js +8 -0
- package/cdnjs/1.1.2/cloudbase.functions.js +1 -0
- package/cdnjs/1.1.2/cloudbase.js +1 -0
- package/cdnjs/1.1.2/cloudbase.storage.js +1 -0
- package/cdnjs/1.1.3/cloudbase.auth.js +1 -0
- package/cdnjs/1.1.3/cloudbase.database.js +8 -0
- package/cdnjs/1.1.3/cloudbase.full.js +8 -0
- package/cdnjs/1.1.3/cloudbase.functions.js +1 -0
- package/cdnjs/1.1.3/cloudbase.js +1 -0
- package/cdnjs/1.1.3/cloudbase.storage.js +1 -0
- package/cdnjs/1.1.4/cloudbase.auth.js +1 -0
- package/cdnjs/1.1.4/cloudbase.database.js +8 -0
- package/cdnjs/1.1.4/cloudbase.full.js +8 -0
- package/cdnjs/1.1.4/cloudbase.functions.js +1 -0
- package/cdnjs/1.1.4/cloudbase.js +1 -0
- package/cdnjs/1.1.4/cloudbase.storage.js +1 -0
- package/cdnjs/1.2.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.2.1/cloudbase.database.js +8 -0
- package/cdnjs/1.2.1/cloudbase.full.js +8 -0
- package/cdnjs/1.2.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.2.1/cloudbase.js +1 -0
- package/cdnjs/1.2.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.2.2/cloudbase.auth.js +1 -0
- package/cdnjs/1.2.2/cloudbase.database.js +8 -0
- package/cdnjs/1.2.2/cloudbase.full.js +8 -0
- package/cdnjs/1.2.2/cloudbase.functions.js +1 -0
- package/cdnjs/1.2.2/cloudbase.js +1 -0
- package/cdnjs/1.2.2/cloudbase.storage.js +1 -0
- package/cdnjs/1.2.3/cloudbase.auth.js +1 -0
- package/cdnjs/1.2.3/cloudbase.database.js +8 -0
- package/cdnjs/1.2.3/cloudbase.full.js +8 -0
- package/cdnjs/1.2.3/cloudbase.functions.js +1 -0
- package/cdnjs/1.2.3/cloudbase.js +1 -0
- package/cdnjs/1.2.3/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.0/cloudbase.database.js +8 -0
- package/cdnjs/1.3.0/cloudbase.full.js +8 -0
- package/cdnjs/1.3.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.0/cloudbase.js +1 -0
- package/cdnjs/1.3.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.1/cloudbase.database.js +8 -0
- package/cdnjs/1.3.1/cloudbase.full.js +8 -0
- package/cdnjs/1.3.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.1/cloudbase.js +1 -0
- package/cdnjs/1.3.1/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.2/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.2/cloudbase.database.js +8 -0
- package/cdnjs/1.3.2/cloudbase.full.js +8 -0
- package/cdnjs/1.3.2/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.2/cloudbase.js +1 -0
- package/cdnjs/1.3.2/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.2/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.3/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.3/cloudbase.database.js +8 -0
- package/cdnjs/1.3.3/cloudbase.full.js +8 -0
- package/cdnjs/1.3.3/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.3/cloudbase.js +1 -0
- package/cdnjs/1.3.3/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.3/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.database.js +8 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.full.js +8 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.4-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.5/cloudbase.analytics.js +1 -0
- package/cdnjs/1.3.5/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.5/cloudbase.database.js +10 -0
- package/cdnjs/1.3.5/cloudbase.full.js +10 -0
- package/cdnjs/1.3.5/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.5/cloudbase.js +1 -0
- package/cdnjs/1.3.5/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.5/cloudbase.storage.js +1 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.database.js +10 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.full.js +10 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.3.5-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.4.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.4.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.4.0/cloudbase.database.js +10 -0
- package/cdnjs/1.4.0/cloudbase.full.js +10 -0
- package/cdnjs/1.4.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.4.0/cloudbase.js +1 -0
- package/cdnjs/1.4.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.4.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.4.1/cloudbase.analytics.js +1 -0
- package/cdnjs/1.4.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.4.1/cloudbase.database.js +10 -0
- package/cdnjs/1.4.1/cloudbase.full.js +10 -0
- package/cdnjs/1.4.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.4.1/cloudbase.js +1 -0
- package/cdnjs/1.4.1/cloudbase.realtime.js +1 -0
- package/cdnjs/1.4.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.database.js +10 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.full.js +10 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.4.1-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.database.js +10 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.full.js +10 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.4.2-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.5.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.5.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.5.0/cloudbase.database.js +10 -0
- package/cdnjs/1.5.0/cloudbase.full.js +10 -0
- package/cdnjs/1.5.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.5.0/cloudbase.js +1 -0
- package/cdnjs/1.5.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.5.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.5.1/cloudbase.analytics.js +1 -0
- package/cdnjs/1.5.1/cloudbase.auth.js +1 -0
- package/cdnjs/1.5.1/cloudbase.database.js +26 -0
- package/cdnjs/1.5.1/cloudbase.full.js +26 -0
- package/cdnjs/1.5.1/cloudbase.functions.js +1 -0
- package/cdnjs/1.5.1/cloudbase.js +1 -0
- package/cdnjs/1.5.1/cloudbase.realtime.js +1 -0
- package/cdnjs/1.5.1/cloudbase.storage.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.database.js +10 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.full.js +10 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.5.1-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.database.js +26 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.full.js +26 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.5.3-alpha.0/cloudbase.storage.js +1 -0
- package/cdnjs/1.6.0/cloudbase.analytics.js +1 -0
- package/cdnjs/1.6.0/cloudbase.auth.js +1 -0
- package/cdnjs/1.6.0/cloudbase.database.js +26 -0
- package/cdnjs/1.6.0/cloudbase.full.js +26 -0
- package/cdnjs/1.6.0/cloudbase.functions.js +1 -0
- package/cdnjs/1.6.0/cloudbase.js +1 -0
- package/cdnjs/1.6.0/cloudbase.realtime.js +1 -0
- package/cdnjs/1.6.0/cloudbase.storage.js +1 -0
- package/{CHANGELOG.md → changelog.md} +0 -0
- package/dist/README.md +153 -0
- package/{app → dist/app}/index.d.ts +1 -0
- package/{app → dist/app}/index.js +0 -0
- package/dist/app/index.js.map +1 -0
- package/{app → dist/app}/internal.d.ts +0 -0
- package/{app → dist/app}/internal.js +0 -0
- package/{app → dist/app}/internal.js.map +0 -0
- package/{app → dist/app}/openuri.d.ts +0 -0
- package/{app → dist/app}/openuri.js +2 -1
- package/{app → dist/app}/openuri.js.map +1 -1
- package/{app → dist/app}/request.d.ts +4 -3
- package/{app → dist/app}/request.js +20 -12
- package/dist/app/request.js.map +1 -0
- package/{app → dist/app}/storage.d.ts +0 -0
- package/{app → dist/app}/storage.js +0 -0
- package/{app → dist/app}/storage.js.map +0 -0
- package/{auth → dist/auth}/consts.d.ts +21 -4
- package/{auth → dist/auth}/consts.js +27 -5
- package/dist/auth/consts.js.map +1 -0
- package/{auth → dist/auth}/index.d.ts +83 -34
- package/{auth → dist/auth}/index.js +239 -92
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/models.d.ts +284 -0
- package/{oauthclient → dist/auth}/models.js +1 -0
- package/dist/auth/models.js.map +1 -0
- package/{captcha → dist/captcha}/index.d.ts +0 -0
- package/{captcha → dist/captcha}/index.js +4 -2
- package/dist/captcha/index.js.map +1 -0
- package/dist/changelog.md +30 -0
- package/dist/function/index.d.ts +38 -0
- package/dist/function/index.js +80 -0
- package/dist/function/index.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/{oauthclient → dist/oauthclient}/consts.d.ts +0 -0
- package/{oauthclient → dist/oauthclient}/consts.js +0 -0
- package/{oauthclient → dist/oauthclient}/consts.js.map +0 -0
- package/{oauthclient → dist/oauthclient}/index.d.ts +0 -0
- package/{oauthclient → dist/oauthclient}/index.js +2 -2
- package/dist/oauthclient/index.js.map +1 -0
- package/{oauthclient → dist/oauthclient}/interface.d.ts +4 -0
- package/{oauthclient → dist/oauthclient}/interface.js +0 -0
- package/{oauthclient → dist/oauthclient}/interface.js.map +1 -1
- package/{oauthclient → dist/oauthclient}/models.d.ts +12 -11
- package/{auth → dist/oauthclient}/models.js +0 -0
- package/{oauthclient → dist/oauthclient}/models.js.map +0 -0
- package/{oauthclient → dist/oauthclient}/oauthclient.d.ts +11 -7
- package/{oauthclient → dist/oauthclient}/oauthclient.js +27 -12
- package/dist/oauthclient/oauthclient.js.map +1 -0
- package/dist/package.json +32 -0
- package/{utils/single-promise.d.ts → dist/utils/promise.d.ts} +3 -3
- package/{utils/single-promise.js → dist/utils/promise.js} +6 -6
- package/dist/utils/promise.js.map +1 -0
- package/{utils → dist/utils}/uuid.d.ts +0 -0
- package/{utils → dist/utils}/uuid.js +0 -0
- package/{utils → dist/utils}/uuid.js.map +0 -0
- package/docs/dev.md +71 -0
- package/docs/errlog.md +79 -0
- package/package.json +3 -2
- package/publish.sh +2 -0
- package/src/app/index.ts +83 -0
- package/src/app/internal.ts +26 -0
- package/src/app/openuri.ts +111 -0
- package/src/app/request.ts +66 -0
- package/src/app/storage.ts +58 -0
- package/src/auth/consts.ts +74 -0
- package/src/auth/index.ts +718 -0
- package/src/auth/models.ts +352 -0
- package/src/captcha/index.ts +170 -0
- package/src/function/index.ts +103 -0
- package/src/index.ts +32 -0
- package/src/oauthclient/consts.ts +48 -0
- package/src/oauthclient/index.ts +33 -0
- package/src/oauthclient/interface.ts +34 -0
- package/src/oauthclient/models.ts +50 -0
- package/src/oauthclient/oauthclient.ts +487 -0
- package/src/utils/promise.ts +41 -0
- package/src/utils/uuid.ts +11 -0
- package/test/e2e/cases/custom-login.test.js +122 -0
- package/test/e2e/cases/index.test.js +61 -0
- package/test/e2e/cases/login-state.test.js +89 -0
- package/test/e2e/environment.js +39 -0
- package/test/e2e/global_setup.js +33 -0
- package/test/e2e/global_teardown.js +15 -0
- package/test/e2e/setup.js +37 -0
- package/test/unit/index.test.js +89 -0
- package/test/web/cases/auth/index.js +256 -0
- package/test/web/cases/database/collection.js +173 -0
- package/test/web/cases/database/command.js +754 -0
- package/test/web/cases/database/date.js +122 -0
- package/test/web/cases/database/db.js +20 -0
- package/test/web/cases/database/document.js +160 -0
- package/test/web/cases/database/geo-advanced.js +327 -0
- package/test/web/cases/database/geo.js +105 -0
- package/test/web/cases/database/index.js +315 -0
- package/test/web/cases/database/order.js +83 -0
- package/test/web/cases/database/realtime.js +102 -0
- package/test/web/cases/database/regex.js +140 -0
- package/test/web/cases/ext/index.js +88 -0
- package/test/web/cases/function/index.js +77 -0
- package/test/web/cases/storage/cos.jpeg +0 -0
- package/test/web/cases/storage/index.js +207 -0
- package/test/web/index.html +63 -0
- package/test/web/index.js +109 -0
- package/test/web/util.js +80 -0
- package/tsconfig.json +35 -0
- package/wiki/README.md +75 -0
- package/app/index.js.map +0 -1
- package/app/request.js.map +0 -1
- package/auth/consts.js.map +0 -1
- package/auth/index.js.map +0 -1
- package/auth/models.d.ts +0 -158
- package/auth/models.js.map +0 -1
- package/captcha/index.js.map +0 -1
- package/index.d.ts +0 -8
- package/index.js +0 -17
- package/index.js.map +0 -1
- package/oauthclient/index.js.map +0 -1
- package/oauthclient/oauthclient.js.map +0 -1
- package/utils/single-promise.js.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(function(){try{return require("null")}catch(e){}}()):"function"==typeof define&&define.amd?define("cloudbase_database",["null"],t):"object"==typeof exports?exports.cloudbase_database=t(function(){try{return require("null")}catch(e){}}()):e.cloudbase_database=t(e.null)}("undefined"!=typeof window?window:this,(function(__WEBPACK_EXTERNAL_MODULE__22__){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=12)}([function(module,__webpack_exports__,__webpack_require__){"use strict";(function(global,Buffer){__webpack_require__.d(__webpack_exports__,"a",(function(){return bson_54}));var long__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(3),long__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(long__WEBPACK_IMPORTED_MODULE_0__),buffer__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1),buffer__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(buffer__WEBPACK_IMPORTED_MODULE_1__),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var map=createCommonjsModule((function(e){if(void 0!==commonjsGlobal.Map)e.exports=commonjsGlobal.Map,e.exports.Map=commonjsGlobal.Map;else{var t=function(e){this._keys=[],this._values={};for(var t=0;t<e.length;t++)if(null!=e[t]){var r=e[t],n=r[0],i=r[1];this._keys.push(n),this._values[n]={v:i,i:this._keys.length-1}}};t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(e){var t=this._values[e];return null!=t&&(delete this._values[e],this._keys.splice(t.i,1),!0)},t.prototype.entries=function(){var e=this,t=0;return{next:function(){var r=e._keys[t++];return{value:void 0!==r?[r,e._values[r].v]:void 0,done:void 0===r}}}},t.prototype.forEach=function(e,t){t=t||this;for(var r=0;r<this._keys.length;r++){var n=this._keys[r];e.call(t,this._values[n].v,n,t)}},t.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},t.prototype.has=function(e){return null!=this._values[e]},t.prototype.keys=function(){var e=this,t=0;return{next:function(){var r=e._keys[t++];return{value:void 0!==r?r:void 0,done:void 0===r}}}},t.prototype.set=function(e,t){return this._values[e]?(this._values[e].v=t,this):(this._keys.push(e),this._values[e]={v:t,i:this._keys.length-1},this)},t.prototype.values=function(){var e=this,t=0;return{next:function(){var r=e._keys[t++];return{value:void 0!==r?e._values[r].v:void 0,done:void 0===r}}}},Object.defineProperty(t.prototype,"size",{enumerable:!0,get:function(){return this._keys.length}}),e.exports=t}})),map_1=map.Map;long__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},long__WEBPACK_IMPORTED_MODULE_0___default.a.fromExtendedJSON=function(e,t){var r=long__WEBPACK_IMPORTED_MODULE_0___default.a.fromString(e.$numberLong);return t&&t.relaxed?r.toNumber():r},Object.defineProperty(long__WEBPACK_IMPORTED_MODULE_0___default.a.prototype,"_bsontype",{value:"Long"});var long_1=long__WEBPACK_IMPORTED_MODULE_0___default.a;function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}var Double=function(){function e(t){_classCallCheck(this,e),t instanceof Number&&(t=t.valueOf()),this.value=t}return _createClass(e,[{key:"valueOf",value:function(){return this.value}},{key:"toJSON",value:function(){return this.value}},{key:"toExtendedJSON",value:function(e){return e&&(e.legacy||e.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()}}}],[{key:"fromExtendedJSON",value:function(t,r){var n=parseFloat(t.$numberDouble);return r&&r.relaxed?n:new e(n)}}]),e}();Object.defineProperty(Double.prototype,"_bsontype",{value:"Double"});var double_1=Double;function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck$1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$1(e,t,r){return t&&_defineProperties$1(e.prototype,t),r&&_defineProperties$1(e,r),e}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Timestamp=function(e){function t(e,r){var n;return _classCallCheck$1(this,t),n=long_1.isLong(e)?_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e.low,e.high,!0)):_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,r,!0)),_possibleConstructorReturn(n)}return _inherits(t,e),_createClass$1(t,[{key:"toJSON",value:function(){return{$timestamp:this.toString()}}},{key:"toExtendedJSON",value:function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}}}],[{key:"fromInt",value:function(e){return new t(long_1.fromInt(e,!0))}},{key:"fromNumber",value:function(e){return new t(long_1.fromNumber(e,!0))}},{key:"fromBits",value:function(e,r){return new t(e,r)}},{key:"fromString",value:function(e,r){return new t(long_1.fromString(e,r,!0))}},{key:"fromExtendedJSON",value:function(e){return new t(e.$timestamp.i,e.$timestamp.t)}}]),t}(long_1);Object.defineProperty(Timestamp.prototype,"_bsontype",{value:"Timestamp"}),Timestamp.MAX_VALUE=Timestamp.MAX_UNSIGNED_VALUE;var timestamp=Timestamp,require$$0={};function normalizedFunctionString(e){return e.toString().replace("function(","function (")}function insecureRandomBytes(e){for(var t=new Uint8Array(e),r=0;r<e;++r)t[r]=Math.floor(256*Math.random());return t}var randomBytes=insecureRandomBytes;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues)randomBytes=function(e){return window.crypto.getRandomValues(new Uint8Array(e))};else{try{randomBytes=require$$0.randomBytes}catch(e){}null==randomBytes&&(randomBytes=insecureRandomBytes)}var utils={normalizedFunctionString:normalizedFunctionString,randomBytes:randomBytes};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}"function"==typeof global.setTimeout&&(cachedSetTimeout=setTimeout),"function"==typeof global.clearTimeout&&(cachedClearTimeout=clearTimeout);var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function nextTick(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)}function Item(e,t){this.fun=e,this.array=t}Item.prototype.run=function(){this.fun.apply(null,this.array)};var title="browser",platform="browser",browser=!0,env={},argv=[],version="",versions={},release={},config={};function noop(){}var on=noop,addListener=noop,once=noop,off=noop,removeListener=noop,removeAllListeners=noop,emit=noop;function binding(e){throw new Error("process.binding is not supported")}function cwd(){return"/"}function chdir(e){throw new Error("process.chdir is not supported")}function umask(){return 0}var performance=global.performance||{},performanceNow=performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow||function(){return(new Date).getTime()};function hrtime(e){var t=.001*performanceNow.call(performance),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]}var startTime=new Date;function uptime(){return(new Date-startTime)/1e3}var process={nextTick:nextTick,title:title,browser:browser,env:env,argv:argv,version:version,versions:versions,on:on,addListener:addListener,once:once,off:off,removeListener:removeListener,removeAllListeners:removeAllListeners,emit:emit,binding:binding,cwd:cwd,chdir:chdir,umask:umask,hrtime:hrtime,platform:platform,release:release,config:config,uptime:uptime},inherits;inherits="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e};var inherits$1=inherits;function _typeof$1(e){return(_typeof$1="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var formatRegExp=/%[sdj%]/g;function format(e){if(!isString(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(inspect(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,i=n.length,o=String(e).replace(formatRegExp,(function(e){if("%%"===e)return"%";if(r>=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),s=n[r];r<i;s=n[++r])isNull(s)||!isObject(s)?o+=" "+s:o+=" "+inspect(s);return o}function deprecate(e,t){if(isUndefined(global.process))return function(){return deprecate(e,t).apply(this,arguments)};var r=!1;return function(){return r||(console.error(t),r=!0),e.apply(this,arguments)}}var debugs={},debugEnviron;function debuglog(e){if(isUndefined(debugEnviron)&&(debugEnviron=process.env.NODE_DEBUG||""),e=e.toUpperCase(),!debugs[e])if(new RegExp("\\b"+e+"\\b","i").test(debugEnviron)){debugs[e]=function(){var t=format.apply(null,arguments);console.error("%s %d: %s",e,0,t)}}else debugs[e]=function(){};return debugs[e]}function inspect(e,t){var r={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),isBoolean(t)?r.showHidden=t:t&&_extend(r,t),isUndefined(r.showHidden)&&(r.showHidden=!1),isUndefined(r.depth)&&(r.depth=2),isUndefined(r.colors)&&(r.colors=!1),isUndefined(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=stylizeWithColor),formatValue(r,e,r.depth)}function stylizeWithColor(e,t){var r=inspect.styles[t];return r?"["+inspect.colors[r][0]+"m"+e+"["+inspect.colors[r][1]+"m":e}function stylizeNoColor(e,t){return e}function arrayToHash(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}function formatValue(e,t,r){if(e.customInspect&&t&&isFunction(t.inspect)&&t.inspect!==inspect&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return isString(n)||(n=formatValue(e,n,r)),n}var i=formatPrimitive(e,t);if(i)return i;var o=Object.keys(t),s=arrayToHash(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),isError(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(t);if(0===o.length){if(isFunction(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(isRegExp(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(isDate(t))return e.stylize(Date.prototype.toString.call(t),"date");if(isError(t))return formatError(t)}var u,c="",l=!1,f=["{","}"];(isArray(t)&&(l=!0,f=["[","]"]),isFunction(t))&&(c=" [Function"+(t.name?": "+t.name:"")+"]");return isRegExp(t)&&(c=" "+RegExp.prototype.toString.call(t)),isDate(t)&&(c=" "+Date.prototype.toUTCString.call(t)),isError(t)&&(c=" "+formatError(t)),0!==o.length||l&&0!=t.length?r<0?isRegExp(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=l?formatArray(e,t,r,s,o):o.map((function(n){return formatProperty(e,t,r,s,n,l)})),e.seen.pop(),reduceToSingleString(u,c,f)):f[0]+c+f[1]}function formatPrimitive(e,t){if(isUndefined(t))return e.stylize("undefined","undefined");if(isString(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return isNumber(t)?e.stylize(""+t,"number"):isBoolean(t)?e.stylize(""+t,"boolean"):isNull(t)?e.stylize("null","null"):void 0}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatArray(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)hasOwnProperty(t,String(s))?o.push(formatProperty(e,t,r,n,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(formatProperty(e,t,r,n,i,!0))})),o}function formatProperty(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),hasOwnProperty(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=isNull(r)?formatValue(e,u.value,null):formatValue(e,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function reduceToSingleString(e,t,r){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isNull(e){return null===e}function isNullOrUndefined(e){return null==e}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isSymbol(e){return"symbol"===_typeof$1(e)}function isUndefined(e){return void 0===e}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"===_typeof$1(e)&&null!==e}function isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(e){return"function"==typeof e}function isPrimitive(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"===_typeof$1(e)||void 0===e}function isBuffer(e){return Buffer.isBuffer(e)}function objectToString(e){return Object.prototype.toString.call(e)}function pad(e){return e<10?"0"+e.toString(10):e.toString(10)}inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp$1(){var e=new Date,t=[pad(e.getHours()),pad(e.getMinutes()),pad(e.getSeconds())].join(":");return[e.getDate(),months[e.getMonth()],t].join(" ")}function log(){console.log("%s - %s",timestamp$1(),format.apply(null,arguments))}function _extend(e,t){if(!t||!isObject(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function hasOwnProperty(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var util={inherits:inherits$1,_extend:_extend,log:log,isBuffer:isBuffer,isPrimitive:isPrimitive,isFunction:isFunction,isError:isError,isDate:isDate,isObject:isObject,isRegExp:isRegExp,isUndefined:isUndefined,isSymbol:isSymbol,isString:isString,isNumber:isNumber,isNullOrUndefined:isNullOrUndefined,isNull:isNull,isBoolean:isBoolean,isArray:isArray,inspect:inspect,deprecate:deprecate,format:format,debuglog:debuglog};function _classCallCheck$2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$2(e,t,r){return t&&_defineProperties$2(e.prototype,t),r&&_defineProperties$2(e,r),e}var Buffer$1=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,randomBytes$1=utils.randomBytes,deprecate$1=util.deprecate,PROCESS_UNIQUE=randomBytes$1(5),checkForHexRegExp=new RegExp("^[0-9a-fA-F]{24}$"),hasBufferType=!1;try{Buffer$1&&Buffer$1.from&&(hasBufferType=!0)}catch(e){hasBufferType=!1}for(var hexTable=[],_i=0;_i<256;_i++)hexTable[_i]=(_i<=15?"0":"")+_i.toString(16);for(var decodeLookup=[],i=0;i<10;)decodeLookup[48+i]=i++;for(;i<16;)decodeLookup[55+i]=decodeLookup[87+i]=i++;var _Buffer=Buffer$1;function convertToHex(e){return e.toString("hex")}function makeObjectIdError(e,t){var r=e[t];return new TypeError('ObjectId string "'.concat(e,'" contains invalid character "').concat(r,'" with character code (').concat(e.charCodeAt(t),"). All character codes for a non-hex string must be less than 256."))}var ObjectId=function(){function e(t){if(_classCallCheck$2(this,e),t instanceof e)return t;if(null==t||"number"==typeof t)return this.id=e.generate(t),void(e.cacheHexString&&(this.__id=this.toString("hex")));var r=e.isValid(t);if(!r&&null!=t)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(r&&"string"==typeof t&&24===t.length&&hasBufferType)return new e(Buffer$1.from(t,"hex"));if(r&&"string"==typeof t&&24===t.length)return e.createFromHexString(t);if(null==t||12!==t.length){if(null!=t&&t.toHexString)return e.createFromHexString(t.toHexString());throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}this.id=t,e.cacheHexString&&(this.__id=this.toString("hex"))}return _createClass$2(e,[{key:"toHexString",value:function(){if(e.cacheHexString&&this.__id)return this.__id;var t="";if(!this.id||!this.id.length)throw new TypeError("invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is ["+JSON.stringify(this.id)+"]");if(this.id instanceof _Buffer)return t=convertToHex(this.id),e.cacheHexString&&(this.__id=t),t;for(var r=0;r<this.id.length;r++){var n=hexTable[this.id.charCodeAt(r)];if("string"!=typeof n)throw makeObjectIdError(this.id,r);t+=n}return e.cacheHexString&&(this.__id=t),t}},{key:"toString",value:function(e){return this.id&&this.id.copy?this.id.toString("string"==typeof e?e:"hex"):this.toHexString()}},{key:"toJSON",value:function(){return this.toHexString()}},{key:"equals",value:function(t){return t instanceof e?this.toString()===t.toString():"string"==typeof t&&e.isValid(t)&&12===t.length&&this.id instanceof _Buffer?t===this.id.toString("binary"):"string"==typeof t&&e.isValid(t)&&24===t.length?t.toLowerCase()===this.toHexString():"string"==typeof t&&e.isValid(t)&&12===t.length?t===this.id:!(null==t||!(t instanceof e||t.toHexString))&&t.toHexString()===this.toHexString()}},{key:"getTimestamp",value:function(){var e=new Date,t=this.id.readUInt32BE(0);return e.setTime(1e3*Math.floor(t)),e}},{key:"toExtendedJSON",value:function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}}}],[{key:"getInc",value:function(){return e.index=(e.index+1)%16777215}},{key:"generate",value:function(t){"number"!=typeof t&&(t=~~(Date.now()/1e3));var r=e.getInc(),n=Buffer$1.alloc(12);return n[3]=255&t,n[2]=t>>8&255,n[1]=t>>16&255,n[0]=t>>24&255,n[4]=PROCESS_UNIQUE[0],n[5]=PROCESS_UNIQUE[1],n[6]=PROCESS_UNIQUE[2],n[7]=PROCESS_UNIQUE[3],n[8]=PROCESS_UNIQUE[4],n[11]=255&r,n[10]=r>>8&255,n[9]=r>>16&255,n}},{key:"createPk",value:function(){return new e}},{key:"createFromTime",value:function(t){var r=Buffer$1.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r[3]=255&t,r[2]=t>>8&255,r[1]=t>>16&255,r[0]=t>>24&255,new e(r)}},{key:"createFromHexString",value:function(t){if(void 0===t||null!=t&&24!==t.length)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(hasBufferType)return new e(Buffer$1.from(t,"hex"));for(var r=new _Buffer(12),n=0,i=0;i<24;)r[n++]=decodeLookup[t.charCodeAt(i++)]<<4|decodeLookup[t.charCodeAt(i++)];return new e(r)}},{key:"isValid",value:function(t){return null!=t&&("number"==typeof t||("string"==typeof t?12===t.length||24===t.length&&checkForHexRegExp.test(t):t instanceof e||(t instanceof _Buffer&&12===t.length||!!t.toHexString&&(12===t.id.length||24===t.id.length&&checkForHexRegExp.test(t.id)))))}},{key:"fromExtendedJSON",value:function(t){return new e(t.$oid)}}]),e}();ObjectId.get_inc=deprecate$1((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead"),ObjectId.prototype.get_inc=deprecate$1((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead"),ObjectId.prototype.getInc=deprecate$1((function(){return ObjectId.getInc()}),"Please use the static `ObjectId.getInc()` instead"),ObjectId.prototype.generate=deprecate$1((function(e){return ObjectId.generate(e)}),"Please use the static `ObjectId.generate(time)` instead"),Object.defineProperty(ObjectId.prototype,"generationTime",{enumerable:!0,get:function(){return this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24},set:function(e){this.id[3]=255&e,this.id[2]=e>>8&255,this.id[1]=e>>16&255,this.id[0]=e>>24&255}}),ObjectId.prototype[util.inspect.custom||"inspect"]=ObjectId.prototype.toString,ObjectId.index=~~(16777215*Math.random()),Object.defineProperty(ObjectId.prototype,"_bsontype",{value:"ObjectID"});var objectid=ObjectId;function _classCallCheck$3(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$3(e,t,r){return t&&_defineProperties$3(e.prototype,t),r&&_defineProperties$3(e,r),e}function alphabetize(e){return e.split("").sort().join("")}var BSONRegExp=function(){function e(t,r){_classCallCheck$3(this,e),this.pattern=t||"",this.options=r?alphabetize(r):"";for(var n=0;n<this.options.length;n++)if("i"!==this.options[n]&&"m"!==this.options[n]&&"x"!==this.options[n]&&"l"!==this.options[n]&&"s"!==this.options[n]&&"u"!==this.options[n])throw new Error("The regular expression option [".concat(this.options[n],"] is not supported"))}return _createClass$3(e,[{key:"toExtendedJSON",value:function(e){return(e=e||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}}}],[{key:"parseOptions",value:function(e){return e?e.split("").sort().join(""):""}},{key:"fromExtendedJSON",value:function(t){return t.$regex?"BSONRegExp"===t.$regex._bsontype?t:new e(t.$regex,e.parseOptions(t.$options)):new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options))}}]),e}();Object.defineProperty(BSONRegExp.prototype,"_bsontype",{value:"BSONRegExp"});var regexp=BSONRegExp;function _classCallCheck$4(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$4(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$4(e,t,r){return t&&_defineProperties$4(e.prototype,t),r&&_defineProperties$4(e,r),e}var BSONSymbol=function(){function e(t){_classCallCheck$4(this,e),this.value=t}return _createClass$4(e,[{key:"valueOf",value:function(){return this.value}},{key:"toString",value:function(){return this.value}},{key:"inspect",value:function(){return this.value}},{key:"toJSON",value:function(){return this.value}},{key:"toExtendedJSON",value:function(){return{$symbol:this.value}}}],[{key:"fromExtendedJSON",value:function(t){return new e(t.$symbol)}}]),e}();Object.defineProperty(BSONSymbol.prototype,"_bsontype",{value:"Symbol"});var symbol=BSONSymbol;function _classCallCheck$5(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$5(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$5(e,t,r){return t&&_defineProperties$5(e.prototype,t),r&&_defineProperties$5(e,r),e}var Int32=function(){function e(t){_classCallCheck$5(this,e),t instanceof Number&&(t=t.valueOf()),this.value=t}return _createClass$5(e,[{key:"valueOf",value:function(){return this.value}},{key:"toJSON",value:function(){return this.value}},{key:"toExtendedJSON",value:function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}}}],[{key:"fromExtendedJSON",value:function(t,r){return r&&r.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)}}]),e}();Object.defineProperty(Int32.prototype,"_bsontype",{value:"Int32"});var int_32=Int32;function _classCallCheck$6(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$6(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$6(e,t,r){return t&&_defineProperties$6(e.prototype,t),r&&_defineProperties$6(e,r),e}var Code=function(){function e(t,r){_classCallCheck$6(this,e),this.code=t,this.scope=r}return _createClass$6(e,[{key:"toJSON",value:function(){return{scope:this.scope,code:this.code}}},{key:"toExtendedJSON",value:function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}}],[{key:"fromExtendedJSON",value:function(t){return new e(t.$code,t.$scope)}}]),e}();Object.defineProperty(Code.prototype,"_bsontype",{value:"Code"});var code=Code,Buffer$2=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,PARSE_STRING_REGEXP=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,PARSE_INF_REGEXP=/^(\+|-)?(Infinity|inf)$/i,PARSE_NAN_REGEXP=/^(\+|-)?NaN$/i,EXPONENT_MAX=6111,EXPONENT_MIN=-6176,EXPONENT_BIAS=6176,MAX_DIGITS=34,NAN_BUFFER=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),INF_NEGATIVE_BUFFER=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),INF_POSITIVE_BUFFER=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),EXPONENT_REGEX=/^([-+])?(\d+)?$/;function isDigit(e){return!isNaN(parseInt(e,10))}function divideu128(e){var t=long_1.fromNumber(1e9),r=long_1.fromNumber(0);if(!(e.parts[0]||e.parts[1]||e.parts[2]||e.parts[3]))return{quotient:e,rem:r};for(var n=0;n<=3;n++)r=(r=r.shiftLeft(32)).add(new long_1(e.parts[n],0)),e.parts[n]=r.div(t).low,r=r.modulo(t);return{quotient:e,rem:r}}function multiply64x2(e,t){if(!e&&!t)return{high:long_1.fromNumber(0),low:long_1.fromNumber(0)};var r=e.shiftRightUnsigned(32),n=new long_1(e.getLowBits(),0),i=t.shiftRightUnsigned(32),o=new long_1(t.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),u=n.multiply(i),c=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new long_1(a.getLowBits(),0).add(u).add(c.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:c=a.shiftLeft(32).add(new long_1(c.getLowBits(),0))}}function lessThan(e,t){var r=e.high>>>0,n=t.high>>>0;return r<n||r===n&&e.low>>>0<t.low>>>0}function invalidErr(e,t){throw new TypeError('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}function Decimal128(e){this.bytes=e}Decimal128.fromString=function(e){var t,r=!1,n=!1,i=!1,o=0,s=0,a=0,u=0,c=0,l=[0],f=0,h=0,d=0,p=0,_=0,g=0,y=[0,0],m=[0,0],b=0;if(e.length>=7e3)throw new TypeError(e+" not a valid Decimal128 string");var w=e.match(PARSE_STRING_REGEXP),E=e.match(PARSE_INF_REGEXP),v=e.match(PARSE_NAN_REGEXP);if(!w&&!E&&!v||0===e.length)throw new TypeError(e+" not a valid Decimal128 string");if(w){var S=w[2],A=w[4],N=w[5],O=w[6];A&&void 0===O&&invalidErr(e,"missing exponent power"),A&&void 0===S&&invalidErr(e,"missing exponent base"),void 0===A&&(N||O)&&invalidErr(e,"missing e before exponent")}if("+"!==e[b]&&"-"!==e[b]||(r="-"===e[b++]),!isDigit(e[b])&&"."!==e[b]){if("i"===e[b]||"I"===e[b])return new Decimal128(Buffer$2.from(r?INF_NEGATIVE_BUFFER:INF_POSITIVE_BUFFER));if("N"===e[b])return new Decimal128(Buffer$2.from(NAN_BUFFER))}for(;isDigit(e[b])||"."===e[b];)"."!==e[b]?(f<34&&("0"!==e[b]||i)&&(i||(c=s),i=!0,l[h++]=parseInt(e[b],10),f+=1),i&&(a+=1),n&&(u+=1),s+=1,b+=1):(n&&invalidErr(e,"contains multiple periods"),n=!0,b+=1);if(n&&!s)throw new TypeError(e+" not a valid Decimal128 string");if("e"===e[b]||"E"===e[b]){var T=e.substr(++b).match(EXPONENT_REGEX);if(!T||!T[2])return new Decimal128(Buffer$2.from(NAN_BUFFER));_=parseInt(T[0],10),b+=T[0].length}if(e[b])return new Decimal128(Buffer$2.from(NAN_BUFFER));if(d=0,f){if(p=f-1,1!==(o=a))for(;"0"===e[c+o-1];)o-=1}else d=0,p=0,l[0]=0,a=1,f=1,o=0;for(_<=u&&u-_>16384?_=EXPONENT_MIN:_-=u;_>EXPONENT_MAX;){if((p+=1)-d>MAX_DIGITS){if(l.join("").match(/^0+$/)){_=EXPONENT_MAX;break}invalidErr(e,"overflow")}_-=1}for(;_<EXPONENT_MIN||f<a;){if(0===p&&o<f){_=EXPONENT_MIN,o=0;break}if(f<a?a-=1:p-=1,_<EXPONENT_MAX)_+=1;else{if(l.join("").match(/^0+$/)){_=EXPONENT_MAX;break}invalidErr(e,"overflow")}}if(p-d+1<o){var I=s;n&&(c+=1,I+=1),r&&(c+=1,I+=1);var B=parseInt(e[c+p+1],10),R=0;if(B>=5&&(R=1,5===B))for(R=l[p]%2==1,g=c+p+2;g<I;g++)if(parseInt(e[g],10)){R=1;break}if(R)for(var D=p;D>=0;D--)if(++l[D]>9&&(l[D]=0,0===D)){if(!(_<EXPONENT_MAX))return new Decimal128(Buffer$2.from(r?INF_NEGATIVE_BUFFER:INF_POSITIVE_BUFFER));_+=1,l[D]=1}}if(y=long_1.fromNumber(0),m=long_1.fromNumber(0),0===o)y=long_1.fromNumber(0),m=long_1.fromNumber(0);else if(p-d<17){var C=d;for(m=long_1.fromNumber(l[C++]),y=new long_1(0,0);C<=p;C++)m=(m=m.multiply(long_1.fromNumber(10))).add(long_1.fromNumber(l[C]))}else{var P=d;for(y=long_1.fromNumber(l[P++]);P<=p-17;P++)y=(y=y.multiply(long_1.fromNumber(10))).add(long_1.fromNumber(l[P]));for(m=long_1.fromNumber(l[P++]);P<=p;P++)m=(m=m.multiply(long_1.fromNumber(10))).add(long_1.fromNumber(l[P]))}var $=multiply64x2(y,long_1.fromString("100000000000000000"));$.low=$.low.add(m),lessThan($.low,m)&&($.high=$.high.add(long_1.fromNumber(1))),t=_+EXPONENT_BIAS;var M={low:long_1.fromNumber(0),high:long_1.fromNumber(0)};$.high.shiftRightUnsigned(49).and(long_1.fromNumber(1)).equals(long_1.fromNumber(1))?(M.high=M.high.or(long_1.fromNumber(3).shiftLeft(61)),M.high=M.high.or(long_1.fromNumber(t).and(long_1.fromNumber(16383).shiftLeft(47))),M.high=M.high.or($.high.and(long_1.fromNumber(0x7fffffffffff)))):(M.high=M.high.or(long_1.fromNumber(16383&t).shiftLeft(49)),M.high=M.high.or($.high.and(long_1.fromNumber(562949953421311)))),M.low=$.low,r&&(M.high=M.high.or(long_1.fromString("9223372036854775808")));var L=Buffer$2.alloc(16);return b=0,L[b++]=255&M.low.low,L[b++]=M.low.low>>8&255,L[b++]=M.low.low>>16&255,L[b++]=M.low.low>>24&255,L[b++]=255&M.low.high,L[b++]=M.low.high>>8&255,L[b++]=M.low.high>>16&255,L[b++]=M.low.high>>24&255,L[b++]=255&M.high.low,L[b++]=M.high.low>>8&255,L[b++]=M.high.low>>16&255,L[b++]=M.high.low>>24&255,L[b++]=255&M.high.high,L[b++]=M.high.high>>8&255,L[b++]=M.high.high>>16&255,L[b++]=M.high.high>>24&255,new Decimal128(L)};var COMBINATION_MASK=31,EXPONENT_MASK=16383,COMBINATION_INFINITY=30,COMBINATION_NAN=31;Decimal128.prototype.toString=function(){for(var e,t,r,n,i,o,s=0,a=new Array(36),u=0;u<a.length;u++)a[u]=0;var c,l,f,h,d,p=0,_=!1,g={parts:new Array(4)},y=[];p=0;var m=this.bytes;if(n=m[p++]|m[p++]<<8|m[p++]<<16|m[p++]<<24,r=m[p++]|m[p++]<<8|m[p++]<<16|m[p++]<<24,t=m[p++]|m[p++]<<8|m[p++]<<16|m[p++]<<24,e=m[p++]|m[p++]<<8|m[p++]<<16|m[p++]<<24,p=0,{low:new long_1(n,r),high:new long_1(t,e)}.high.lessThan(long_1.ZERO)&&y.push("-"),(i=e>>26&COMBINATION_MASK)>>3==3){if(i===COMBINATION_INFINITY)return y.join("")+"Infinity";if(i===COMBINATION_NAN)return"NaN";o=e>>15&EXPONENT_MASK,f=8+(e>>14&1)}else f=e>>14&7,o=e>>17&EXPONENT_MASK;if(c=o-EXPONENT_BIAS,g.parts[0]=(16383&e)+((15&f)<<14),g.parts[1]=t,g.parts[2]=r,g.parts[3]=n,0===g.parts[0]&&0===g.parts[1]&&0===g.parts[2]&&0===g.parts[3])_=!0;else for(d=3;d>=0;d--){var b=0,w=divideu128(g);if(g=w.quotient,b=w.rem.low)for(h=8;h>=0;h--)a[9*d+h]=b%10,b=Math.floor(b/10)}if(_)s=1,a[p]=0;else for(s=36;!a[p];)s-=1,p+=1;if((l=s-1+c)>=34||l<=-7||c>0){if(s>34)return y.push(0),c>0?y.push("E+"+c):c<0&&y.push("E"+c),y.join("");y.push(a[p++]),(s-=1)&&y.push(".");for(var E=0;E<s;E++)y.push(a[p++]);y.push("E"),l>0?y.push("+"+l):y.push(l)}else if(c>=0)for(var v=0;v<s;v++)y.push(a[p++]);else{var S=s+c;if(S>0)for(var A=0;A<S;A++)y.push(a[p++]);else y.push("0");for(y.push(".");S++<0;)y.push("0");for(var N=0;N<s-Math.max(S-1,0);N++)y.push(a[p++])}return y.join("")},Decimal128.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},Decimal128.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},Decimal128.fromExtendedJSON=function(e){return Decimal128.fromString(e.$numberDecimal)},Object.defineProperty(Decimal128.prototype,"_bsontype",{value:"Decimal128"});var decimal128=Decimal128;function _classCallCheck$7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$7(e,t,r){return t&&_defineProperties$7(e.prototype,t),r&&_defineProperties$7(e,r),e}var MinKey=function(){function e(){_classCallCheck$7(this,e)}return _createClass$7(e,[{key:"toExtendedJSON",value:function(){return{$minKey:1}}}],[{key:"fromExtendedJSON",value:function(){return new e}}]),e}();Object.defineProperty(MinKey.prototype,"_bsontype",{value:"MinKey"});var min_key=MinKey;function _classCallCheck$8(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$8(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$8(e,t,r){return t&&_defineProperties$8(e.prototype,t),r&&_defineProperties$8(e,r),e}var MaxKey=function(){function e(){_classCallCheck$8(this,e)}return _createClass$8(e,[{key:"toExtendedJSON",value:function(){return{$maxKey:1}}}],[{key:"fromExtendedJSON",value:function(){return new e}}]),e}();Object.defineProperty(MaxKey.prototype,"_bsontype",{value:"MaxKey"});var max_key=MaxKey;function _classCallCheck$9(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$9(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$9(e,t,r){return t&&_defineProperties$9(e.prototype,t),r&&_defineProperties$9(e,r),e}var DBRef=function(){function e(t,r,n,i){_classCallCheck$9(this,e);var o=t.split(".");2===o.length&&(n=o.shift(),t=o.shift()),this.collection=t,this.oid=r,this.db=n,this.fields=i||{}}return _createClass$9(e,[{key:"toJSON",value:function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(e.$db=this.db),e}},{key:"toExtendedJSON",value:function(e){e=e||{};var t={$ref:this.collection,$id:this.oid};return e.legacy?t:(this.db&&(t.$db=this.db),t=Object.assign(t,this.fields))}}],[{key:"fromExtendedJSON",value:function(t){var r=Object.assign({},t);return["$ref","$id","$db"].forEach((function(e){return delete r[e]})),new e(t.$ref,t.$id,t.$db,r)}}]),e}();Object.defineProperty(DBRef.prototype,"_bsontype",{value:"DBRef"}),Object.defineProperty(DBRef.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},configurable:!1});var db_ref=DBRef;function _classCallCheck$a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties$a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass$a(e,t,r){return t&&_defineProperties$a(e.prototype,t),r&&_defineProperties$a(e,r),e}var Buffer$3=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,Binary=function(){function e(t,r){if(_classCallCheck$a(this,e),!(null==t||"string"==typeof t||Buffer$3.isBuffer(t)||t instanceof Uint8Array||Array.isArray(t)))throw new TypeError("only String, Buffer, Uint8Array or Array accepted");if(this.sub_type=null==r?BSON_BINARY_SUBTYPE_DEFAULT:r,this.position=0,null==t||t instanceof Number)void 0!==Buffer$3?this.buffer=Buffer$3.alloc(e.BUFFER_SIZE):"undefined"!=typeof Uint8Array?this.buffer=new Uint8Array(new ArrayBuffer(e.BUFFER_SIZE)):this.buffer=new Array(e.BUFFER_SIZE);else{if("string"==typeof t)if(void 0!==Buffer$3)this.buffer=Buffer$3.from(t);else{if("undefined"==typeof Uint8Array&&!Array.isArray(t))throw new TypeError("only String, Buffer, Uint8Array or Array accepted");this.buffer=writeStringToArray(t)}else this.buffer=t;this.position=t.length}}return _createClass$a(e,[{key:"put",value:function(t){if(null!=t.length&&"number"!=typeof t&&1!==t.length)throw new TypeError("only accepts single character String, Uint8Array or Array");if("number"!=typeof t&&t<0||t>255)throw new TypeError("only accepts number in a valid unsigned byte range 0-255");var r=null;if(r="string"==typeof t?t.charCodeAt(0):null!=t.length?t[0]:t,this.buffer.length>this.position)this.buffer[this.position++]=r;else if(void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer)){var n=Buffer$3.alloc(e.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}else{var i=null;i=isUint8Array(this.buffer)?new Uint8Array(new ArrayBuffer(e.BUFFER_SIZE+this.buffer.length)):new Array(e.BUFFER_SIZE+this.buffer.length);for(var o=0;o<this.buffer.length;o++)i[o]=this.buffer[o];this.buffer=i,this.buffer[this.position++]=r}}},{key:"write",value:function(e,t){if(t="number"==typeof t?t:this.position,this.buffer.length<t+e.length){var r=null;if(void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer))r=Buffer$3.alloc(this.buffer.length+e.length),this.buffer.copy(r,0,0,this.buffer.length);else if(isUint8Array(this.buffer)){r=new Uint8Array(new ArrayBuffer(this.buffer.length+e.length));for(var n=0;n<this.position;n++)r[n]=this.buffer[n]}this.buffer=r}if(void 0!==Buffer$3&&Buffer$3.isBuffer(e)&&Buffer$3.isBuffer(this.buffer))e.copy(this.buffer,t,0,e.length),this.position=t+e.length>this.position?t+e.length:this.position;else if(void 0!==Buffer$3&&"string"==typeof e&&Buffer$3.isBuffer(this.buffer))this.buffer.write(e,t,"binary"),this.position=t+e.length>this.position?t+e.length:this.position;else if(isUint8Array(e)||Array.isArray(e)&&"string"!=typeof e){for(var i=0;i<e.length;i++)this.buffer[t++]=e[i];this.position=t>this.position?t:this.position}else if("string"==typeof e){for(var o=0;o<e.length;o++)this.buffer[t++]=e.charCodeAt(o);this.position=t>this.position?t:this.position}}},{key:"read",value:function(e,t){if(t=t&&t>0?t:this.position,this.buffer.slice)return this.buffer.slice(e,e+t);for(var r="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(t)):new Array(t),n=0;n<t;n++)r[n]=this.buffer[e++];return r}},{key:"value",value:function(e){if((e=null!=e&&e)&&void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer)&&this.buffer.length===this.position)return this.buffer;if(void 0!==Buffer$3&&Buffer$3.isBuffer(this.buffer))return e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position);if(e){if(null!=this.buffer.slice)return this.buffer.slice(0,this.position);for(var t=isUint8Array(this.buffer)?new Uint8Array(new ArrayBuffer(this.position)):new Array(this.position),r=0;r<this.position;r++)t[r]=this.buffer[r];return t}return convertArraytoUtf8BinaryString(this.buffer,0,this.position)}},{key:"length",value:function(){return this.position}},{key:"toJSON",value:function(){return null!=this.buffer?this.buffer.toString("base64"):""}},{key:"toString",value:function(e){return null!=this.buffer?this.buffer.slice(0,this.position).toString(e):""}},{key:"toExtendedJSON",value:function(e){e=e||{};var t=Buffer$3.isBuffer(this.buffer)?this.buffer.toString("base64"):Buffer$3.from(this.buffer).toString("base64"),r=Number(this.sub_type).toString(16);return e.legacy?{$binary:t,$type:1===r.length?"0"+r:r}:{$binary:{base64:t,subType:1===r.length?"0"+r:r}}}}],[{key:"fromExtendedJSON",value:function(t,r){var n,i;return(r=r||{}).legacy?(i=t.$type?parseInt(t.$type,16):0,n=Buffer$3.from(t.$binary,"base64")):(i=t.$binary.subType?parseInt(t.$binary.subType,16):0,n=Buffer$3.from(t.$binary.base64,"base64")),new e(n,i)}}]),e}(),BSON_BINARY_SUBTYPE_DEFAULT=0;function isUint8Array(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)}function writeStringToArray(e){for(var t="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(e.length)):new Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function convertArraytoUtf8BinaryString(e,t,r){for(var n="",i=t;i<r;i++)n+=String.fromCharCode(e[i]);return n}Binary.BUFFER_SIZE=256,Binary.SUBTYPE_DEFAULT=0,Binary.SUBTYPE_FUNCTION=1,Binary.SUBTYPE_BYTE_ARRAY=2,Binary.SUBTYPE_UUID_OLD=3,Binary.SUBTYPE_UUID=4,Binary.SUBTYPE_MD5=5,Binary.SUBTYPE_USER_DEFINED=128,Object.defineProperty(Binary.prototype,"_bsontype",{value:"Binary"});var binary=Binary,constants={BSON_INT32_MAX:2147483647,BSON_INT32_MIN:-2147483648,BSON_INT64_MAX:Math.pow(2,63)-1,BSON_INT64_MIN:-Math.pow(2,63),JS_INT_MAX:9007199254740992,JS_INT_MIN:-9007199254740992,BSON_DATA_NUMBER:1,BSON_DATA_STRING:2,BSON_DATA_OBJECT:3,BSON_DATA_ARRAY:4,BSON_DATA_BINARY:5,BSON_DATA_UNDEFINED:6,BSON_DATA_OID:7,BSON_DATA_BOOLEAN:8,BSON_DATA_DATE:9,BSON_DATA_NULL:10,BSON_DATA_REGEXP:11,BSON_DATA_DBPOINTER:12,BSON_DATA_CODE:13,BSON_DATA_SYMBOL:14,BSON_DATA_CODE_W_SCOPE:15,BSON_DATA_INT:16,BSON_DATA_TIMESTAMP:17,BSON_DATA_LONG:18,BSON_DATA_DECIMAL128:19,BSON_DATA_MIN_KEY:255,BSON_DATA_MAX_KEY:127,BSON_BINARY_SUBTYPE_DEFAULT:0,BSON_BINARY_SUBTYPE_FUNCTION:1,BSON_BINARY_SUBTYPE_BYTE_ARRAY:2,BSON_BINARY_SUBTYPE_UUID:3,BSON_BINARY_SUBTYPE_MD5:4,BSON_BINARY_SUBTYPE_USER_DEFINED:128};function _typeof$2(e){return(_typeof$2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var keysToCodecs={$oid:objectid,$binary:binary,$symbol:symbol,$numberInt:int_32,$numberDecimal:decimal128,$numberDouble:double_1,$numberLong:long_1,$minKey:min_key,$maxKey:max_key,$regex:regexp,$regularExpression:regexp,$timestamp:timestamp};function deserializeValue(e,t,r,n){if("number"==typeof r){if(n.relaxed||n.legacy)return r;if(Math.floor(r)===r){if(r>=BSON_INT32_MIN&&r<=BSON_INT32_MAX)return new int_32(r);if(r>=BSON_INT64_MIN&&r<=BSON_INT64_MAX)return new long_1.fromNumber(r)}return new double_1(r)}if(null==r||"object"!==_typeof$2(r))return r;if(r.$undefined)return null;for(var i=Object.keys(r).filter((function(e){return e.startsWith("$")&&null!=r[e]})),o=0;o<i.length;o++){var s=keysToCodecs[i[o]];if(s)return s.fromExtendedJSON(r,n)}if(null!=r.$date){var a=r.$date,u=new Date;return n.legacy?"number"==typeof a?u.setTime(a):"string"==typeof a&&u.setTime(Date.parse(a)):"string"==typeof a?u.setTime(Date.parse(a)):long_1.isLong(a)?u.setTime(a.toNumber()):"number"==typeof a&&n.relaxed&&u.setTime(a),u}if(null!=r.$code){var c=Object.assign({},r);return r.$scope&&(c.$scope=deserializeValue(e,null,r.$scope)),code.fromExtendedJSON(r)}if(null!=r.$ref||null!=r.$dbPointer){var l=r.$ref?r:r.$dbPointer;if(l instanceof db_ref)return l;var f=Object.keys(l).filter((function(e){return e.startsWith("$")})),h=!0;if(f.forEach((function(e){-1===["$ref","$id","$db"].indexOf(e)&&(h=!1)})),h)return db_ref.fromExtendedJSON(l)}return r}function parse(e,t){var r=this;return"boolean"==typeof(t=Object.assign({},{relaxed:!0,legacy:!1},t)).relaxed&&(t.strict=!t.relaxed),"boolean"==typeof t.strict&&(t.relaxed=!t.strict),JSON.parse(e,(function(e,n){return deserializeValue(r,e,n,t)}))}var BSON_INT32_MAX=2147483647,BSON_INT32_MIN=-2147483648,BSON_INT64_MAX=0x8000000000000000,BSON_INT64_MIN=-0x8000000000000000;function stringify(e,t,r,n){null!=r&&"object"===_typeof$2(r)&&(n=r,r=0),null==t||"object"!==_typeof$2(t)||Array.isArray(t)||(n=t,t=null,r=0),n=Object.assign({},{relaxed:!0,legacy:!1},n);var i=Array.isArray(e)?serializeArray(e,n):serializeDocument(e,n);return JSON.stringify(i,t,r)}function serialize(e,t){return t=t||{},JSON.parse(stringify(e,t))}function deserialize(e,t){return t=t||{},parse(JSON.stringify(e),t)}function serializeArray(e,t){return e.map((function(e){return serializeValue(e,t)}))}function getISOString(e){var t=e.toISOString();return 0!==e.getUTCMilliseconds()?t:t.slice(0,-5)+"Z"}function serializeValue(e,t){if(Array.isArray(e))return serializeArray(e,t);if(void 0===e)return null;if(e instanceof Date){var r=e.getTime(),n=r>-1&&r<2534023188e5;return t.legacy?t.relaxed&&n?{$date:e.getTime()}:{$date:getISOString(e)}:t.relaxed&&n?{$date:getISOString(e)}:{$date:{$numberLong:e.getTime().toString()}}}if("number"==typeof e&&!t.relaxed){if(Math.floor(e)===e){var i=e>=BSON_INT64_MIN&&e<=BSON_INT64_MAX;if(e>=BSON_INT32_MIN&&e<=BSON_INT32_MAX)return{$numberInt:e.toString()};if(i)return{$numberLong:e.toString()}}return{$numberDouble:e.toString()}}if(e instanceof RegExp){var o=e.flags;return void 0===o&&(o=e.toString().match(/[gimuy]*$/)[0]),new regexp(e.source,o).toExtendedJSON(t)}return null!=e&&"object"===_typeof$2(e)?serializeDocument(e,t):e}var BSON_TYPE_MAPPINGS={Binary:function(e){return new binary(e.value(),e.subtype)},Code:function(e){return new code(e.code,e.scope)},DBRef:function(e){return new db_ref(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new decimal128(e.bytes)},Double:function(e){return new double_1(e.value)},Int32:function(e){return new int_32(e.value)},Long:function(e){return long_1.fromBits(null!=e.low?e.low:e.low_,null!=e.low?e.high:e.high_,null!=e.low?e.unsigned:e.unsigned_)},MaxKey:function(){return new max_key},MinKey:function(){return new min_key},ObjectID:function(e){return new objectid(e)},ObjectId:function(e){return new objectid(e)},BSONRegExp:function(e){return new regexp(e.pattern,e.options)},Symbol:function(e){return new symbol(e.value)},Timestamp:function(e){return timestamp.fromBits(e.low,e.high)}};function serializeDocument(e,t){if(null==e||"object"!==_typeof$2(e))throw new Error("not an object instance");var r=e._bsontype;if(void 0===r){var n={};for(var i in e)n[i]=serializeValue(e[i],t);return n}if("string"==typeof r){var o=e;if("function"!=typeof o.toExtendedJSON){var s=BSON_TYPE_MAPPINGS[r];if(!s)throw new TypeError("Unrecognized or invalid _bsontype: "+r);o=s(o)}return"Code"===r&&o.scope?o=new code(o.code,serializeValue(o.scope,t)):"DBRef"===r&&o.oid&&(o=new db_ref(o.collection,serializeValue(o.oid,t),o.db,o.fields)),o.toExtendedJSON(t)}throw new Error("_bsontype must be a string, but was: "+_typeof$2(r))}var extended_json={parse:parse,deserialize:deserialize,serialize:serialize,stringify:stringify},FIRST_BIT=128,FIRST_TWO_BITS=192,FIRST_THREE_BITS=224,FIRST_FOUR_BITS=240,FIRST_FIVE_BITS=248,TWO_BIT_CHAR=192,THREE_BIT_CHAR=224,FOUR_BIT_CHAR=240,CONTINUING_CHAR=128;function validateUtf8(e,t,r){for(var n=0,i=t;i<r;i+=1){var o=e[i];if(n){if((o&FIRST_TWO_BITS)!==CONTINUING_CHAR)return!1;n-=1}else if(o&FIRST_BIT)if((o&FIRST_THREE_BITS)===TWO_BIT_CHAR)n=1;else if((o&FIRST_FOUR_BITS)===THREE_BIT_CHAR)n=2;else{if((o&FIRST_FIVE_BITS)!==FOUR_BIT_CHAR)return!1;n=3}}return!n}var validateUtf8_1=validateUtf8,validate_utf8={validateUtf8:validateUtf8_1},Buffer$4=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,validateUtf8$1=validate_utf8.validateUtf8,JS_INT_MAX_LONG=long_1.fromNumber(constants.JS_INT_MAX),JS_INT_MIN_LONG=long_1.fromNumber(constants.JS_INT_MIN),functionCache={};function deserialize$1(e,t,r){var n=(t=null==t?{}:t)&&t.index?t.index:0,i=e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24;if(i<5)throw new Error("bson size must be >= 5, is ".concat(i));if(t.allowObjectSmallerThanBufferSize&&e.length<i)throw new Error("buffer length ".concat(e.length," must be >= bson size ").concat(i));if(!t.allowObjectSmallerThanBufferSize&&e.length!==i)throw new Error("buffer length ".concat(e.length," must === bson size ").concat(i));if(i+n>e.length)throw new Error("(bson size ".concat(i," + options.index ").concat(n," must be <= buffer length ").concat(Buffer$4.byteLength(e),")"));if(0!==e[n+i-1])throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return deserializeObject(e,n,t,r)}function deserializeObject(e,t,r,n){var i=null!=r.evalFunctions&&r.evalFunctions,o=null!=r.cacheFunctions&&r.cacheFunctions,s=null!=r.cacheFunctionsCrc32&&r.cacheFunctionsCrc32;if(!s)var a=null;var u=null==r.fieldsAsRaw?null:r.fieldsAsRaw,c=null!=r.raw&&r.raw,l="boolean"==typeof r.bsonRegExp&&r.bsonRegExp,f=null!=r.promoteBuffers&&r.promoteBuffers,h=null==r.promoteLongs||r.promoteLongs,d=null==r.promoteValues||r.promoteValues,p=t;if(e.length<5)throw new Error("corrupt bson message < 5 bytes long");var _=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(_<5||_>e.length)throw new Error("corrupt bson message");for(var g=n?[]:{},y=0;;){var m=e[t++];if(0===m)break;for(var b=t;0!==e[b]&&b<e.length;)b++;if(b>=Buffer$4.byteLength(e))throw new Error("Bad BSON Document: illegal CString");var w=n?y++:e.toString("utf8",t,b);if(t=b+1,m===constants.BSON_DATA_STRING){var E=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(E<=0||E>e.length-t||0!==e[t+E-1])throw new Error("bad string length in bson");if(!validateUtf8$1(e,t,t+E-1))throw new Error("Invalid UTF-8 string in BSON document");var v=e.toString("utf8",t,t+E-1);g[w]=v,t+=E}else if(m===constants.BSON_DATA_OID){var S=Buffer$4.alloc(12);e.copy(S,0,t,t+12),g[w]=new objectid(S),t+=12}else if(m===constants.BSON_DATA_INT&&!1===d)g[w]=new int_32(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24);else if(m===constants.BSON_DATA_INT)g[w]=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;else if(m===constants.BSON_DATA_NUMBER&&!1===d)g[w]=new double_1(e.readDoubleLE(t)),t+=8;else if(m===constants.BSON_DATA_NUMBER)g[w]=e.readDoubleLE(t),t+=8;else if(m===constants.BSON_DATA_DATE){var A=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,N=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;g[w]=new Date(new long_1(A,N).toNumber())}else if(m===constants.BSON_DATA_BOOLEAN){if(0!==e[t]&&1!==e[t])throw new Error("illegal boolean type value");g[w]=1===e[t++]}else if(m===constants.BSON_DATA_OBJECT){var O=t,T=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24;if(T<=0||T>e.length-t)throw new Error("bad embedded document length in bson");g[w]=c?e.slice(t,t+T):deserializeObject(e,O,r,!1),t+=T}else if(m===constants.BSON_DATA_ARRAY){var I=t,B=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24,R=r,D=t+B;if(u&&u[w]){for(var C in R={},r)R[C]=r[C];R.raw=!0}if(g[w]=deserializeObject(e,I,R,!0),0!==e[(t+=B)-1])throw new Error("invalid array terminator byte");if(t!==D)throw new Error("corrupted array bson")}else if(m===constants.BSON_DATA_UNDEFINED)g[w]=void 0;else if(m===constants.BSON_DATA_NULL)g[w]=null;else if(m===constants.BSON_DATA_LONG){var P=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,$=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,M=new long_1(P,$);g[w]=h&&!0===d&&M.lessThanOrEqual(JS_INT_MAX_LONG)&&M.greaterThanOrEqual(JS_INT_MIN_LONG)?M.toNumber():M}else if(m===constants.BSON_DATA_DECIMAL128){var L=Buffer$4.alloc(16);e.copy(L,0,t,t+16),t+=16;var x=new decimal128(L);g[w]=x.toObject?x.toObject():x}else if(m===constants.BSON_DATA_BINARY){var j=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,U=j,k=e[t++];if(j<0)throw new Error("Negative binary type element size found");if(j>Buffer$4.byteLength(e))throw new Error("Binary type size larger than document size");if(null!=e.slice){if(k===binary.SUBTYPE_BYTE_ARRAY){if((j=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>U-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(j<U-4)throw new Error("Binary type with subtype 0x02 contains to short binary size")}g[w]=f&&d?e.slice(t,t+j):new binary(e.slice(t,t+j),k)}else{var q="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(j)):new Array(j);if(k===binary.SUBTYPE_BYTE_ARRAY){if((j=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>U-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(j<U-4)throw new Error("Binary type with subtype 0x02 contains to short binary size")}for(b=0;b<j;b++)q[b]=e[t+b];g[w]=f&&d?q:new binary(q,k)}t+=j}else if(m===constants.BSON_DATA_REGEXP&&!1===l){for(b=t;0!==e[b]&&b<e.length;)b++;if(b>=e.length)throw new Error("Bad BSON Document: illegal CString");var F=e.toString("utf8",t,b);for(b=t=b+1;0!==e[b]&&b<e.length;)b++;if(b>=e.length)throw new Error("Bad BSON Document: illegal CString");var z=e.toString("utf8",t,b);t=b+1;var W=new Array(z.length);for(b=0;b<z.length;b++)switch(z[b]){case"m":W[b]="m";break;case"s":W[b]="g";break;case"i":W[b]="i"}g[w]=new RegExp(F,W.join(""))}else if(m===constants.BSON_DATA_REGEXP&&!0===l){for(b=t;0!==e[b]&&b<e.length;)b++;if(b>=e.length)throw new Error("Bad BSON Document: illegal CString");var Y=e.toString("utf8",t,b);for(b=t=b+1;0!==e[b]&&b<e.length;)b++;if(b>=e.length)throw new Error("Bad BSON Document: illegal CString");var K=e.toString("utf8",t,b);t=b+1,g[w]=new regexp(Y,K)}else if(m===constants.BSON_DATA_SYMBOL){var H=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(H<=0||H>e.length-t||0!==e[t+H-1])throw new Error("bad string length in bson");var G=e.toString("utf8",t,t+H-1);g[w]=d?G:new symbol(G),t+=H}else if(m===constants.BSON_DATA_TIMESTAMP){var J=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,V=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;g[w]=new timestamp(J,V)}else if(m===constants.BSON_DATA_MIN_KEY)g[w]=new min_key;else if(m===constants.BSON_DATA_MAX_KEY)g[w]=new max_key;else if(m===constants.BSON_DATA_CODE){var X=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(X<=0||X>e.length-t||0!==e[t+X-1])throw new Error("bad string length in bson");var Q=e.toString("utf8",t,t+X-1);if(i)if(o){var Z=s?a(Q):Q;g[w]=isolateEvalWithHash(functionCache,Z,Q,g)}else g[w]=isolateEval(Q);else g[w]=new code(Q);t+=X}else if(m===constants.BSON_DATA_CODE_W_SCOPE){var ee=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(ee<13)throw new Error("code_w_scope total size shorter minimum expected length");var te=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(te<=0||te>e.length-t||0!==e[t+te-1])throw new Error("bad string length in bson");var re=e.toString("utf8",t,t+te-1),ne=t+=te,ie=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24,oe=deserializeObject(e,ne,r,!1);if(t+=ie,ee<8+ie+te)throw new Error("code_w_scope total size is to short, truncating scope");if(ee>8+ie+te)throw new Error("code_w_scope total size is to long, clips outer document");if(i){if(o){var se=s?a(re):re;g[w]=isolateEvalWithHash(functionCache,se,re,g)}else g[w]=isolateEval(re);g[w].scope=oe}else g[w]=new code(re,oe)}else{if(m!==constants.BSON_DATA_DBPOINTER)throw new Error("Detected unknown BSON type "+m.toString(16)+' for fieldname "'+w+'", are you using the latest BSON parser?');var ae=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(ae<=0||ae>e.length-t||0!==e[t+ae-1])throw new Error("bad string length in bson");if(!validateUtf8$1(e,t,t+ae-1))throw new Error("Invalid UTF-8 string in BSON document");var ue=e.toString("utf8",t,t+ae-1);t+=ae;var ce=Buffer$4.alloc(12);e.copy(ce,0,t,t+12);var le=new objectid(ce);t+=12,g[w]=new db_ref(ue,le)}}if(_!==t-p){if(n)throw new Error("corrupt array bson");throw new Error("corrupt object bson")}var fe=Object.keys(g).filter((function(e){return e.startsWith("$")})),he=!0;if(fe.forEach((function(e){-1===["$ref","$id","$db"].indexOf(e)&&(he=!1)})),!he)return g;if(null!=g.$id&&null!=g.$ref){var de=Object.assign({},g);return delete de.$ref,delete de.$id,delete de.$db,new db_ref(g.$ref,g.$id,g.$db||null,de)}return g}function isolateEvalWithHash(functionCache,hash,functionString,object){var value=null;return null==functionCache[hash]&&(eval("value = "+functionString),functionCache[hash]=value),functionCache[hash].bind(object)}function isolateEval(functionString){var value=null;return eval("value = "+functionString),value}var deserializer=deserialize$1;function readIEEE754(e,t,r,n,i){var o,s,a="big"===r,u=8*i-n-1,c=(1<<u)-1,l=c>>1,f=-7,h=a?0:i-1,d=a?1:-1,p=e[t+h];for(h+=d,o=p&(1<<-f)-1,p>>=-f,f+=u;f>0;o=256*o+e[t+h],h+=d,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+h],h+=d,f-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=l}return(p?-1:1)*s*Math.pow(2,o-n)}function writeIEEE754(e,t,r,n,i,o){var s,a,u,c="big"===n,l=8*o-i-1,f=(1<<l)-1,h=f>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=c?o-1:0,_=c?-1:1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0)),isNaN(t)&&(a=0);i>=8;)e[r+p]=255&a,p+=_,a/=256,i-=8;for(s=s<<i|a,isNaN(t)&&(s+=8),l+=i;l>0;)e[r+p]=255&s,p+=_,s/=256,l-=8;e[r+p-_]|=128*g}var float_parser={readIEEE754:readIEEE754,writeIEEE754:writeIEEE754};function _typeof$3(e){return(_typeof$3="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Buffer$5=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,writeIEEE754$1=float_parser.writeIEEE754,normalizedFunctionString$1=utils.normalizedFunctionString,regexp$1=/\x00/,ignoreKeys=new Set(["$db","$ref","$id","$clusterTime"]),isDate$1=function(e){return"object"===_typeof$3(e)&&"[object Date]"===Object.prototype.toString.call(e)},isRegExp$1=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)};function serializeString(e,t,r,n,i){e[n++]=constants.BSON_DATA_STRING;var o=i?e.write(t,n,"ascii"):e.write(t,n,"utf8");e[(n=n+o+1)-1]=0;var s=e.write(r,n+4,"utf8");return e[n+3]=s+1>>24&255,e[n+2]=s+1>>16&255,e[n+1]=s+1>>8&255,e[n]=s+1&255,n=n+4+s,e[n++]=0,n}function serializeNumber(e,t,r,n,i){if(Math.floor(r)===r&&r>=constants.JS_INT_MIN&&r<=constants.JS_INT_MAX)if(r>=constants.BSON_INT32_MIN&&r<=constants.BSON_INT32_MAX)e[n++]=constants.BSON_DATA_INT,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=r>>16&255,e[n++]=r>>24&255;else if(r>=constants.JS_INT_MIN&&r<=constants.JS_INT_MAX){e[n++]=constants.BSON_DATA_NUMBER,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,writeIEEE754$1(e,r,n,"little",52,8),n+=8}else{e[n++]=constants.BSON_DATA_LONG,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=long_1.fromNumber(r),s=o.getLowBits(),a=o.getHighBits();e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255,e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255}else e[n++]=constants.BSON_DATA_NUMBER,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,writeIEEE754$1(e,r,n,"little",52,8),n+=8;return n}function serializeNull(e,t,r,n,i){return e[n++]=constants.BSON_DATA_NULL,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,n}function serializeBoolean(e,t,r,n,i){return e[n++]=constants.BSON_DATA_BOOLEAN,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,e[n++]=r?1:0,n}function serializeDate(e,t,r,n,i){e[n++]=constants.BSON_DATA_DATE,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=long_1.fromNumber(r.getTime()),s=o.getLowBits(),a=o.getHighBits();return e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255,e[n++]=255&a,e[n++]=a>>8&255,e[n++]=a>>16&255,e[n++]=a>>24&255,n}function serializeRegExp(e,t,r,n,i){if(e[n++]=constants.BSON_DATA_REGEXP,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,r.source&&null!=r.source.match(regexp$1))throw Error("value "+r.source+" must not contain null bytes");return n+=e.write(r.source,n,"utf8"),e[n++]=0,r.ignoreCase&&(e[n++]=105),r.global&&(e[n++]=115),r.multiline&&(e[n++]=109),e[n++]=0,n}function serializeBSONRegExp(e,t,r,n,i){if(e[n++]=constants.BSON_DATA_REGEXP,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,null!=r.pattern.match(regexp$1))throw Error("pattern "+r.pattern+" must not contain null bytes");return n+=e.write(r.pattern,n,"utf8"),e[n++]=0,n+=e.write(r.options.split("").sort().join(""),n,"utf8"),e[n++]=0,n}function serializeMinMax(e,t,r,n,i){return null===r?e[n++]=constants.BSON_DATA_NULL:"MinKey"===r._bsontype?e[n++]=constants.BSON_DATA_MIN_KEY:e[n++]=constants.BSON_DATA_MAX_KEY,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,n}function serializeObjectId(e,t,r,n,i){if(e[n++]=constants.BSON_DATA_OID,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,"string"==typeof r.id)e.write(r.id,n,"binary");else{if(!r.id||!r.id.copy)throw new TypeError("object ["+JSON.stringify(r)+"] is not a valid ObjectId");r.id.copy(e,n,0,12)}return n+12}function serializeBuffer(e,t,r,n,i){e[n++]=constants.BSON_DATA_BINARY,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=r.length;return e[n++]=255&o,e[n++]=o>>8&255,e[n++]=o>>16&255,e[n++]=o>>24&255,e[n++]=constants.BSON_BINARY_SUBTYPE_DEFAULT,r.copy(e,n,0,o),n+=o}function serializeObject(e,t,r,n,i,o,s,a,u,c){for(var l=0;l<c.length;l++)if(c[l]===r)throw new Error("cyclic dependency detected");c.push(r),e[n++]=Array.isArray(r)?constants.BSON_DATA_ARRAY:constants.BSON_DATA_OBJECT,n+=u?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var f=serializeInto(e,r,i,n,o+1,s,a,c);return c.pop(),f}function serializeDecimal128(e,t,r,n,i){return e[n++]=constants.BSON_DATA_DECIMAL128,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,r.bytes.copy(e,n,0,16),n+16}function serializeLong(e,t,r,n,i){e[n++]="Long"===r._bsontype?constants.BSON_DATA_LONG:constants.BSON_DATA_TIMESTAMP,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=r.getLowBits(),s=r.getHighBits();return e[n++]=255&o,e[n++]=o>>8&255,e[n++]=o>>16&255,e[n++]=o>>24&255,e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255,n}function serializeInt32(e,t,r,n,i){return e[n++]=constants.BSON_DATA_INT,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,e[n++]=255&r,e[n++]=r>>8&255,e[n++]=r>>16&255,e[n++]=r>>24&255,n}function serializeDouble(e,t,r,n,i){return e[n++]=constants.BSON_DATA_NUMBER,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0,writeIEEE754$1(e,r.value,n,"little",52,8),n+=8}function serializeFunction(e,t,r,n,i,o,s){e[n++]=constants.BSON_DATA_CODE,n+=s?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var a=normalizedFunctionString$1(r),u=e.write(a,n+4,"utf8")+1;return e[n]=255&u,e[n+1]=u>>8&255,e[n+2]=u>>16&255,e[n+3]=u>>24&255,n=n+4+u-1,e[n++]=0,n}function serializeCode(e,t,r,n,i,o,s,a,u){if(r.scope&&"object"===_typeof$3(r.scope)){e[n++]=constants.BSON_DATA_CODE_W_SCOPE,n+=u?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var c=n,l="string"==typeof r.code?r.code:r.code.toString();n+=4;var f=e.write(l,n+4,"utf8")+1;e[n]=255&f,e[n+1]=f>>8&255,e[n+2]=f>>16&255,e[n+3]=f>>24&255,e[n+4+f-1]=0,n=n+f+4;var h=serializeInto(e,r.scope,i,n,o+1,s,a);n=h-1;var d=h-c;e[c++]=255&d,e[c++]=d>>8&255,e[c++]=d>>16&255,e[c++]=d>>24&255,e[n++]=0}else{e[n++]=constants.BSON_DATA_CODE,n+=u?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var p=r.code.toString(),_=e.write(p,n+4,"utf8")+1;e[n]=255&_,e[n+1]=_>>8&255,e[n+2]=_>>16&255,e[n+3]=_>>24&255,n=n+4+_-1,e[n++]=0}return n}function serializeBinary(e,t,r,n,i){e[n++]=constants.BSON_DATA_BINARY,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=r.value(!0),s=r.position;return r.sub_type===binary.SUBTYPE_BYTE_ARRAY&&(s+=4),e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255,e[n++]=r.sub_type,r.sub_type===binary.SUBTYPE_BYTE_ARRAY&&(s-=4,e[n++]=255&s,e[n++]=s>>8&255,e[n++]=s>>16&255,e[n++]=s>>24&255),o.copy(e,n,0,r.position),n+=r.position}function serializeSymbol(e,t,r,n,i){e[n++]=constants.BSON_DATA_SYMBOL,n+=i?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var o=e.write(r.value,n+4,"utf8")+1;return e[n]=255&o,e[n+1]=o>>8&255,e[n+2]=o>>16&255,e[n+3]=o>>24&255,n=n+4+o-1,e[n++]=0,n}function serializeDBRef(e,t,r,n,i,o,s){e[n++]=constants.BSON_DATA_OBJECT,n+=s?e.write(t,n,"ascii"):e.write(t,n,"utf8"),e[n++]=0;var a,u=n,c={$ref:r.collection||r.namespace,$id:r.oid};null!=r.db&&(c.$db=r.db);var l=(a=serializeInto(e,c=Object.assign(c,r.fields),!1,n,i+1,o))-u;return e[u++]=255&l,e[u++]=l>>8&255,e[u++]=l>>16&255,e[u++]=l>>24&255,a}function serializeInto(e,t,r,n,i,o,s,a){n=n||0,(a=a||[]).push(t);var u=n+4;if(Array.isArray(t))for(var c=0;c<t.length;c++){var l=""+c,f=t[c];if(f&&f.toBSON){if("function"!=typeof f.toBSON)throw new TypeError("toBSON is not a function");f=f.toBSON()}var h=_typeof$3(f);if("string"===h)u=serializeString(e,l,f,u,!0);else if("number"===h)u=serializeNumber(e,l,f,u,!0);else if("boolean"===h)u=serializeBoolean(e,l,f,u,!0);else if(f instanceof Date||isDate$1(f))u=serializeDate(e,l,f,u,!0);else if(void 0===f)u=serializeNull(e,l,f,u,!0);else if(null===f)u=serializeNull(e,l,f,u,!0);else if("ObjectId"===f._bsontype||"ObjectID"===f._bsontype)u=serializeObjectId(e,l,f,u,!0);else if(Buffer$5.isBuffer(f))u=serializeBuffer(e,l,f,u,!0);else if(f instanceof RegExp||isRegExp$1(f))u=serializeRegExp(e,l,f,u,!0);else if("object"===h&&null==f._bsontype)u=serializeObject(e,l,f,u,r,i,o,s,!0,a);else if("object"===h&&"Decimal128"===f._bsontype)u=serializeDecimal128(e,l,f,u,!0);else if("Long"===f._bsontype||"Timestamp"===f._bsontype)u=serializeLong(e,l,f,u,!0);else if("Double"===f._bsontype)u=serializeDouble(e,l,f,u,!0);else if("function"==typeof f&&o)u=serializeFunction(e,l,f,u,r,i,o,!0);else if("Code"===f._bsontype)u=serializeCode(e,l,f,u,r,i,o,s,!0);else if("Binary"===f._bsontype)u=serializeBinary(e,l,f,u,!0);else if("Symbol"===f._bsontype)u=serializeSymbol(e,l,f,u,!0);else if("DBRef"===f._bsontype)u=serializeDBRef(e,l,f,u,i,o,!0);else if("BSONRegExp"===f._bsontype)u=serializeBSONRegExp(e,l,f,u,!0);else if("Int32"===f._bsontype)u=serializeInt32(e,l,f,u,!0);else if("MinKey"===f._bsontype||"MaxKey"===f._bsontype)u=serializeMinMax(e,l,f,u,!0);else if(void 0!==f._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+f._bsontype)}else if(t instanceof map)for(var d=t.entries(),p=!1;!p;){var _=d.next();if(!(p=_.done)){var g=_.value[0],y=_.value[1],m=_typeof$3(y);if("string"==typeof g&&!ignoreKeys.has(g)){if(null!=g.match(regexp$1))throw Error("key "+g+" must not contain null bytes");if(r){if("$"===g[0])throw Error("key "+g+" must not start with '$'");if(~g.indexOf("."))throw Error("key "+g+" must not contain '.'")}}if("string"===m)u=serializeString(e,g,y,u);else if("number"===m)u=serializeNumber(e,g,y,u);else if("boolean"===m)u=serializeBoolean(e,g,y,u);else if(y instanceof Date||isDate$1(y))u=serializeDate(e,g,y,u);else if(null===y||void 0===y&&!1===s)u=serializeNull(e,g,y,u);else if("ObjectId"===y._bsontype||"ObjectID"===y._bsontype)u=serializeObjectId(e,g,y,u);else if(Buffer$5.isBuffer(y))u=serializeBuffer(e,g,y,u);else if(y instanceof RegExp||isRegExp$1(y))u=serializeRegExp(e,g,y,u);else if("object"===m&&null==y._bsontype)u=serializeObject(e,g,y,u,r,i,o,s,!1,a);else if("object"===m&&"Decimal128"===y._bsontype)u=serializeDecimal128(e,g,y,u);else if("Long"===y._bsontype||"Timestamp"===y._bsontype)u=serializeLong(e,g,y,u);else if("Double"===y._bsontype)u=serializeDouble(e,g,y,u);else if("Code"===y._bsontype)u=serializeCode(e,g,y,u,r,i,o,s);else if("function"==typeof y&&o)u=serializeFunction(e,g,y,u,r,i,o);else if("Binary"===y._bsontype)u=serializeBinary(e,g,y,u);else if("Symbol"===y._bsontype)u=serializeSymbol(e,g,y,u);else if("DBRef"===y._bsontype)u=serializeDBRef(e,g,y,u,i,o);else if("BSONRegExp"===y._bsontype)u=serializeBSONRegExp(e,g,y,u);else if("Int32"===y._bsontype)u=serializeInt32(e,g,y,u);else if("MinKey"===y._bsontype||"MaxKey"===y._bsontype)u=serializeMinMax(e,g,y,u);else if(void 0!==y._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+y._bsontype)}}else{if(t.toBSON){if("function"!=typeof t.toBSON)throw new TypeError("toBSON is not a function");if(null!=(t=t.toBSON())&&"object"!==_typeof$3(t))throw new TypeError("toBSON function did not return an object")}for(var b in t){var w=t[b];if(w&&w.toBSON){if("function"!=typeof w.toBSON)throw new TypeError("toBSON is not a function");w=w.toBSON()}var E=_typeof$3(w);if("string"==typeof b&&!ignoreKeys.has(b)){if(null!=b.match(regexp$1))throw Error("key "+b+" must not contain null bytes");if(r){if("$"===b[0])throw Error("key "+b+" must not start with '$'");if(~b.indexOf("."))throw Error("key "+b+" must not contain '.'")}}if("string"===E)u=serializeString(e,b,w,u);else if("number"===E)u=serializeNumber(e,b,w,u);else if("boolean"===E)u=serializeBoolean(e,b,w,u);else if(w instanceof Date||isDate$1(w))u=serializeDate(e,b,w,u);else if(void 0===w)!1===s&&(u=serializeNull(e,b,w,u));else if(null===w)u=serializeNull(e,b,w,u);else if("ObjectId"===w._bsontype||"ObjectID"===w._bsontype)u=serializeObjectId(e,b,w,u);else if(Buffer$5.isBuffer(w))u=serializeBuffer(e,b,w,u);else if(w instanceof RegExp||isRegExp$1(w))u=serializeRegExp(e,b,w,u);else if("object"===E&&null==w._bsontype)u=serializeObject(e,b,w,u,r,i,o,s,!1,a);else if("object"===E&&"Decimal128"===w._bsontype)u=serializeDecimal128(e,b,w,u);else if("Long"===w._bsontype||"Timestamp"===w._bsontype)u=serializeLong(e,b,w,u);else if("Double"===w._bsontype)u=serializeDouble(e,b,w,u);else if("Code"===w._bsontype)u=serializeCode(e,b,w,u,r,i,o,s);else if("function"==typeof w&&o)u=serializeFunction(e,b,w,u,r,i,o);else if("Binary"===w._bsontype)u=serializeBinary(e,b,w,u);else if("Symbol"===w._bsontype)u=serializeSymbol(e,b,w,u);else if("DBRef"===w._bsontype)u=serializeDBRef(e,b,w,u,i,o);else if("BSONRegExp"===w._bsontype)u=serializeBSONRegExp(e,b,w,u);else if("Int32"===w._bsontype)u=serializeInt32(e,b,w,u);else if("MinKey"===w._bsontype||"MaxKey"===w._bsontype)u=serializeMinMax(e,b,w,u);else if(void 0!==w._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+w._bsontype)}}a.pop(),e[u++]=0;var v=u-n;return e[n++]=255&v,e[n++]=v>>8&255,e[n++]=v>>16&255,e[n++]=v>>24&255,u}var serializer=serializeInto;function _typeof$4(e){return(_typeof$4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var Buffer$6=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,normalizedFunctionString$2=utils.normalizedFunctionString;function isDate$2(e){return"object"===_typeof$4(e)&&"[object Date]"===Object.prototype.toString.call(e)}function calculateObjectSize(e,t,r){var n=5;if(Array.isArray(e))for(var i=0;i<e.length;i++)n+=calculateElement(i.toString(),e[i],t,!0,r);else for(var o in e.toBSON&&(e=e.toBSON()),e)n+=calculateElement(o,e[o],t,!1,r);return n}function calculateElement(e,t,r,n,i){switch(t&&t.toBSON&&(t=t.toBSON()),_typeof$4(t)){case"string":return 1+Buffer$6.byteLength(e,"utf8")+1+4+Buffer$6.byteLength(t,"utf8")+1;case"number":return Math.floor(t)===t&&t>=constants.JS_INT_MIN&&t<=constants.JS_INT_MAX&&t>=constants.BSON_INT32_MIN&&t<=constants.BSON_INT32_MAX?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+5:(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+9;case"undefined":return n||!i?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1:0;case"boolean":return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+2;case"object":if(null==t||"MinKey"===t._bsontype||"MaxKey"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1;if("ObjectId"===t._bsontype||"ObjectID"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+13;if(t instanceof Date||isDate$2(t))return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+9;if(void 0!==Buffer$6&&Buffer$6.isBuffer(t))return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+6+t.length;if("Long"===t._bsontype||"Double"===t._bsontype||"Timestamp"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+9;if("Decimal128"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+17;if("Code"===t._bsontype)return null!=t.scope&&Object.keys(t.scope).length>0?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+4+Buffer$6.byteLength(t.code.toString(),"utf8")+1+calculateObjectSize(t.scope,r,i):(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+Buffer$6.byteLength(t.code.toString(),"utf8")+1;if("Binary"===t._bsontype)return t.sub_type===binary.SUBTYPE_BYTE_ARRAY?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+(t.position+1+4+1+4):(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+(t.position+1+4+1);if("Symbol"===t._bsontype)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+Buffer$6.byteLength(t.value,"utf8")+4+1+1;if("DBRef"===t._bsontype){var o=Object.assign({$ref:t.collection,$id:t.oid},t.fields);return null!=t.db&&(o.$db=t.db),(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+calculateObjectSize(o,r,i)}return t instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(t)?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+Buffer$6.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1:"BSONRegExp"===t._bsontype?(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+Buffer$6.byteLength(t.pattern,"utf8")+1+Buffer$6.byteLength(t.options,"utf8")+1:(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+calculateObjectSize(t,r,i)+1;case"function":if(t instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(t)||"[object RegExp]"===String.call(t))return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+Buffer$6.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1;if(r&&null!=t.scope&&Object.keys(t.scope).length>0)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+4+Buffer$6.byteLength(normalizedFunctionString$2(t),"utf8")+1+calculateObjectSize(t.scope,r,i);if(r)return(null!=e?Buffer$6.byteLength(e,"utf8")+1:0)+1+4+Buffer$6.byteLength(normalizedFunctionString$2(t),"utf8")+1}return 0}var calculate_size=calculateObjectSize,Buffer$7=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,ensure_buffer=function(e){if(e instanceof Buffer$7)return e;if(e instanceof Uint8Array)return Buffer$7.from(e.buffer);throw new TypeError("Must use either Buffer or Uint8Array")},Buffer$8=buffer__WEBPACK_IMPORTED_MODULE_1___default.a.Buffer,MAXSIZE=17825792,buffer$1=Buffer$8.alloc(MAXSIZE);function setInternalBufferSize(e){buffer$1.length<e&&(buffer$1=Buffer$8.alloc(e))}function serialize$1(e,t){var r="boolean"==typeof(t=t||{}).checkKeys&&t.checkKeys,n="boolean"==typeof t.serializeFunctions&&t.serializeFunctions,i="boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined,o="number"==typeof t.minInternalBufferSize?t.minInternalBufferSize:MAXSIZE;buffer$1.length<o&&(buffer$1=Buffer$8.alloc(o));var s=serializer(buffer$1,e,r,0,0,n,i,[]),a=Buffer$8.alloc(s);return buffer$1.copy(a,0,0,a.length),a}function serializeWithBufferAndIndex(e,t,r){var n="boolean"==typeof(r=r||{}).checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,o="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,s="number"==typeof r.index?r.index:0,a=serializer(buffer$1,e,n,0,0,i,o);return buffer$1.copy(t,s,0,a),s+a-1}function deserialize$2(e,t){return e=ensure_buffer(e),deserializer(e,t)}function calculateObjectSize$1(e,t){var r="boolean"==typeof(t=t||{}).serializeFunctions&&t.serializeFunctions,n="boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined;return calculate_size(e,r,n)}function deserializeStream(e,t,r,n,i,o){o=Object.assign({allowObjectSmallerThanBufferSize:!0},o),e=ensure_buffer(e);for(var s=t,a=0;a<r;a++){var u=e[s]|e[s+1]<<8|e[s+2]<<16|e[s+3]<<24;o.index=s,n[i+a]=deserializer(e,o),s+=u}return s}var bson={BSON_INT32_MAX:constants.BSON_INT32_MAX,BSON_INT32_MIN:constants.BSON_INT32_MIN,BSON_INT64_MAX:constants.BSON_INT64_MAX,BSON_INT64_MIN:constants.BSON_INT64_MIN,JS_INT_MAX:constants.JS_INT_MAX,JS_INT_MIN:constants.JS_INT_MIN,BSON_DATA_NUMBER:constants.BSON_DATA_NUMBER,BSON_DATA_STRING:constants.BSON_DATA_STRING,BSON_DATA_OBJECT:constants.BSON_DATA_OBJECT,BSON_DATA_ARRAY:constants.BSON_DATA_ARRAY,BSON_DATA_BINARY:constants.BSON_DATA_BINARY,BSON_DATA_UNDEFINED:constants.BSON_DATA_UNDEFINED,BSON_DATA_OID:constants.BSON_DATA_OID,BSON_DATA_BOOLEAN:constants.BSON_DATA_BOOLEAN,BSON_DATA_DATE:constants.BSON_DATA_DATE,BSON_DATA_NULL:constants.BSON_DATA_NULL,BSON_DATA_REGEXP:constants.BSON_DATA_REGEXP,BSON_DATA_DBPOINTER:constants.BSON_DATA_DBPOINTER,BSON_DATA_CODE:constants.BSON_DATA_CODE,BSON_DATA_SYMBOL:constants.BSON_DATA_SYMBOL,BSON_DATA_CODE_W_SCOPE:constants.BSON_DATA_CODE_W_SCOPE,BSON_DATA_INT:constants.BSON_DATA_INT,BSON_DATA_TIMESTAMP:constants.BSON_DATA_TIMESTAMP,BSON_DATA_LONG:constants.BSON_DATA_LONG,BSON_DATA_DECIMAL128:constants.BSON_DATA_DECIMAL128,BSON_DATA_MIN_KEY:constants.BSON_DATA_MIN_KEY,BSON_DATA_MAX_KEY:constants.BSON_DATA_MAX_KEY,BSON_BINARY_SUBTYPE_DEFAULT:constants.BSON_BINARY_SUBTYPE_DEFAULT,BSON_BINARY_SUBTYPE_FUNCTION:constants.BSON_BINARY_SUBTYPE_FUNCTION,BSON_BINARY_SUBTYPE_BYTE_ARRAY:constants.BSON_BINARY_SUBTYPE_BYTE_ARRAY,BSON_BINARY_SUBTYPE_UUID:constants.BSON_BINARY_SUBTYPE_UUID,BSON_BINARY_SUBTYPE_MD5:constants.BSON_BINARY_SUBTYPE_MD5,BSON_BINARY_SUBTYPE_USER_DEFINED:constants.BSON_BINARY_SUBTYPE_USER_DEFINED,Code:code,Map:map,BSONSymbol:symbol,DBRef:db_ref,Binary:binary,ObjectId:objectid,Long:long_1,Timestamp:timestamp,Double:double_1,Int32:int_32,MinKey:min_key,MaxKey:max_key,BSONRegExp:regexp,Decimal128:decimal128,serialize:serialize$1,serializeWithBufferAndIndex:serializeWithBufferAndIndex,deserialize:deserialize$2,calculateObjectSize:calculateObjectSize$1,deserializeStream:deserializeStream,setInternalBufferSize:setInternalBufferSize,ObjectID:objectid,EJSON:extended_json},bson_1=bson.BSON_INT32_MAX,bson_2=bson.BSON_INT32_MIN,bson_3=bson.BSON_INT64_MAX,bson_4=bson.BSON_INT64_MIN,bson_5=bson.JS_INT_MAX,bson_6=bson.JS_INT_MIN,bson_7=bson.BSON_DATA_NUMBER,bson_8=bson.BSON_DATA_STRING,bson_9=bson.BSON_DATA_OBJECT,bson_10=bson.BSON_DATA_ARRAY,bson_11=bson.BSON_DATA_BINARY,bson_12=bson.BSON_DATA_UNDEFINED,bson_13=bson.BSON_DATA_OID,bson_14=bson.BSON_DATA_BOOLEAN,bson_15=bson.BSON_DATA_DATE,bson_16=bson.BSON_DATA_NULL,bson_17=bson.BSON_DATA_REGEXP,bson_18=bson.BSON_DATA_DBPOINTER,bson_19=bson.BSON_DATA_CODE,bson_20=bson.BSON_DATA_SYMBOL,bson_21=bson.BSON_DATA_CODE_W_SCOPE,bson_22=bson.BSON_DATA_INT,bson_23=bson.BSON_DATA_TIMESTAMP,bson_24=bson.BSON_DATA_LONG,bson_25=bson.BSON_DATA_DECIMAL128,bson_26=bson.BSON_DATA_MIN_KEY,bson_27=bson.BSON_DATA_MAX_KEY,bson_28=bson.BSON_BINARY_SUBTYPE_DEFAULT,bson_29=bson.BSON_BINARY_SUBTYPE_FUNCTION,bson_30=bson.BSON_BINARY_SUBTYPE_BYTE_ARRAY,bson_31=bson.BSON_BINARY_SUBTYPE_UUID,bson_32=bson.BSON_BINARY_SUBTYPE_MD5,bson_33=bson.BSON_BINARY_SUBTYPE_USER_DEFINED,bson_34=bson.Code,bson_35=bson.BSONSymbol,bson_36=bson.DBRef,bson_37=bson.Binary,bson_38=bson.ObjectId,bson_39=bson.Long,bson_40=bson.Timestamp,bson_41=bson.Double,bson_42=bson.Int32,bson_43=bson.MinKey,bson_44=bson.MaxKey,bson_45=bson.BSONRegExp,bson_46=bson.Decimal128,bson_47=bson.serialize,bson_48=bson.serializeWithBufferAndIndex,bson_49=bson.deserialize,bson_50=bson.calculateObjectSize,bson_51=bson.deserializeStream,bson_52=bson.setInternalBufferSize,bson_53=bson.ObjectID,bson_54=bson.EJSON,_unused_webpack_default_export=bson}).call(this,__webpack_require__(2),__webpack_require__(1).Buffer)},function(e,t,r){"use strict";(function(e){
|
|
2
|
+
/*!
|
|
3
|
+
* The buffer module from node.js, for the browser.
|
|
4
|
+
*
|
|
5
|
+
* @author Feross Aboukhadijeh <http://feross.org>
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/
|
|
8
|
+
var n=r(14),i=r(15),o=r(16);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=h(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(t,r),i=(e=a(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|d(t.length);return 0===(e=a(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?a(e,0):h(e,t);if("Buffer"===t.type&&o(t.data))return h(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=a(e,t<0?0:0|d(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function h(e,t){var r=t.length<0?0:0|d(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function d(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return k(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(n)return k(e).length;t=(""+t).toLowerCase(),n=!0}}function _(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return B(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return N(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;o<a;o++)if(c(e,o)===c(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var f=!0,h=0;h<u;h++)if(c(e,o+h)!==c(t,h)){f=!1;break}if(f)return o}return-1}function b(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function w(e,t,r,n){return F(k(t,e.length-r),e,r,n)}function E(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function v(e,t,r,n){return E(e,t,r,n)}function S(e,t,r,n){return F(q(t),e,r,n)}function A(e,t,r,n){return F(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function N(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,u,c=e[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return l(t),t<=0?a(e,t):void 0!==r?"string"==typeof n?a(e,t).fill(r,n):a(e,t).fill(r):a(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).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}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?O(this,0,e):_.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(n,i),l=e.slice(t,r),f=0;f<a;++f)if(c[f]!==l[f]){o=c[f],s=l[f];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return E(this,e,t,r);case"latin1":case"binary":return v(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function I(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function B(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=U(e[o]);return i}function R(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function D(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function C(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function P(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function $(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function M(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,n,o){return o||M(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function x(e,t,r,n,o){return o||M(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||D(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||C(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||C(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):$(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):$(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);C(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);C(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):$(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):$(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return x(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return x(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;i>=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=u.isBuffer(e)?e:k(new u(e,n).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var j=/[^+\/0-9A-Za-z-_]/g;function U(e){return e<16?"0"+e.toString(16):e.toString(16)}function k(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(2))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){e.exports=n;var r=null;try{r=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(e){}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function i(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var o={},s={};function a(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=s[e])?n:(r=c(e,(0|e)<0?-1:0,!0),i&&(s[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(n=o[e])?n:(r=c(e,e<0?-1:0,!1),i&&(o[e]=r),r)}function u(e,t){if(isNaN(e))return t?m:y;if(t){if(e<0)return m;if(e>=p)return S}else{if(e<=-_)return A;if(e+1>=_)return v}return e<0?u(-e,t).neg():c(e%d|0,e/d|0,t)}function c(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=u,n.fromBits=c;var l=Math.pow;function f(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return y;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return f(e.substring(1),t,r).neg();for(var i=u(l(r,8)),o=y,s=0;s<e.length;s+=8){var a=Math.min(8,e.length-s),c=parseInt(e.substring(s,s+a),r);if(a<8){var h=u(l(r,a));o=o.mul(h).add(u(c))}else o=(o=o.mul(i)).add(u(c))}return o.unsigned=t,o}function h(e,t){return"number"==typeof e?u(e,t):"string"==typeof e?f(e,t):c(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=f,n.fromValue=h;var d=4294967296,p=d*d,_=p/2,g=a(1<<24),y=a(0);n.ZERO=y;var m=a(0,!0);n.UZERO=m;var b=a(1);n.ONE=b;var w=a(1,!0);n.UONE=w;var E=a(-1);n.NEG_ONE=E;var v=c(-1,2147483647,!1);n.MAX_VALUE=v;var S=c(-1,-1,!0);n.MAX_UNSIGNED_VALUE=S;var A=c(0,-2147483648,!1);n.MIN_VALUE=A;var N=n.prototype;N.toInt=function(){return this.unsigned?this.low>>>0:this.low},N.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},N.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(A)){var t=u(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=u(l(e,6),this.unsigned),o=this,s="";;){var a=o.div(i),c=(o.sub(a.mul(i)).toInt()>>>0).toString(e);if((o=a).isZero())return c+s;for(;c.length<6;)c="0"+c;s=""+c+s}},N.getHighBits=function(){return this.high},N.getHighBitsUnsigned=function(){return this.high>>>0},N.getLowBits=function(){return this.low},N.getLowBitsUnsigned=function(){return this.low>>>0},N.getNumBitsAbs=function(){if(this.isNegative())return this.eq(A)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},N.isZero=function(){return 0===this.high&&0===this.low},N.eqz=N.isZero,N.isNegative=function(){return!this.unsigned&&this.high<0},N.isPositive=function(){return this.unsigned||this.high>=0},N.isOdd=function(){return 1==(1&this.low)},N.isEven=function(){return 0==(1&this.low)},N.equals=function(e){return i(e)||(e=h(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},N.eq=N.equals,N.notEquals=function(e){return!this.eq(e)},N.neq=N.notEquals,N.ne=N.notEquals,N.lessThan=function(e){return this.comp(e)<0},N.lt=N.lessThan,N.lessThanOrEqual=function(e){return this.comp(e)<=0},N.lte=N.lessThanOrEqual,N.le=N.lessThanOrEqual,N.greaterThan=function(e){return this.comp(e)>0},N.gt=N.greaterThan,N.greaterThanOrEqual=function(e){return this.comp(e)>=0},N.gte=N.greaterThanOrEqual,N.ge=N.greaterThanOrEqual,N.compare=function(e){if(i(e)||(e=h(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&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},N.comp=N.compare,N.negate=function(){return!this.unsigned&&this.eq(A)?A:this.not().add(b)},N.neg=N.negate,N.add=function(e){i(e)||(e=h(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,l=0,f=0,d=0,p=0;return d+=(p+=o+(65535&e.low))>>>16,f+=(d+=n+u)>>>16,l+=(f+=r+a)>>>16,l+=t+s,c((d&=65535)<<16|(p&=65535),(l&=65535)<<16|(f&=65535),this.unsigned)},N.subtract=function(e){return i(e)||(e=h(e)),this.add(e.neg())},N.sub=N.subtract,N.multiply=function(e){if(this.isZero())return y;if(i(e)||(e=h(e)),r)return c(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return y;if(this.eq(A))return e.isOdd()?A:y;if(e.eq(A))return this.isOdd()?A:y;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(g)&&e.lt(g))return u(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,o=this.low>>>16,s=65535&this.low,a=e.high>>>16,l=65535&e.high,f=e.low>>>16,d=65535&e.low,p=0,_=0,m=0,b=0;return m+=(b+=s*d)>>>16,_+=(m+=o*d)>>>16,m&=65535,_+=(m+=s*f)>>>16,p+=(_+=n*d)>>>16,_&=65535,p+=(_+=o*f)>>>16,_&=65535,p+=(_+=s*l)>>>16,p+=t*d+n*f+o*l+s*a,c((m&=65535)<<16|(b&=65535),(p&=65535)<<16|(_&=65535),this.unsigned)},N.mul=N.multiply,N.divide=function(e){if(i(e)||(e=h(e)),e.isZero())throw Error("division by zero");var t,n,o;if(r)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?r.div_u:r.div_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:y;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return m;if(e.gt(this.shru(1)))return w;o=m}else{if(this.eq(A))return e.eq(b)||e.eq(E)?A:e.eq(A)?b:(t=this.shr(1).div(e).shl(1)).eq(y)?e.isNegative()?b:E:(n=this.sub(e.mul(t)),o=t.add(n.div(e)));if(e.eq(A))return this.unsigned?m:y;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();o=y}for(n=this;n.gte(e);){t=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(t)/Math.LN2),a=s<=48?1:l(2,s-48),f=u(t),d=f.mul(e);d.isNegative()||d.gt(n);)d=(f=u(t-=a,this.unsigned)).mul(e);f.isZero()&&(f=b),o=o.add(f),n=n.sub(d)}return o},N.div=N.divide,N.modulo=function(e){return i(e)||(e=h(e)),r?c((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},N.mod=N.modulo,N.rem=N.modulo,N.not=function(){return c(~this.low,~this.high,this.unsigned)},N.and=function(e){return i(e)||(e=h(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},N.or=function(e){return i(e)||(e=h(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},N.xor=function(e){return i(e)||(e=h(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},N.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},N.shl=N.shiftLeft,N.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},N.shr=N.shiftRight,N.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},N.shru=N.shiftRightUnsigned,N.shr_u=N.shiftRightUnsigned,N.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},N.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},N.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},N.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},N.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.createSign=t.formatUrl=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var i=n(r(21)),o=n(r(25)),s=n(r(26)),a=r(6);function u(e){var t=o.default.stringify(e);return t=(t=(t=t.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},t.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.formatUrl=function(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),i="";for(var o in r)""===i?!n&&(t+="?"):i+="&",i+=o+"="+encodeURIComponent(r[o]);return/^http(s)?\:\/\//.test(t+=i)?t:""+e+t},t.createSign=function(e,t){var r=u(s.default.parse(JSON.stringify({alg:"HS256",typ:"JWT"})))+"."+u(s.default.parse(JSON.stringify(e)));return r+"."+u(i.default(r,t))},t.toQueryString=function(e){void 0===e&&(e={});var t=[];for(var r in e)t.push(r+"="+encodeURIComponent(e[r]));return t.join("&")},t.getQuery=function(e,t){if("undefined"==typeof window)return!1;var r=t||window.location.search,n=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),i=r.substr(r.indexOf("?")+1).match(n);return null!=i?i[2]:""},t.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]"+e+"=([^&#]*)"));return t?t[1]:""},t.removeParam=function(e,t){var r=t.split("?")[0],n=[],i=-1!==t.indexOf("?")?t.split("?")[1]:"";if(""!==i){for(var o=(n=i.split("&")).length-1;o>=0;o-=1)n[o].split("=")[0]===e&&n.splice(o,1);r=r+"?"+n.join("&")}return r},t.createPromiseCallback=function(){var e;if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var r=new Promise((function(t,r){e=function(e,n){return e?r(e):t(n)}}));return e.promise=r,e},t.execCallback=function(e,t,r){if(void 0===r&&(r=null),e&&"function"==typeof e)return e(t,r);if(t)throw t;return r},t.printWarn=function(e,t){console.warn("["+a.SDK_NAME+"]["+e+"]:"+t)},t.printError=function(e,t){console.error({code:e,msg:"["+a.SDK_NAME+"]["+e+"]:"+t})},t.printInfo=function(e,t){console.log("["+a.SDK_NAME+"]["+e+"]:"+t)},t.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"["+a.SDK_NAME+"]["+e+"]:"+t}))}},function(e,t,r){(function(t){var n;e.exports=(n=n||function(e,n){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==t&&t.crypto&&(i=t.crypto),!i)try{i=r(22)}catch(e){}var o=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},u=a.lib={},c=u.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=u.WordArray=c.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||h).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(o=0;o<i;o+=4)t[n+o>>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(o());return new l.init(t,e)}}),f=a.enc={},h=f.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new l.init(r,t/2)}},d=f.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new l.init(r,t)}},p=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},_=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,c=e.min(4*u,o);if(u){for(var f=0;f<u;f+=s)this._doProcessBlock(i,f);r=i.splice(0,u),n.sigBytes-=c}return new l.init(r,c)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),g=(u.Hasher=_.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){_.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new g.HMAC.init(e,r).finalize(t)}}}),a.algo={});return a}(Math),n)}).call(this,r(2))},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(7),t),i(r(18),t)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PROTOCOL=t.SDK_NAME=void 0,t.SDK_NAME="@cloudbase/js-sdk",t.PROTOCOL="https:"},function(e,t,r){"use strict";var n;r.r(t),r.d(t,"StorageType",(function(){return n})),r.d(t,"AbstractSDKRequest",(function(){return i})),r.d(t,"AbstractStorage",(function(){return o})),r.d(t,"formatUrl",(function(){return s})),function(e){e.local="local",e.none="none",e.session="session"}(n||(n={}));var i=function(){},o=function(){};function s(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),i="";for(var o in r)""===i?!n&&(t+="?"):i+="&",i+=o+"="+encodeURIComponent(r[o]);return/^http(s)?\:\/\//.test(t+=i)?t:""+e+t}},function(e,t,r){(function(t){var r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/,i=/^\./,o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,a=/^\[object .+?Constructor\]$/,u=/^(?:0|[1-9]\d*)$/,c="object"==typeof t&&t&&t.Object===Object&&t,l="object"==typeof self&&self&&self.Object===Object&&self,f=c||l||Function("return this")();var h,d=Array.prototype,p=Function.prototype,_=Object.prototype,g=f["__core-js_shared__"],y=(h=/[^.]+$/.exec(g&&g.keys&&g.keys.IE_PROTO||""))?"Symbol(src)_1."+h:"",m=p.toString,b=_.hasOwnProperty,w=_.toString,E=RegExp("^"+m.call(b).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),v=f.Symbol,S=d.splice,A=L(f,"Map"),N=L(Object,"create"),O=v?v.prototype:void 0,T=O?O.toString:void 0;function I(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function B(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function R(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function D(e,t,r){var n=e[t];b.call(e,t)&&q(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function C(e,t){for(var r=e.length;r--;)if(q(e[r][0],t))return r;return-1}function P(e){return!(!z(e)||(t=e,y&&y in t))&&(function(e){var t=z(e)?w.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?E:a).test(function(e){if(null!=e){try{return m.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function $(e,t,i,o){if(!z(e))return e;for(var s=-1,a=(t=function(e,t){if(F(e))return!1;var i=typeof e;if("number"==i||"symbol"==i||"boolean"==i||null==e||W(e))return!0;return n.test(e)||!r.test(e)||null!=t&&e in Object(t)}(t,e)?[t]:function(e){return F(e)?e:j(e)}(t)).length,u=a-1,c=e;null!=c&&++s<a;){var l=U(t[s]),f=i;if(s!=u){var h=c[l];void 0===(f=o?o(h,l,c):void 0)&&(f=z(h)?h:x(t[s+1])?[]:{})}D(c,l,f),c=c[l]}return e}function M(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function L(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return P(r)?r:void 0}function x(e,t){return!!(t=null==t?9007199254740991:t)&&("number"==typeof e||u.test(e))&&e>-1&&e%1==0&&e<t}I.prototype.clear=function(){this.__data__=N?N(null):{}},I.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},I.prototype.get=function(e){var t=this.__data__;if(N){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return b.call(t,e)?t[e]:void 0},I.prototype.has=function(e){var t=this.__data__;return N?void 0!==t[e]:b.call(t,e)},I.prototype.set=function(e,t){return this.__data__[e]=N&&void 0===t?"__lodash_hash_undefined__":t,this},B.prototype.clear=function(){this.__data__=[]},B.prototype.delete=function(e){var t=this.__data__,r=C(t,e);return!(r<0)&&(r==t.length-1?t.pop():S.call(t,r,1),!0)},B.prototype.get=function(e){var t=this.__data__,r=C(t,e);return r<0?void 0:t[r][1]},B.prototype.has=function(e){return C(this.__data__,e)>-1},B.prototype.set=function(e,t){var r=this.__data__,n=C(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},R.prototype.clear=function(){this.__data__={hash:new I,map:new(A||B),string:new I}},R.prototype.delete=function(e){return M(this,e).delete(e)},R.prototype.get=function(e){return M(this,e).get(e)},R.prototype.has=function(e){return M(this,e).has(e)},R.prototype.set=function(e,t){return M(this,e).set(e,t),this};var j=k((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(W(e))return T?T.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var r=[];return i.test(e)&&r.push(""),e.replace(o,(function(e,t,n,i){r.push(n?i.replace(s,"$1"):t||e)})),r}));function U(e){if("string"==typeof e||W(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function k(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s),s};return r.cache=new(k.Cache||R),r}function q(e,t){return e===t||e!=e&&t!=t}k.Cache=R;var F=Array.isArray;function z(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function W(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==w.call(e)}e.exports=function(e,t,r){return null==e?e:$(e,t,r)}}).call(this,r(2))},function(e,t,r){(function(t){var r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/,i=/^\./,o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,a=/^\[object .+?Constructor\]$/,u="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,l=u||c||Function("return this")();var f,h=Array.prototype,d=Function.prototype,p=Object.prototype,_=l["__core-js_shared__"],g=(f=/[^.]+$/.exec(_&&_.keys&&_.keys.IE_PROTO||""))?"Symbol(src)_1."+f:"",y=d.toString,m=p.hasOwnProperty,b=p.toString,w=RegExp("^"+y.call(m).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),E=l.Symbol,v=h.splice,S=M(l,"Map"),A=M(Object,"create"),N=E?E.prototype:void 0,O=N?N.toString:void 0;function T(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function I(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function B(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function R(e,t){for(var r,n,i=e.length;i--;)if((r=e[i][0])===(n=t)||r!=r&&n!=n)return i;return-1}function D(e){return!(!q(e)||(t=e,g&&g in t))&&(function(e){var t=q(e)?b.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?w:a).test(function(e){if(null!=e){try{return y.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function C(e,t){e=function(e,t){return 1==t.length?e:function(e,t){for(var r=0,n=(t=L(t,e)?[t]:P(t)).length;null!=e&&r<n;)e=e[j(t[r++])];return r&&r==n?e:void 0}(e,function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++n<i;)o[n]=e[n+t];return o}(t,0,-1))}(e,t=L(t,e)?[t]:P(t));var r,n,i=j((n=(r=t)?r.length:0)?r[n-1]:void 0);return!(null!=e&&m.call(e,i))||delete e[i]}function P(e){return k(e)?e:x(e)}function $(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function M(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return D(r)?r:void 0}function L(e,t){if(k(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!F(e))||(n.test(e)||!r.test(e)||null!=t&&e in Object(t))}T.prototype.clear=function(){this.__data__=A?A(null):{}},T.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},T.prototype.get=function(e){var t=this.__data__;if(A){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return m.call(t,e)?t[e]:void 0},T.prototype.has=function(e){var t=this.__data__;return A?void 0!==t[e]:m.call(t,e)},T.prototype.set=function(e,t){return this.__data__[e]=A&&void 0===t?"__lodash_hash_undefined__":t,this},I.prototype.clear=function(){this.__data__=[]},I.prototype.delete=function(e){var t=this.__data__,r=R(t,e);return!(r<0)&&(r==t.length-1?t.pop():v.call(t,r,1),!0)},I.prototype.get=function(e){var t=this.__data__,r=R(t,e);return r<0?void 0:t[r][1]},I.prototype.has=function(e){return R(this.__data__,e)>-1},I.prototype.set=function(e,t){var r=this.__data__,n=R(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},B.prototype.clear=function(){this.__data__={hash:new T,map:new(S||I),string:new T}},B.prototype.delete=function(e){return $(this,e).delete(e)},B.prototype.get=function(e){return $(this,e).get(e)},B.prototype.has=function(e){return $(this,e).has(e)},B.prototype.set=function(e,t){return $(this,e).set(e,t),this};var x=U((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(F(e))return O?O.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var r=[];return i.test(e)&&r.push(""),e.replace(o,(function(e,t,n,i){r.push(n?i.replace(s,"$1"):t||e)})),r}));function j(e){if("string"==typeof e||F(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function U(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s),s};return r.cache=new(U.Cache||B),r}U.Cache=B;var k=Array.isArray;function q(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function F(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==b.call(e)}e.exports=function(e,t){return null==e||C(e,t)}}).call(this,r(2))},function(e,t,r){(function(e,r){var n="[object Arguments]",i="[object Function]",o="[object GeneratorFunction]",s="[object Map]",a="[object Set]",u=/\w*$/,c=/^\[object .+?Constructor\]$/,l=/^(?:0|[1-9]\d*)$/,f={};f[n]=f["[object Array]"]=f["[object ArrayBuffer]"]=f["[object DataView]"]=f["[object Boolean]"]=f["[object Date]"]=f["[object Float32Array]"]=f["[object Float64Array]"]=f["[object Int8Array]"]=f["[object Int16Array]"]=f["[object Int32Array]"]=f[s]=f["[object Number]"]=f["[object Object]"]=f["[object RegExp]"]=f[a]=f["[object String]"]=f["[object Symbol]"]=f["[object Uint8Array]"]=f["[object Uint8ClampedArray]"]=f["[object Uint16Array]"]=f["[object Uint32Array]"]=!0,f["[object Error]"]=f[i]=f["[object WeakMap]"]=!1;var h="object"==typeof e&&e&&e.Object===Object&&e,d="object"==typeof self&&self&&self.Object===Object&&self,p=h||d||Function("return this")(),_=t&&!t.nodeType&&t,g=_&&"object"==typeof r&&r&&!r.nodeType&&r,y=g&&g.exports===_;function m(e,t){return e.set(t[0],t[1]),e}function b(e,t){return e.add(t),e}function w(e,t,r,n){var i=-1,o=e?e.length:0;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function E(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function v(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function S(e,t){return function(r){return e(t(r))}}function A(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var N,O=Array.prototype,T=Function.prototype,I=Object.prototype,B=p["__core-js_shared__"],R=(N=/[^.]+$/.exec(B&&B.keys&&B.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"",D=T.toString,C=I.hasOwnProperty,P=I.toString,$=RegExp("^"+D.call(C).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),M=y?p.Buffer:void 0,L=p.Symbol,x=p.Uint8Array,j=S(Object.getPrototypeOf,Object),U=Object.create,k=I.propertyIsEnumerable,q=O.splice,F=Object.getOwnPropertySymbols,z=M?M.isBuffer:void 0,W=S(Object.keys,Object),Y=ge(p,"DataView"),K=ge(p,"Map"),H=ge(p,"Promise"),G=ge(p,"Set"),J=ge(p,"WeakMap"),V=ge(Object,"create"),X=Ee(Y),Q=Ee(K),Z=Ee(H),ee=Ee(G),te=Ee(J),re=L?L.prototype:void 0,ne=re?re.valueOf:void 0;function ie(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function se(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function ae(e){this.__data__=new oe(e)}function ue(e,t){var r=Se(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ae(e)}(e)&&C.call(e,"callee")&&(!k.call(e,"callee")||P.call(e)==n)}(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],i=r.length,o=!!i;for(var s in e)!t&&!C.call(e,s)||o&&("length"==s||be(s,i))||r.push(s);return r}function ce(e,t,r){var n=e[t];C.call(e,t)&&ve(n,r)&&(void 0!==r||t in e)||(e[t]=r)}function le(e,t){for(var r=e.length;r--;)if(ve(e[r][0],t))return r;return-1}function fe(e,t,r,c,l,h,d){var p;if(c&&(p=h?c(e,l,h,d):c(e)),void 0!==p)return p;if(!Te(e))return e;var _=Se(e);if(_){if(p=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&C.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r<n;)t[r]=e[r];return t}(e,p)}else{var g=me(e),y=g==i||g==o;if(Ne(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if("[object Object]"==g||g==n||y&&!h){if(E(e))return h?e:{};if(p=function(e){return"function"!=typeof e.constructor||we(e)?{}:(t=j(e),Te(t)?U(t):{});var t}(y?{}:e),!t)return function(e,t){return pe(e,ye(e),t)}(e,function(e,t){return e&&pe(t,Ie(t),e)}(p,e))}else{if(!f[g])return h?e:{};p=function(e,t,r,n){var i=e.constructor;switch(t){case"[object ArrayBuffer]":return de(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var r=t?de(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var r=t?de(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,n);case s:return function(e,t,r){return w(t?r(v(e),!0):v(e),m,new e.constructor)}(e,n,r);case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return function(e){var t=new e.constructor(e.source,u.exec(e));return t.lastIndex=e.lastIndex,t}(e);case a:return function(e,t,r){return w(t?r(A(e),!0):A(e),b,new e.constructor)}(e,n,r);case"[object Symbol]":return o=e,ne?Object(ne.call(o)):{}}var o}(e,g,fe,t)}}d||(d=new ae);var S=d.get(e);if(S)return S;if(d.set(e,p),!_)var N=r?function(e){return function(e,t,r){var n=t(e);return Se(e)?n:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(n,r(e))}(e,Ie,ye)}(e):Ie(e);return function(e,t){for(var r=-1,n=e?e.length:0;++r<n&&!1!==t(e[r],r,e););}(N||e,(function(n,i){N&&(n=e[i=n]),ce(p,i,fe(n,t,r,c,i,e,d))})),p}function he(e){return!(!Te(e)||(t=e,R&&R in t))&&(Oe(e)||E(e)?$:c).test(Ee(e));var t}function de(e){var t=new e.constructor(e.byteLength);return new x(t).set(new x(e)),t}function pe(e,t,r,n){r||(r={});for(var i=-1,o=t.length;++i<o;){var s=t[i],a=n?n(r[s],e[s],s,r,e):void 0;ce(r,s,void 0===a?e[s]:a)}return r}function _e(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function ge(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return he(r)?r:void 0}ie.prototype.clear=function(){this.__data__=V?V(null):{}},ie.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ie.prototype.get=function(e){var t=this.__data__;if(V){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return C.call(t,e)?t[e]:void 0},ie.prototype.has=function(e){var t=this.__data__;return V?void 0!==t[e]:C.call(t,e)},ie.prototype.set=function(e,t){return this.__data__[e]=V&&void 0===t?"__lodash_hash_undefined__":t,this},oe.prototype.clear=function(){this.__data__=[]},oe.prototype.delete=function(e){var t=this.__data__,r=le(t,e);return!(r<0)&&(r==t.length-1?t.pop():q.call(t,r,1),!0)},oe.prototype.get=function(e){var t=this.__data__,r=le(t,e);return r<0?void 0:t[r][1]},oe.prototype.has=function(e){return le(this.__data__,e)>-1},oe.prototype.set=function(e,t){var r=this.__data__,n=le(r,e);return n<0?r.push([e,t]):r[n][1]=t,this},se.prototype.clear=function(){this.__data__={hash:new ie,map:new(K||oe),string:new ie}},se.prototype.delete=function(e){return _e(this,e).delete(e)},se.prototype.get=function(e){return _e(this,e).get(e)},se.prototype.has=function(e){return _e(this,e).has(e)},se.prototype.set=function(e,t){return _e(this,e).set(e,t),this},ae.prototype.clear=function(){this.__data__=new oe},ae.prototype.delete=function(e){return this.__data__.delete(e)},ae.prototype.get=function(e){return this.__data__.get(e)},ae.prototype.has=function(e){return this.__data__.has(e)},ae.prototype.set=function(e,t){var r=this.__data__;if(r instanceof oe){var n=r.__data__;if(!K||n.length<199)return n.push([e,t]),this;r=this.__data__=new se(n)}return r.set(e,t),this};var ye=F?S(F,Object):function(){return[]},me=function(e){return P.call(e)};function be(e,t){return!!(t=null==t?9007199254740991:t)&&("number"==typeof e||l.test(e))&&e>-1&&e%1==0&&e<t}function we(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||I)}function Ee(e){if(null!=e){try{return D.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function ve(e,t){return e===t||e!=e&&t!=t}(Y&&"[object DataView]"!=me(new Y(new ArrayBuffer(1)))||K&&me(new K)!=s||H&&"[object Promise]"!=me(H.resolve())||G&&me(new G)!=a||J&&"[object WeakMap]"!=me(new J))&&(me=function(e){var t=P.call(e),r="[object Object]"==t?e.constructor:void 0,n=r?Ee(r):void 0;if(n)switch(n){case X:return"[object DataView]";case Q:return s;case Z:return"[object Promise]";case ee:return a;case te:return"[object WeakMap]"}return t});var Se=Array.isArray;function Ae(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}(e.length)&&!Oe(e)}var Ne=z||function(){return!1};function Oe(e){var t=Te(e)?P.call(e):"";return t==i||t==o}function Te(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ie(e){return Ae(e)?ue(e):function(e){if(!we(e))return W(e);var t=[];for(var r in Object(e))C.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}r.exports=function(e){return fe(e,!0,!0)}}).call(this,r(2),r(13)(e))},function(e,t,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.registerDatabase=void 0;var i=r(30),o=r(17),s=o.constants.SDK_NAME,a=o.constants.ERRORS;var u={name:"database",entity:{database:function(e){if(this.authInstance){var t=this.platform,r=t.adapter,o=t.runtime;return i.Db.reqClass=this.request.constructor,i.Db.wsClass=r.wsClass,i.Db.getAccessToken=this.authInstance.getAccessToken.bind(this.authInstance),i.Db.runtime=o,i.Db.ws||(i.Db.ws=null),new i.Db(n(n({},this.config),e))}console.warn("["+s+"]["+a.INVALID_OPERATION+"] not login ")}}};try{cloudbase.registerComponent(u)}catch(e){}t.registerDatabase=function(e){e.registerComponent(u)}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),s=n[0],a=n[1],u=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),l=0,f=a>0?s-4:s;for(r=0;r<f;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+16383));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,o,s=[],a=t;a<r;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,l=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=c}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,l=(1<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+d]=255&s,d+=p,s/=256,c-=8);e[r+d-p]|=128*_}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.events=t.cache=t.adapters=t.constants=void 0;var s=o(r(6));t.constants=s;var a=o(r(19));t.adapters=a;var u=o(r(27));t.cache=u;var c=o(r(29));t.events=c;var l=o(r(4));t.utils=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERRORS=void 0,t.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.useDefaultAdapter=t.useAdapters=t.RUNTIME=void 0;var s,a=o(r(20)),u=r(4);!function(e){e.WEB="web",e.WX_MP="wx_mp"}(s=t.RUNTIME||(t.RUNTIME={})),t.useAdapters=function(e){for(var t=0,r=u.isArray(e)?e:[e];t<r.length;t++){var n=r[t],i=n.isMatch,o=n.genAdapter,s=n.runtime;if(i())return{adapter:o(),runtime:s}}},t.useDefaultAdapter=function(){return{adapter:a.genAdapter(),runtime:s.WEB}}},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRequest=t.genAdapter=void 0;var u=r(8),c=r(4),l=r(7),f=function(e){function t(t){var r=e.call(this)||this,n=t.timeout,i=t.timeoutMsg,o=t.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=i||"请求超时",r._restrictedMethods=o||["get","post","upload","download"],r}return i(t,e),t.prototype.get=function(e){return this._request(o(o({},e),{method:"get"}),this._restrictedMethods.includes("get"))},t.prototype.post=function(e){return this._request(o(o({},e),{method:"post"}),this._restrictedMethods.includes("post"))},t.prototype.put=function(e){return this._request(o(o({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,i=new FormData;for(var s in t)i.append(s,t[s]);return i.append("key",n),i.append("file",r),this._request(o(o({},e),{data:i,method:"post"}),this._restrictedMethods.includes("upload"))},t.prototype.download=function(e){return s(this,void 0,void 0,(function(){var t,r;return a(this,(function(n){return t=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(r=document.createElement("a")).href=e.url,r.setAttribute("download",t),r.setAttribute("target","_blank"),document.body.appendChild(r),r.click(),[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}))}))},t.prototype._request=function(e,t){var r=this;void 0===t&&(t=!1);var n=String(e.method).toLowerCase()||"get";return new Promise((function(i){var o,s,a=e.url,u=e.headers,f=void 0===u?{}:u,h=e.data,d=e.responseType,p=e.withCredentials,_=e.body,g=e.onUploadProgress,y=c.formatUrl(l.PROTOCOL,a,"get"===n?h:{}),m=new XMLHttpRequest;for(var b in m.open(n,y),d&&(m.responseType=d),f)m.setRequestHeader(b,f[b]);g&&m.addEventListener("progress",g),m.onreadystatechange=function(){var e={};if(4===m.readyState){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};t.forEach((function(e){var t=e.split(": "),n=t.shift().toLowerCase(),i=t.join(": ");r[n]=i})),e.header=r,e.statusCode=m.status;try{e.data=JSON.parse(m.responseText)}catch(t){e.data=m.responseText}clearTimeout(o),i(e)}},t&&r._timeout&&(o=setTimeout((function(){console.warn(r._timeoutMsg),m.abort()}),r._timeout)),s=c.isFormData(h)?h:"application/x-www-form-urlencoded"===f["content-type"]?c.toQueryString(h):_||(h?JSON.stringify(h):void 0),p&&(m.withCredentials=!0),m.send(s)}))},t}(u.AbstractSDKRequest);t.WebRequest=f,t.genAdapter=function(){return{root:window,reqClass:f,wsClass:WebSocket,localStorage:localStorage,sessionStorage:sessionStorage}}},function(e,t,r){var n;e.exports=(n=r(5),r(23),r(24),n.HmacSHA256)},function(e,t){if(void 0===__WEBPACK_EXTERNAL_MODULE__22__){var r=new Error("Cannot find module 'null'");throw r.code="MODULE_NOT_FOUND",r}e.exports=__WEBPACK_EXTERNAL_MODULE__22__},function(e,t,r){var n;e.exports=(n=r(5),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,s=t.algo,a=[],u=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)t(n)&&(i<8&&(a[i]=r(e.pow(n,.5))),u[i]=r(e.pow(n,1/3)),i++),n++}();var c=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],l=r[5],f=r[6],h=r[7],d=0;d<64;d++){if(d<16)c[d]=0|e[t+d];else{var p=c[d-15],_=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,g=c[d-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[d]=_+c[d-7]+y+c[d-16]}var m=n&i^n&o^i&o,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[d]+c[d];h=f,f=l,l=a,a=s+w|0,s=o,o=i,i=n,n=w+(b+m)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),n.SHA256)},function(e,t,r){var n,i,o,s;e.exports=(n=r(5),o=(i=n).lib.Base,s=i.enc.Utf8,void(i.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),a=i.words,u=o.words,c=0;c<r;c++)a[c]^=1549556828,u[c]^=909522486;i.sigBytes=o.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))},function(e,t,r){var n,i,o;e.exports=(o=r(5),i=(n=o).lib.WordArray,n.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;o+=3)for(var s=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<r;a++)i.push(n.charAt(s>>>6*(3-a)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o<r.length;o++)n[r.charCodeAt(o)]=o}var s=r.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,r){for(var n=[],o=0,s=0;s<t;s++)if(s%4){var a=r[e.charCodeAt(s-1)]<<s%4*2,u=r[e.charCodeAt(s)]>>>6-s%4*2,c=a|u;n[o>>>2]|=c<<24-o%4*8,o++}return i.create(n,o)}(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,r){var n;e.exports=(n=r(5),n.enc.Utf8)},function(e,t,r){"use strict";(function(e){var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var a=r(8),u=r(4),c=r(6),l=function(e){function t(t){var r=e.call(this)||this;return r._root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return i(t,e),t.prototype.setItem=function(e,t){this._root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this._root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this._root.tcbCacheObject[e]},t.prototype.clear=function(){delete this._root.tcbCacheObject},t}(a.AbstractStorage);function f(e,t){switch(e){case"local":return t.localStorage?t.localStorage:(u.printWarn(c.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(t.root));case"none":return new l(t.root);default:return t.sessionStorage?t.sessionStorage:(u.printWarn(c.ERRORS.INVALID_PARAMS,"sessionStorage is not supported on current platform"),new l(t.root))}}var h=function(){function t(e){this.keys={};var t=e.persistence,r=e.platformInfo,n=void 0===r?{}:r,i=e.keys,o=void 0===i?{}:i,s=e.alwaysLocalKeys,a=void 0===s?[]:s;this._platformInfo=n,this._alwaysLocalKeys=a,this._storage||(this._persistence=n.adapter.primaryStorage||t,this._storage=f(this._persistence,n.adapter),this.keys=o)}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._persistence},enumerable:!1,configurable:!0}),t.prototype.updatePersistence=function(e){if("async"!==this.mode){if(e!==this._persistence){var t="local"===this._persistence;this._persistence=e;var r=f(e,this._platformInfo.adapter);for(var n in this.keys){var i=this.keys[n];if(!t||!this._alwaysLocalKeys.includes(n)){var o=this._storage.getItem(i);u.isUndefined(o)||u.isNull(o)||(r.setItem(i,o),this._storage.removeItem(i))}}this._storage=r}}else u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use updatePersistenceAsync insteed")},t.prototype.updatePersistenceAsync=function(e){return o(this,void 0,void 0,(function(){var t,r,n,i,o,a,c,l;return s(this,(function(s){switch(s.label){case 0:if(e===this._persistence)return[2];for(i in t="local"===this._persistence,this._persistence=e,r=f(e,this._platformInfo.adapter),n=[],this.keys)n.push(i);o=0,s.label=1;case 1:return o<n.length?(a=n[o],c=this.keys[a],t&&this._alwaysLocalKeys.includes(a)?[3,4]:[4,this._storage.getItem(c)]):[3,5];case 2:return l=s.sent(),u.isUndefined(l)||u.isNull(l)?[3,4]:(r.setItem(c,l),[4,this._storage.removeItem(c)]);case 3:s.sent(),s.label=4;case 4:return o++,[3,1];case 5:return this._storage=r,[2]}}))}))},t.prototype.setStore=function(e,t,r){if("async"!==this.mode){if(this._storage)try{var n={version:r||"localCachev1",content:t};this._storage.setItem(e,JSON.stringify(n))}catch(e){return}}else u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(e,t,r){return o(this,void 0,void 0,(function(){var n;return s(this,(function(i){switch(i.label){case 0:if(!this._storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),n={version:r||"localCachev1",content:t},[4,this._storage.setItem(e,JSON.stringify(n))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,r){var n;if("async"!==this.mode){try{if(void 0!==e&&(null===(n=e.env)||void 0===n?void 0:n.tcb_token))return e.env.tcb_token;if(!this._storage)return""}catch(e){return""}r=r||"localCachev1";var i=this._storage.getItem(t);return i&&i.indexOf(r)>=0?JSON.parse(i).content:""}u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,r){var n;return o(this,void 0,void 0,(function(){var i;return s(this,(function(o){switch(o.label){case 0:try{if(void 0!==e&&(null===(n=e.env)||void 0===n?void 0:n.tcb_token))return[2,e.env.tcb_token];if(!this._storage)return[2,""]}catch(e){return[2,""]}return r=r||"localCachev1",[4,this._storage.getItem(t)];case 1:return(i=o.sent())&&i.indexOf(r)>=0?[2,JSON.parse(i).content]:[2,""]}}))}))},t.prototype.removeStore=function(e){"async"!==this.mode?this._storage.removeItem(e):u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this._storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},t}();t.CloudbaseCache=h}).call(this,r(28))},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,c=[],l=!1,f=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!l){var e=a(h);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function _(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new p(e,t)),1!==c.length||l||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=_,i.addListener=_,i.once=_,i.off=_,i.removeListener=_,i.removeAllListeners=_,i.emit=_,i.prependListener=_,i.prependOnceListener=_,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)n[i]=o[s];return n};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var s=r(4);var a=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=a;var u=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return i(t,e),t}(a);t.IErrorEvent=u;var c=function(){function e(){this._listeners={}}return e.prototype.on=function(e,t){return function(e,t,r){r[e]=r[e]||[],r[e].push(t)}(e,t,this._listeners),this},e.prototype.off=function(e,t){return function(e,t,r){if(null==r?void 0:r[e]){var n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1)}}(e,t,this._listeners),this},e.prototype.fire=function(e,t){if(s.isInstanceOf(e,u))return console.error(e.error),this;var r=s.isString(e)?new a(e,t||{}):e,n=r.name;if(this._listens(n)){r.target=this;for(var i=0,c=this._listeners[n]?o(this._listeners[n]):[];i<c.length;i++){c[i].call(this,r)}}return this},e.prototype._listens=function(e){return this._listeners[e]&&this._listeners[e].length>0},e}();t.CloudbaseEventEmitter=c;var l=new c;t.addEventListener=function(e,t){l.on(e,t)},t.activateEvent=function(e,t){void 0===t&&(t={}),l.fire(e,t)},t.removeEventListener=function(e,t){l.off(e,t)}},function(e,t,r){"use strict";r.r(t),r.d(t,"Query",(function(){return Ge})),r.d(t,"CollectionReference",(function(){return Xe})),r.d(t,"DocumentReference",(function(){return Ye})),r.d(t,"Db",(function(){return ft}));var n,i={};r.r(i),r.d(i,"Point",(function(){return J})),r.d(i,"LineString",(function(){return V})),r.d(i,"Polygon",(function(){return X})),r.d(i,"MultiPoint",(function(){return Q})),r.d(i,"MultiLineString",(function(){return Z})),r.d(i,"MultiPolygon",(function(){return ee})),function(e){e.DocIDError="文档ID不合法",e.CollNameError="集合名称不合法",e.OpStrError="操作符不合法",e.DirectionError="排序字符不合法",e.IntergerError="must be integer",e.QueryParamTypeError="查询参数必须为对象",e.QueryParamValueError="查询参数对象值不能均为undefined"}(n||(n={}));const o="Number",s="Object",a="Array",u="GeoPoint",c="GeoLineString",l="GeoPolygon",f="GeoMultiPoint",h="GeoMultiLineString",d="GeoMultiPolygon",p="Date",_="ServerDate",g="BsonDate",y=["desc","asc"],m=["<","<=","==",">=",">"];var b;!function(e){e.lt="<",e.gt=">",e.lte="<=",e.gte=">=",e.eq="=="}(b||(b={}));b.eq,b.lt,b.lte,b.gt,b.gte;var w;!function(e){e.WHERE="WHERE",e.DOC="DOC"}(w||(w={}));const E=[],v={};class S extends class{constructor(e){Object.defineProperties(this,{target:{enumerable:!1,writable:!1,configurable:!1,value:e}})}}{constructor(e,t){if(t!==v)throw new TypeError("InternalSymbol cannot be constructed with new operator");super(e)}static for(e){for(let t=0,r=E.length;t<r;t++)if(E[t].target===e)return E[t].instance;const t=new S(e,v);return E.push({target:e,instance:t}),t}}var A=S;const N=A.for("UNSET_FIELD_NAME"),O=A.for("UPDATE_COMMAND"),T=A.for("QUERY_COMMAND"),I=A.for("LOGIC_COMMAND"),B=A.for("GEO_POINT"),R=A.for("SYMBOL_GEO_LINE_STRING"),D=A.for("SYMBOL_GEO_POLYGON"),C=A.for("SYMBOL_GEO_MULTI_POINT"),P=A.for("SYMBOL_GEO_MULTI_LINE_STRING"),$=A.for("SYMBOL_GEO_MULTI_POLYGON"),M=A.for("SERVER_DATE"),L=A.for("REGEXP");class x{constructor({offset:e=0}={}){this.offset=e}get _internalType(){return M}parse(){return{$date:{offset:this.offset}}}}function j(e){return new x(e)}class U{}U.formatResDocumentData=e=>e.map(e=>U.formatField(e)),U.formatField=e=>{const t=Object.keys(e);let r={};return Array.isArray(e)&&(r=[]),t.forEach(t=>{const n=e[t];let i;switch(U.whichType(n)){case u:i=new J(n.coordinates[0],n.coordinates[1]);break;case c:i=new V(n.coordinates.map(e=>new J(e[0],e[1])));break;case l:i=new X(n.coordinates.map(e=>new V(e.map(([e,t])=>new J(e,t)))));break;case f:i=new Q(n.coordinates.map(e=>new J(e[0],e[1])));break;case h:i=new Z(n.coordinates.map(e=>new V(e.map(([e,t])=>new J(e,t)))));break;case d:i=new ee(n.coordinates.map(e=>new X(e.map(e=>new V(e.map(([e,t])=>new J(e,t)))))));break;case p:i=new Date(1e3*n.$timestamp);break;case s:case a:i=U.formatField(n);break;case _:i=new Date(n.$date);break;default:i=n}Array.isArray(r)?r.push(i):r[t]=i}),r},U.whichType=e=>{let t=Object.prototype.toString.call(e).slice(8,-1);if(t===p)return g;if(t===s){if(e instanceof J)return u;if(e instanceof Date)return p;if(e instanceof x)return _;e.$timestamp?t=p:e.$date?t=_:J.validate(e)?t=u:V.validate(e)?t=c:X.validate(e)?t=l:Q.validate(e)?t=f:Z.validate(e)?t=h:ee.validate(e)&&(t=d)}return t},U.generateDocId=()=>{let e="ABCDEFabcdef0123456789",t="";for(let r=0;r<24;r++)t+=e.charAt(Math.floor(Math.random()*e.length));return t};class k{static isGeopoint(e,t){if(U.whichType(t)!==o)throw new Error("Geo Point must be number type");const r=Math.abs(t);if("latitude"===e&&r>90)throw new Error("latitude should be a number ranges from -90 to 90");if("longitude"===e&&r>180)throw new Error("longitude should be a number ranges from -180 to 180");return!0}static isInteger(e,t){if(!Number.isInteger(t))throw new Error(e+n.IntergerError);return!0}static isFieldOrder(e){if(-1===y.indexOf(e))throw new Error(n.DirectionError);return!0}static isFieldPath(e){if(!/^[a-zA-Z0-9-_\.]/.test(e))throw new Error;return!0}static isOperator(e){if(-1===m.indexOf(e))throw new Error(n.OpStrError);return!0}static isCollName(e){if(!/^[a-zA-Z0-9]([a-zA-Z0-9-_]){1,32}$/.test(e))throw new Error(n.CollNameError);return!0}static isDocID(e){if(!/^([a-fA-F0-9]){24}$/.test(e))throw new Error(n.DocIDError);return!0}}const q=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),F=e=>"object"===q(e),z=e=>"string"===q(e),W=e=>"number"===q(e),Y=e=>Array.isArray(e),K=e=>"date"===q(e),H=e=>"regexp"===q(e),G=e=>e&&e._internalType instanceof S;class J{constructor(e,t){k.isGeopoint("longitude",e),k.isGeopoint("latitude",t),this.longitude=e,this.latitude=t}parse(e){return{[e]:{type:"Point",coordinates:[this.longitude,this.latitude]}}}toJSON(){return{type:"Point",coordinates:[this.longitude,this.latitude]}}toReadableString(){return`[${this.longitude},${this.latitude}]`}static validate(e){return"Point"===e.type&&Y(e.coordinates)&&k.isGeopoint("longitude",e.coordinates[0])&&k.isGeopoint("latitude",e.coordinates[1])}get _internalType(){return B}}class V{constructor(e){if(!Y(e))throw new TypeError('"points" must be of type Point[]. Received type '+typeof e);if(e.length<2)throw new Error('"points" must contain 2 points at least');e.forEach(e=>{if(!(e instanceof J))throw new TypeError(`"points" must be of type Point[]. Received type ${typeof e}[]`)}),this.points=e}parse(e){return{[e]:{type:"LineString",coordinates:this.points.map(e=>e.toJSON().coordinates)}}}toJSON(){return{type:"LineString",coordinates:this.points.map(e=>e.toJSON().coordinates)}}static validate(e){if("LineString"!==e.type||!Y(e.coordinates))return!1;for(let t of e.coordinates)if(!W(t[0])||!W(t[1]))return!1;return!0}static isClosed(e){const t=e.points[0],r=e.points[e.points.length-1];if(t.latitude===r.latitude&&t.longitude===r.longitude)return!0}get _internalType(){return R}}class X{constructor(e){if(!Y(e))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof e);if(0===e.length)throw new Error("Polygon must contain 1 linestring at least");e.forEach(e=>{if(!(e instanceof V))throw new TypeError(`"lines" must be of type LineString[]. Received type ${typeof e}[]`);if(!V.isClosed(e))throw new Error(`LineString ${e.points.map(e=>e.toReadableString())} is not a closed cycle`)}),this.lines=e}parse(e){return{[e]:{type:"Polygon",coordinates:this.lines.map(e=>e.points.map(e=>[e.longitude,e.latitude]))}}}toJSON(){return{type:"Polygon",coordinates:this.lines.map(e=>e.points.map(e=>[e.longitude,e.latitude]))}}static validate(e){if("Polygon"!==e.type||!Y(e.coordinates))return!1;for(let t of e.coordinates){if(!this.isCloseLineString(t))return!1;for(let e of t)if(!W(e[0])||!W(e[1]))return!1}return!0}static isCloseLineString(e){const t=e[0],r=e[e.length-1];return t[0]===r[0]&&t[1]===r[1]}get _internalType(){return $}}class Q{constructor(e){if(!Y(e))throw new TypeError('"points" must be of type Point[]. Received type '+typeof e);if(0===e.length)throw new Error('"points" must contain 1 point at least');e.forEach(e=>{if(!(e instanceof J))throw new TypeError(`"points" must be of type Point[]. Received type ${typeof e}[]`)}),this.points=e}parse(e){return{[e]:{type:"MultiPoint",coordinates:this.points.map(e=>e.toJSON().coordinates)}}}toJSON(){return{type:"MultiPoint",coordinates:this.points.map(e=>e.toJSON().coordinates)}}static validate(e){if("MultiPoint"!==e.type||!Y(e.coordinates))return!1;for(let t of e.coordinates)if(!W(t[0])||!W(t[1]))return!1;return!0}get _internalType(){return C}}class Z{constructor(e){if(!Y(e))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof e);if(0===e.length)throw new Error("Polygon must contain 1 linestring at least");e.forEach(e=>{if(!(e instanceof V))throw new TypeError(`"lines" must be of type LineString[]. Received type ${typeof e}[]`)}),this.lines=e}parse(e){return{[e]:{type:"MultiLineString",coordinates:this.lines.map(e=>e.points.map(e=>[e.longitude,e.latitude]))}}}toJSON(){return{type:"MultiLineString",coordinates:this.lines.map(e=>e.points.map(e=>[e.longitude,e.latitude]))}}static validate(e){if("MultiLineString"!==e.type||!Y(e.coordinates))return!1;for(let t of e.coordinates)for(let e of t)if(!W(e[0])||!W(e[1]))return!1;return!0}get _internalType(){return P}}class ee{constructor(e){if(!Y(e))throw new TypeError('"polygons" must be of type Polygon[]. Received type '+typeof e);if(0===e.length)throw new Error("MultiPolygon must contain 1 polygon at least");for(let t of e)if(!(t instanceof X))throw new TypeError(`"polygon" must be of type Polygon[]. Received type ${typeof t}[]`);this.polygons=e}parse(e){return{[e]:{type:"MultiPolygon",coordinates:this.polygons.map(e=>e.lines.map(e=>e.points.map(e=>[e.longitude,e.latitude])))}}}toJSON(){return{type:"MultiPolygon",coordinates:this.polygons.map(e=>e.lines.map(e=>e.points.map(e=>[e.longitude,e.latitude])))}}static validate(e){if("MultiPolygon"!==e.type||!Y(e.coordinates))return!1;for(let t of e.coordinates)for(let e of t)for(let t of e)if(!W(t[0])||!W(t[1]))return!1;return!0}get _internalType(){return D}}const te=()=>{let e;if(!Promise){e=()=>{},e.promise={};const t=()=>{throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}const t=new Promise((t,r)=>{e=(e,n)=>e?r(e):t(n)});return e.promise=t,e};var re;!function(e){e.SET="set",e.REMOVE="remove",e.INC="inc",e.MUL="mul",e.PUSH="push",e.PULL="pull",e.PULL_ALL="pullAll",e.POP="pop",e.SHIFT="shift",e.UNSHIFT="unshift",e.ADD_TO_SET="addToSet",e.BIT="bit",e.RENAME="rename",e.MAX="max",e.MIN="min"}(re||(re={}));class ne{constructor(e,t,r){this._internalType=O,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=e,this.operands=t,this.fieldName=r||N}_setFieldName(e){return new ne(this.operator,this.operands,e)}}function ie(e){return e&&e instanceof ne&&e._internalType===O}var oe;!function(e){e.AND="and",e.OR="or",e.NOT="not",e.NOR="nor"}(oe||(oe={}));class se{constructor(e,t,r){if(this._internalType=I,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=e,this.operands=t,this.fieldName=r||N,this.fieldName!==N)if(Array.isArray(t)){t=t.slice(),this.operands=t;for(let e=0,r=t.length;e<r;e++){const r=t[e];(ae(r)||le(r))&&(t[e]=r._setFieldName(this.fieldName))}}else{const e=t;(ae(e)||le(e))&&(t=e._setFieldName(this.fieldName))}}_setFieldName(e){const t=this.operands.map(t=>t instanceof se?t._setFieldName(e):t);return new se(this.operator,t,e)}and(...e){const t=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return t.unshift(this),new se(oe.AND,t,this.fieldName)}or(...e){const t=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return t.unshift(this),new se(oe.OR,t,this.fieldName)}}function ae(e){return e&&e instanceof se&&e._internalType===I}var ue;!function(e){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",e.GEO_NEAR="geoNear",e.GEO_WITHIN="geoWithin",e.GEO_INTERSECTS="geoIntersects"}(ue||(ue={}));class ce extends se{constructor(e,t,r){super(e,t,r),this.operator=e,this._internalType=T}toJSON(){switch(this.operator){case ue.IN:case ue.NIN:return{["$"+this.operator]:this.operands};default:return{["$"+this.operator]:this.operands[0]}}}_setFieldName(e){return new ce(this.operator,this.operands,e)}eq(e){const t=new ce(ue.EQ,[e],this.fieldName);return this.and(t)}neq(e){const t=new ce(ue.NEQ,[e],this.fieldName);return this.and(t)}gt(e){const t=new ce(ue.GT,[e],this.fieldName);return this.and(t)}gte(e){const t=new ce(ue.GTE,[e],this.fieldName);return this.and(t)}lt(e){const t=new ce(ue.LT,[e],this.fieldName);return this.and(t)}lte(e){const t=new ce(ue.LTE,[e],this.fieldName);return this.and(t)}in(e){const t=new ce(ue.IN,e,this.fieldName);return this.and(t)}nin(e){const t=new ce(ue.NIN,e,this.fieldName);return this.and(t)}geoNear(e){if(!(e.geometry instanceof J))throw new TypeError('"geometry" must be of type Point. Received type '+typeof e.geometry);if(void 0!==e.maxDistance&&!W(e.maxDistance))throw new TypeError('"maxDistance" must be of type Number. Received type '+typeof e.maxDistance);if(void 0!==e.minDistance&&!W(e.minDistance))throw new TypeError('"minDistance" must be of type Number. Received type '+typeof e.minDistance);const t=new ce(ue.GEO_NEAR,[e],this.fieldName);return this.and(t)}geoWithin(e){if(!(e.geometry instanceof ee||e.geometry instanceof X))throw new TypeError('"geometry" must be of type Polygon or MultiPolygon. Received type '+typeof e.geometry);const t=new ce(ue.GEO_WITHIN,[e],this.fieldName);return this.and(t)}geoIntersects(e){if(!(e.geometry instanceof J||e.geometry instanceof V||e.geometry instanceof X||e.geometry instanceof Q||e.geometry instanceof Z||e.geometry instanceof ee))throw new TypeError('"geometry" must be of type Point, LineString, Polygon, MultiPoint, MultiLineString or MultiPolygon. Received type '+typeof e.geometry);const t=new ce(ue.GEO_INTERSECTS,[e],this.fieldName);return this.and(t)}}function le(e){return e&&e instanceof ce&&e._internalType===T}function fe(e){return le(e)}const he={};for(const e in ue)he[e]="$"+e;for(const e in oe)he[e]="$"+e;for(const e in re)he[e]="$"+e;function de(e){return he[e]||"$"+e}function pe(e){return function e(t,r){if(!G(t)){if(K(t))return{$date:+t};if(H(t))return{$regex:t.source,$options:t.flags};if(Y(t))return t.map(t=>{if(r.indexOf(t)>-1)throw new Error("Cannot convert circular structure to JSON");return e(t,[...r,t])});if(F(t)){const n=Object.assign({},t);for(const t in n){if(r.indexOf(n[t])>-1)throw new Error("Cannot convert circular structure to JSON");n[t]=e(n[t],[...r,n[t]])}return n}return t}switch(t._internalType){case B:return t.toJSON();case M:case L:return t.parse();default:return t.toJSON?t.toJSON():t}}(e,[e])}function _e(e,t,r,n){const i=Object.assign({},e);for(const o in e){if(/^\$/.test(o))continue;const s=e[o];if(s&&(F(s)&&!t(s))){if(n.indexOf(s)>-1)throw new Error("Cannot convert circular structure to JSON");const e=_e(s,t,[...r,o],[...n,s]);i[o]=e;let a=!1;for(const t in e)/^\$/.test(t)?a=!0:(i[`${o}.${t}`]=e[t],delete i[o][t]);a||delete i[o]}}return i}function ge(e){return _e(e,me,[],[e])}function ye(e,t,r){t[r]||delete e[r];for(const n in t)e[n]?Y(e[n])?e[n].push(t[n]):F(e[n])?F(t[n])?Object.assign(e[n],t[n]):(console.warn(`unmergable condition, query is object but condition is ${q(t)}, can only overwrite`,t,r),e[n]=t[n]):(console.warn(`to-merge query is of type ${q(e)}, can only overwrite`,e,t,r),e[n]=t[n]):e[n]=t[n]}function me(e){return G(e)||K(e)||H(e)}function be(e){return pe(e)}he[ue.NEQ]="$ne",he[re.REMOVE]="$unset",he[re.SHIFT]="$pop",he[re.UNSHIFT]="$push";class we{constructor(){}static encode(e){return(new we).encodeUpdate(e)}encodeUpdate(e){return ie(e)?this.encodeUpdateCommand(e):"object"===q(e)?this.encodeUpdateObject(e):e}encodeUpdateCommand(e){if(e.fieldName===N)throw new Error("Cannot encode a comparison command with unset field name");switch(e.operator){case re.PUSH:case re.PULL:case re.PULL_ALL:case re.POP:case re.SHIFT:case re.UNSHIFT:case re.ADD_TO_SET:return this.encodeArrayUpdateCommand(e);default:return this.encodeFieldUpdateCommand(e)}}encodeFieldUpdateCommand(e){const t=de(e.operator);switch(e.operator){case re.REMOVE:return{[t]:{[e.fieldName]:""}};default:return{[t]:{[e.fieldName]:e.operands[0]}}}}encodeArrayUpdateCommand(e){const t=de(e.operator);switch(e.operator){case re.PUSH:{let r;return r=Y(e.operands)?{$each:e.operands.map(be)}:e.operands,{[t]:{[e.fieldName]:r}}}case re.UNSHIFT:{const r={$each:e.operands.map(be),$position:0};return{[t]:{[e.fieldName]:r}}}case re.POP:return{[t]:{[e.fieldName]:1}};case re.SHIFT:return{[t]:{[e.fieldName]:-1}};default:return{[t]:{[e.fieldName]:be(e.operands)}}}}encodeUpdateObject(e){const t=ge(e);for(const e in t){if(/^\$/.test(e))continue;let r=t[e];if(ie(r)){t[e]=r._setFieldName(e),ye(t,this.encodeUpdateCommand(t[e]),e)}else{t[e]=r=be(r);const n=new ne(re.SET,[r],e);ye(t,this.encodeUpdateCommand(n),e)}}return t}}var Ee=r(9),ve=r.n(Ee),Se=r(10),Ae=r.n(Se),Ne=r(11),Oe=r.n(Ne);function Te(e=""){return`${e?e+"_":""}${+new Date}_${Math.random()}`}const Ie={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"};class Be extends Error{constructor(e){super(e.errMsg),this.errCode="UNKNOWN_ERROR",Object.defineProperties(this,{message:{get(){return`errCode: ${this.errCode} ${Ie[this.errCode]||""} | errMsg: `+this.errMsg},set(e){this.errMsg=e}}}),this.errCode=e.errCode||"UNKNOWN_ERROR",this.errMsg=e.errMsg}get message(){return`errCode: ${this.errCode} | errMsg: `+this.errMsg}set message(e){this.errMsg=e}}class Re extends Error{constructor(e){super(e),this.type="timeout",this.payload=null,this.generic=!0}}class De extends Error{constructor(e){super(e),this.type="cancelled",this.payload=null,this.generic=!0}}const Ce=(e=0)=>new Promise(t=>setTimeout(t,e));class Pe{constructor(e){this.close=e.close,this.onChange=e.onChange,this.onError=e.onError,e.debug&&Object.defineProperty(this,"virtualClient",{get:()=>e.virtualClient})}}class $e{constructor(e){const{id:t,docChanges:r,docs:n,msgType:i,type:o}=e;let s,a;Object.defineProperties(this,{id:{get:()=>t,enumerable:!0},docChanges:{get:()=>(s||(s=JSON.parse(JSON.stringify(r))),s),enumerable:!0},docs:{get:()=>(a||(a=JSON.parse(JSON.stringify(n))),a),enumerable:!0},msgType:{get:()=>i,enumerable:!0},type:{get:()=>o,enumerable:!0}})}}class Me extends Error{constructor(e){super(`Watch Error ${JSON.stringify(e.msgData)} (requestid: ${e.requestId})`),this.isRealtimeErrorMessageError=!0,this.payload=e}}const Le=e=>e&&e.isRealtimeErrorMessageError;var xe;!function(e){e.LOGGINGIN="LOGGINGIN",e.INITING="INITING",e.REBUILDING="REBUILDING",e.ACTIVE="ACTIVE",e.ERRORED="ERRORED",e.CLOSING="CLOSING",e.CLOSED="CLOSED",e.PAUSED="PAUSED",e.RESUMING="RESUMING"}(xe||(xe={}));class je{constructor(e){this.watchStatus=xe.INITING,this._login=async(e,t)=>{this.watchStatus=xe.LOGGINGIN;const r=await this.login(e,t);return this.envId||(this.envId=r.envId),r},this.initWatch=async e=>{if(this._initWatchPromise)return this._initWatchPromise;this._initWatchPromise=new Promise(async(t,r)=>{try{if(this.watchStatus===xe.PAUSED)return console.log("[realtime] initWatch cancelled on pause"),t();const{envId:r}=await this._login(this.envId,e);if(this.watchStatus===xe.PAUSED)return console.log("[realtime] initWatch cancelled on pause"),t();this.watchStatus=xe.INITING;const n={watchId:this.watchId,requestId:Te(),msgType:"INIT_WATCH",msgData:{envId:r,collName:this.collectionName,query:this.query,limit:this.limit,orderBy:this.orderBy}},i=await this.send({msg:n,waitResponse:!0,skipOnMessage:!0,timeout:1e4}),{events:o,currEvent:s}=i.msgData;if(this.sessionInfo={queryID:i.msgData.queryID,currentEventId:s-1,currentDocs:[]},o.length>0){for(const e of o)e.ID=s;this.handleServerEvents(i)}else{this.sessionInfo.currentEventId=s;const e=new $e({id:s,docChanges:[],docs:[],type:"init"});this.listener.onChange(e),this.scheduleSendACK()}this.onWatchStart(this,this.sessionInfo.queryID),this.watchStatus=xe.ACTIVE,this._availableRetries.INIT_WATCH=2,t()}catch(e){this.handleWatchEstablishmentError(e,{operationName:"INIT_WATCH",resolve:t,reject:r})}});let t=!1;try{await this._initWatchPromise,t=!0}finally{this._initWatchPromise=void 0}console.log("[realtime] initWatch "+(t?"success":"fail"))},this.rebuildWatch=async e=>{if(this._rebuildWatchPromise)return this._rebuildWatchPromise;this._rebuildWatchPromise=new Promise(async(t,r)=>{try{if(this.watchStatus===xe.PAUSED)return console.log("[realtime] rebuildWatch cancelled on pause"),t();const{envId:r}=await this._login(this.envId,e);if(!this.sessionInfo)throw new Error("can not rebuildWatch without a successful initWatch (lack of sessionInfo)");if(this.watchStatus===xe.PAUSED)return console.log("[realtime] rebuildWatch cancelled on pause"),t();this.watchStatus=xe.REBUILDING;const n={watchId:this.watchId,requestId:Te(),msgType:"REBUILD_WATCH",msgData:{envId:r,collName:this.collectionName,queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},i=await this.send({msg:n,waitResponse:!0,skipOnMessage:!1,timeout:1e4});this.handleServerEvents(i),this.watchStatus=xe.ACTIVE,this._availableRetries.REBUILD_WATCH=2,t()}catch(e){this.handleWatchEstablishmentError(e,{operationName:"REBUILD_WATCH",resolve:t,reject:r})}});let t=!1;try{await this._rebuildWatchPromise,t=!0}finally{this._rebuildWatchPromise=void 0}console.log("[realtime] rebuildWatch "+(t?"success":"fail"))},this.handleWatchEstablishmentError=async(e,t)=>{const r="INIT_WATCH"===t.operationName,n=()=>{this.closeWithError(new Be({errCode:r?Ie.SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:Ie.SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL,errMsg:e})),t.reject(e)},i=e=>{this.useRetryTicket(t.operationName)?r?(this._initWatchPromise=void 0,t.resolve(this.initWatch(e))):(this._rebuildWatchPromise=void 0,t.resolve(this.rebuildWatch(e))):n()};this.handleCommonError(e,{onSignError:()=>i(!0),onTimeoutError:()=>i(!1),onNotRetryableError:n,onCancelledError:t.reject,onUnknownError:async()=>{try{const e=async()=>{this.pause(),await this.onceWSConnected(),i(!0)};this.isWSConnected()?(await Ce(100),this.watchStatus===xe.PAUSED?t.reject(new De(t.operationName+" cancelled due to pause after unknownError")):this.isWSConnected()?i(!1):await e()):await e()}catch(e){i(!0)}}})},this.closeWatch=async()=>{const e=this.sessionInfo?this.sessionInfo.queryID:"";if(this.watchStatus!==xe.ACTIVE)return this.watchStatus=xe.CLOSED,void this.onWatchClose(this,e);try{this.watchStatus=xe.CLOSING;const t={watchId:this.watchId,requestId:Te(),msgType:"CLOSE_WATCH",msgData:null};await this.send({msg:t}),this.sessionInfo=void 0,this.watchStatus=xe.CLOSED}catch(e){this.closeWithError(new Be({errCode:Ie.SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL,errMsg:e}))}finally{this.onWatchClose(this,e)}},this.scheduleSendACK=()=>{this.clearACKSchedule(),this._ackTimeoutId=setTimeout(()=>{this._waitExpectedTimeoutId?this.scheduleSendACK():this.sendACK()},1e4)},this.clearACKSchedule=()=>{this._ackTimeoutId&&clearTimeout(this._ackTimeoutId)},this.sendACK=async()=>{try{if(this.watchStatus!==xe.ACTIVE)return void this.scheduleSendACK();if(!this.sessionInfo)return void console.warn("[realtime listener] can not send ack without a successful initWatch (lack of sessionInfo)");const e={watchId:this.watchId,requestId:Te(),msgType:"CHECK_LAST",msgData:{queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}};await this.send({msg:e}),this.scheduleSendACK()}catch(e){if(Le(e)){const t=e.payload;switch(t.msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return void this.rebuildWatch();case"QUERYID_INVALID_ERROR":case"SYS_ERR":case"INVALIID_ENV":case"COLLECTION_PERMISSION_DENIED":return void this.closeWithError(new Be({errCode:Ie.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:t.msgData.code}))}}this._availableRetries.CHECK_LAST&&this._availableRetries.CHECK_LAST>0?(this._availableRetries.CHECK_LAST--,this.scheduleSendACK()):this.closeWithError(new Be({errCode:Ie.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:e}))}},this.handleCommonError=(e,t)=>{if(Le(e)){switch(e.payload.msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return void t.onSignError(e);case"QUERYID_INVALID_ERROR":case"SYS_ERR":case"INVALIID_ENV":case"COLLECTION_PERMISSION_DENIED":default:return void t.onNotRetryableError(e)}}else{if((e=>"timeout"===e.type)(e))return void t.onTimeoutError(e);if((e=>"cancelled"===e.type)(e))return void t.onCancelledError(e)}t.onUnknownError(e)},this.watchId=`watchid_${+new Date}_${Math.random()}`,this.envId=e.envId,this.collectionName=e.collectionName,this.query=e.query,this.limit=e.limit,this.orderBy=e.orderBy,this.send=e.send,this.login=e.login,this.isWSConnected=e.isWSConnected,this.onceWSConnected=e.onceWSConnected,this.getWaitExpectedTimeoutLength=e.getWaitExpectedTimeoutLength,this.onWatchStart=e.onWatchStart,this.onWatchClose=e.onWatchClose,this.debug=e.debug,this._availableRetries={INIT_WATCH:2,REBUILD_WATCH:2,CHECK_LAST:2},this.listener=new Pe({close:this.closeWatch,onChange:e.onChange,onError:e.onError,debug:this.debug,virtualClient:this}),this.initWatch()}useRetryTicket(e){return!!(this._availableRetries[e]&&this._availableRetries[e]>0)&&(this._availableRetries[e]--,console.log(`[realtime] ${e} use a retry ticket, now only ${this._availableRetries[e]} retry left`),!0)}async handleServerEvents(e){try{this.scheduleSendACK(),await this._handleServerEvents(e),this._postHandleServerEventsValidityCheck(e)}catch(e){throw console.error("[realtime listener] internal non-fatal error: handle server events failed with error: ",e),e}}async _handleServerEvents(e){const{requestId:t}=e,{events:r}=e.msgData,{msgType:n}=e;if(!r.length||!this.sessionInfo)return;const i=this.sessionInfo;let o;try{o=r.map(Ue)}catch(e){return void this.closeWithError(new Be({errCode:Ie.SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA,errMsg:e}))}let s=[...i.currentDocs],a=!1;for(let r=0,u=o.length;r<u;r++){const c=o[r];if(i.currentEventId>=c.id)!o[r-1]||c.id>o[r-1].id?console.warn(`[realtime] duplicate event received, cur ${i.currentEventId} but got ${c.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 ${t})`);else{if(i.currentEventId!==c.id-1)return console.warn(`[realtime listener] event received is out of order, cur ${this.sessionInfo.currentEventId} but got ${c.id}`),void await this.rebuildWatch();switch(c.dataType){case"update":if(!c.doc)switch(c.queueType){case"update":case"dequeue":{const e=s.find(e=>e._id===c.docId);if(e){const t=Oe()(e);if(c.updatedFields)for(const e in c.updatedFields)ve()(t,e,c.updatedFields[e]);if(c.removedFields)for(const e of c.removedFields)Ae()(t,e);c.doc=t}else console.error("[realtime listener] internal non-fatal server error: unexpected update dataType event where no doc is associated.");break}case"enqueue":{const t=new Be({errCode:Ie.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:`HandleServerEvents: full doc is not provided with dataType="update" and queueType="enqueue" (requestId ${e.requestId})`});throw this.closeWithError(t),t}}break;case"replace":if(!c.doc){const t=new Be({errCode:Ie.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:`HandleServerEvents: full doc is not provided with dataType="replace" (requestId ${e.requestId})`});throw this.closeWithError(t),t}break;case"remove":{const e=s.find(e=>e._id===c.docId);e?c.doc=e:console.error("[realtime listener] internal non-fatal server error: unexpected remove event where no doc is associated.");break}case"limit":if(!c.doc)switch(c.queueType){case"dequeue":{const e=s.find(e=>e._id===c.docId);e?c.doc=e:console.error("[realtime listener] internal non-fatal server error: unexpected limit dataType event where no doc is associated.");break}case"enqueue":{const t=new Be({errCode:Ie.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:`HandleServerEvents: full doc is not provided with dataType="limit" and queueType="enqueue" (requestId ${e.requestId})`});throw this.closeWithError(t),t}}}switch(c.queueType){case"init":a?s.push(c.doc):(a=!0,s=[c.doc]);break;case"enqueue":s.push(c.doc);break;case"dequeue":{const e=s.findIndex(e=>e._id===c.docId);e>-1?s.splice(e,1):console.error("[realtime listener] internal non-fatal server error: unexpected dequeue event where no doc is associated.");break}case"update":{const e=s.findIndex(e=>e._id===c.docId);e>-1?s[e]=c.doc:console.error("[realtime listener] internal non-fatal server error: unexpected queueType update event where no doc is associated.");break}}if(r===u-1||o[r+1]&&o[r+1].id!==c.id){const e=[...s],t=o.slice(0,r+1).filter(e=>e.id===c.id);this.sessionInfo.currentEventId=c.id,this.sessionInfo.currentDocs=s;const i=new $e({id:c.id,docChanges:t,docs:e,msgType:n});this.listener.onChange(i)}}}}_postHandleServerEventsValidityCheck(e){this.sessionInfo?(this.sessionInfo.expectEventId&&this.sessionInfo.currentEventId>=this.sessionInfo.expectEventId&&this.clearWaitExpectedEvent(),this.sessionInfo.currentEventId<e.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")}clearWaitExpectedEvent(){this._waitExpectedTimeoutId&&(clearTimeout(this._waitExpectedTimeoutId),this._waitExpectedTimeoutId=void 0)}onMessage(e){switch(this.watchStatus){case xe.PAUSED:if("ERROR"!==e.msgType)return;break;case xe.LOGGINGIN:case xe.INITING:case xe.REBUILDING:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received while "+this.watchStatus);case xe.CLOSED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has closed");case xe.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(),e.msgType){case"NEXT_EVENT":console.warn(`nextevent ${e.msgData.currEvent} ignored`,e),this.handleServerEvents(e);break;case"CHECK_EVENT":this.sessionInfo.currentEventId<e.msgData.currEvent&&(this.sessionInfo.expectEventId=e.msgData.currEvent,this.clearWaitExpectedEvent(),this._waitExpectedTimeoutId=setTimeout(()=>{this.rebuildWatch()},this.getWaitExpectedTimeoutLength()),console.log("[realtime] waitExpectedTimeoutLength "+this.getWaitExpectedTimeoutLength()));break;case"ERROR":this.closeWithError(new Be({errCode:Ie.SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG,errMsg:`${e.msgData.code} - ${e.msgData.message}`}));break;default:console.warn(`[realtime listener] virtual client receive unexpected msg ${e.msgType}: `,e)}else console.warn("[realtime listener] internal non-fatal error: sessionInfo not found while message is received.")}closeWithError(e){this.watchStatus=xe.ERRORED,this.clearACKSchedule(),this.listener.onError(e),this.onWatchClose(this,this.sessionInfo&&this.sessionInfo.queryID||""),console.log(`[realtime] client closed (${this.collectionName} ${this.query}) (watchId ${this.watchId})`)}pause(){this.watchStatus=xe.PAUSED,console.log(`[realtime] client paused (${this.collectionName} ${this.query}) (watchId ${this.watchId})`)}async resume(){this.watchStatus=xe.RESUMING,console.log(`[realtime] client resuming with ${this.sessionInfo?"REBUILD_WATCH":"INIT_WATCH"} (${this.collectionName} ${this.query}) (${this.watchId})`);try{await(this.sessionInfo?this.rebuildWatch():this.initWatch()),console.log(`[realtime] client successfully resumed (${this.collectionName} ${this.query}) (${this.watchId})`)}catch(e){console.error(`[realtime] client resume failed (${this.collectionName} ${this.query}) (${this.watchId})`,e)}}}function Ue(e){const t={id:e.ID,dataType:e.DataType,queueType:e.QueueType,docId:e.DocID,doc:e.Doc&&"{}"!==e.Doc?JSON.parse(e.Doc):void 0};return"update"===e.DataType&&(e.UpdatedFields&&(t.updatedFields=JSON.parse(e.UpdatedFields)),(e.removedFields||e.RemovedFields)&&(t.removedFields=JSON.parse(e.removedFields))),t}const ke={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"}};var qe;!function(e){e[e.NormalClosure=1e3]="NormalClosure",e[e.GoingAway=1001]="GoingAway",e[e.ProtocolError=1002]="ProtocolError",e[e.UnsupportedData=1003]="UnsupportedData",e[e.NoStatusReceived=1005]="NoStatusReceived",e[e.AbnormalClosure=1006]="AbnormalClosure",e[e.InvalidFramePayloadData=1007]="InvalidFramePayloadData",e[e.PolicyViolation=1008]="PolicyViolation",e[e.MessageTooBig=1009]="MessageTooBig",e[e.MissingExtension=1010]="MissingExtension",e[e.InternalError=1011]="InternalError",e[e.ServiceRestart=1012]="ServiceRestart",e[e.TryAgainLater=1013]="TryAgainLater",e[e.BadGateway=1014]="BadGateway",e[e.TLSHandshake=1015]="TLSHandshake",e[e.ReconnectWebSocket=3e3]="ReconnectWebSocket",e[e.NoRealtimeListeners=3001]="NoRealtimeListeners",e[e.HeartbeatPingError=3002]="HeartbeatPingError",e[e.HeartbeatPongTimeoutError=3003]="HeartbeatPongTimeoutError",e[e.NoAuthentication=3050]="NoAuthentication"}(qe||(qe={}));const Fe=(e,t)=>{const r=ke[e],n=r?`${r.name}, code ${e}, reason ${t||r.description}`:"code "+e;return new Be({errCode:Ie.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED,errMsg:n})},ze=1;class We{constructor(e){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.initWebSocketConnection=async(e,t=this._maxReconnect)=>{if(!e||!this._reconnectState){if(e&&(this._reconnectState=!0),this._wsInitPromise)return this._wsInitPromise;e&&this.pauseClients(),this.close(qe.ReconnectWebSocket),this._wsInitPromise=new Promise(async(r,n)=>{try{const t=await this.getWsSign();await new Promise(e=>{const r=t.wsUrl||"wss://tcb-ws.tencentcloudapi.com";this._ws=ft.wsClass?new ft.wsClass(r):new WebSocket(r),e()}),this._ws.connect&&await this._ws.connect(),await this.initWebSocketEvent(),r(),e&&(this.resumeClients(),this._reconnectState=!1)}catch(i){if(console.error("[realtime] initWebSocketConnection connect fail",i),t>0){const n=!0;this._wsInitPromise=void 0,n&&(await Ce(this._reconnectInterval),e&&(this._reconnectState=!1)),r(this.initWebSocketConnection(e,t-1))}else n(i),e&&this.closeAllClients(new Be({errCode:Ie.SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL,errMsg:i}))}});try{await this._wsInitPromise,this._wsReadySubsribers.forEach(({resolve:e})=>e())}catch(e){this._wsReadySubsribers.forEach(({reject:e})=>e())}finally{this._wsInitPromise=void 0,this._wsReadySubsribers=[]}}},this.initWebSocketEvent=()=>new Promise((e,t)=>{if(!this._ws)throw new Error("can not initWebSocketEvent, ws not exists");let r=!1;this._ws.onopen=t=>{console.warn("[realtime] ws event: open",t),r=!0,e()},this._ws.onerror=e=>{this._logins=new Map,r?(console.error("[realtime] ws event: error",e),this.clearHeartbeat(),this._virtualWSClient.forEach(t=>t.closeWithError(new Be({errCode:Ie.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR,errMsg:e})))):(console.error("[realtime] ws open failed with ws event: error",e),t(e))},this._ws.onclose=e=>{switch(console.warn("[realtime] ws event: close",e),this._logins=new Map,this.clearHeartbeat(),e.code){case qe.ReconnectWebSocket:case qe.NoRealtimeListeners:break;case qe.HeartbeatPingError:case qe.HeartbeatPongTimeoutError:case qe.NormalClosure:case qe.AbnormalClosure:this._maxReconnect>0?this.initWebSocketConnection(!0,this._maxReconnect):this.closeAllClients(Fe(e.code));break;case qe.NoAuthentication:this.closeAllClients(Fe(e.code,e.reason));break;default:this._maxReconnect>0?this.initWebSocketConnection(!0,this._maxReconnect):this.closeAllClients(Fe(e.code))}},this._ws.onmessage=e=>{const t=e.data;let r;this.heartbeat();try{r=JSON.parse(t)}catch(e){throw new Error("[realtime] onMessage parse res.data error: "+e)}if("ERROR"===r.msgType){let e=null;this._virtualWSClient.forEach(t=>{t.watchId===r.watchId&&(e=t)}),e&&e.listener.onError(r)}const n=this._wsResponseWait.get(r.requestId);if(n){try{"ERROR"===r.msgType?n.reject(new Me(r)):n.resolve(r)}catch(e){console.error("ws onMessage responseWaitSpec.resolve(msg) errored:",e)}finally{this._wsResponseWait.delete(r.requestId)}if(n.skipOnMessage)return}if("PONG"===r.msgType){if(this._lastPingSendTS){const e=Date.now()-this._lastPingSendTS;if(e>1e4)return void console.warn("[realtime] untrusted rtt observed: "+e);this._rttObserved.length>=3&&this._rttObserved.splice(0,this._rttObserved.length-3+1),this._rttObserved.push(e)}return}let i=r.watchId&&this._watchIdClientMap.get(r.watchId);if(i)i.onMessage(r);else switch(console.error(`[realtime] no realtime listener found responsible for watchId ${r.watchId}: `,r),r.msgType){case"INIT_EVENT":case"NEXT_EVENT":case"CHECK_EVENT":i=this._queryIdClientMap.get(r.msgData.queryID),i&&i.onMessage(r);break;default:for(const[,e]of this._watchIdClientMap){e.onMessage(r);break}}},this.heartbeat()}),this.isWSConnected=()=>Boolean(this._ws&&this._ws.readyState===ze),this.onceWSConnected=async()=>{if(!this.isWSConnected())return this._wsInitPromise?this._wsInitPromise:new Promise((e,t)=>{this._wsReadySubsribers.push({resolve:e,reject:t})})},this.webLogin=async(e,t)=>{if(!t)if(e){const t=this._logins.get(e);if(t){if(t.loggedIn&&t.loginResult)return t.loginResult;if(t.loggingInPromise)return t.loggingInPromise}}else{const e=this._logins.get("");if(e&&e.loggingInPromise)return e.loggingInPromise}const r=new Promise(async(e,t)=>{try{const r=await this.getWsSign(),n={envId:r.envId||"",accessToken:"",referrer:"web",sdkVersion:"",dataVersion:ft.dataVersion||""},i={watchId:void 0,requestId:Te(),msgType:"LOGIN",msgData:n,exMsgData:{runtime:ft.runtime,signStr:r.signStr,secretVersion:r.secretVersion}},o=await this.send({msg:i,waitResponse:!0,skipOnMessage:!0,timeout:5e3});o.msgData.code?t(new Error(`${o.msgData.code} ${o.msgData.message}`)):e({envId:r.envId})}catch(e){t(e)}});let n=e&&this._logins.get(e);const i=Date.now();n?(n.loggedIn=!1,n.loggingInPromise=r,n.loginStartTS=i):(n={loggedIn:!1,loggingInPromise:r,loginStartTS:i},this._logins.set(e||"",n));try{const t=await r,o=e&&this._logins.get(e);if(o&&o===n&&o.loginStartTS===i)return n.loggedIn=!0,n.loggingInPromise=void 0,n.loginStartTS=void 0,n.loginResult=t,t;if(o){if(o.loggedIn&&o.loginResult)return o.loginResult;if(o.loggingInPromise)return o.loggingInPromise;throw new Error("ws unexpected login info")}throw new Error("ws login info reset")}catch(e){throw n.loggedIn=!1,n.loggingInPromise=void 0,n.loginStartTS=void 0,n.loginResult=void 0,e}},this.getWsSign=async()=>{if(this._wsSign&&this._wsSign.expiredTs>Date.now())return this._wsSign;const e=Date.now()+6e4,t=await this._context.appConfig.request.send("auth.wsWebSign",{runtime:ft.runtime});if(t.code)throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败: "+t.code);if(t.data){const{signStr:r,wsUrl:n,secretVersion:i,envId:o}=t.data;return{signStr:r,wsUrl:n,secretVersion:i,envId:o,expiredTs:e}}throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败")},this.getWaitExpectedTimeoutLength=()=>this._rttObserved.length?this._rttObserved.reduce((e,t)=>e+t)/this._rttObserved.length*1.5:5e3,this.ping=async()=>{const e={watchId:void 0,requestId:Te(),msgType:"PING",msgData:null};await this.send({msg:e})},this.send=async e=>new Promise(async(t,r)=>{let n,i=!1,o=!1;const s=e=>{i=!0,n&&clearTimeout(n),t(e)},a=e=>{o=!0,n&&clearTimeout(n),r(e)};e.timeout&&(n=setTimeout(async()=>{i&&o||(await Ce(0),i&&o||a(new Re("wsclient.send timedout")))},e.timeout));try{if(this._wsInitPromise&&await this._wsInitPromise,!this._ws)return void a(new Error("invalid state: ws connection not exists, can not send message"));if(this._ws.readyState!==ze)return void a(new Error(`ws readyState invalid: ${this._ws.readyState}, can not send message`));e.waitResponse&&this._wsResponseWait.set(e.msg.requestId,{resolve:s,reject:a,skipOnMessage:e.skipOnMessage});try{await this._ws.send(JSON.stringify(e.msg)),e.waitResponse||s()}catch(t){t&&(a(t),e.waitResponse&&this._wsResponseWait.delete(e.msg.requestId))}}catch(e){a(e)}}),this.closeAllClients=e=>{this._virtualWSClient.forEach(t=>{t.closeWithError(e)})},this.pauseClients=e=>{(e||this._virtualWSClient).forEach(e=>{e.pause()})},this.resumeClients=e=>{(e||this._virtualWSClient).forEach(e=>{e.resume()})},this.onWatchStart=(e,t)=>{this._queryIdClientMap.set(t,e)},this.onWatchClose=(e,t)=>{t&&this._queryIdClientMap.delete(t),this._watchIdClientMap.delete(e.watchId),this._virtualWSClient.delete(e),this._virtualWSClient.size||this.close(qe.NoRealtimeListeners)},this._maxReconnect=e.maxReconnect||5,this._reconnectInterval=e.reconnectInterval||1e4,this._context=e.context}heartbeat(e){this.clearHeartbeat(),this._pingTimeoutId=setTimeout(async()=>{try{if(!this._ws||this._ws.readyState!==ze)return;this._lastPingSendTS=Date.now(),await this.ping(),this._pingFailed=0,this._pongTimeoutId=setTimeout(()=>{console.error("pong timed out"),this._pongMissed<2?(this._pongMissed++,this.heartbeat(!0)):this.initWebSocketConnection(!0)},this._context.appConfig.realtimePongWaitTimeout)}catch(e){this._pingFailed<2?(this._pingFailed++,this.heartbeat()):this.close(qe.HeartbeatPingError)}},e?0:this._context.appConfig.realtimePingInterval)}clearHeartbeat(){this._pingTimeoutId&&clearTimeout(this._pingTimeoutId),this._pongTimeoutId&&clearTimeout(this._pongTimeoutId)}close(e){this.clearHeartbeat(),this._ws&&(this._ws.close(e,ke[e].name),this._ws=void 0)}watch(e){this._ws||this._wsInitPromise||this.initWebSocketConnection(!1);const t=new je(Object.assign(Object.assign({},e),{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(t),this._watchIdClientMap.set(t.watchId,t),t.listener}}class Ye{constructor(e,t,r,n={}){this.watch=e=>(ft.ws||(ft.ws=new We({context:{appConfig:{docSizeLimit:1e3,realtimePingInterval:1e4,realtimePongWaitTimeout:5e3,request:this.request}}})),ft.ws.watch(Object.assign(Object.assign({},e),{envId:this._db.config.env,collectionName:this._coll,query:JSON.stringify({_id:this.id})}))),this._db=e,this._coll=t,this.id=r,this.request=new ft.reqClass(this._db.config),this.projection=n}create(e,t){t=t||te();let r={collectionName:this._coll,data:pe(e)};return this.id&&(r._id=this.id),this.request.send("database.addDocument",r).then(e=>{e.code?t(0,e):t(0,{id:e.data._id,requestId:e.requestId})}).catch(e=>{t(e)}),t.promise}set(e,t){if(t=t||te(),!this.id)return Promise.resolve({code:"INVALID_PARAM",message:"docId不能为空"});if(!e||"object"!=typeof e)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(e.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});let r=!1;const n=e=>{if("object"==typeof e)for(let t in e)e[t]instanceof ne?r=!0:"object"==typeof e[t]&&n(e[t])};if(n(e),r)return Promise.resolve({code:"DATABASE_REQUEST_FAILED",message:"update operator complicit"});let i={collectionName:this._coll,queryType:w.DOC,data:pe(e),multi:!1,merge:!1,upsert:!0};return this.id&&(i.query={_id:this.id}),this.request.send("database.updateDocument",i).then(e=>{e.code?t(0,e):t(0,{updated:e.data.updated,upsertedId:e.data.upserted_id,requestId:e.requestId})}).catch(e=>{t(e)}),t.promise}update(e,t){if(t=t||te(),!e||"object"!=typeof e)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(e.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});const r={_id:this.id},n={collectionName:this._coll,data:we.encode(e),query:r,queryType:w.DOC,multi:!1,merge:!0,upsert:!1};return this.request.send("database.updateDocument",n).then(e=>{e.code?t(0,e):t(0,{updated:e.data.updated,upsertedId:e.data.upserted_id,requestId:e.requestId})}).catch(e=>{t(e)}),t.promise}remove(e){e=e||te();const t={_id:this.id},r={collectionName:this._coll,query:t,queryType:w.DOC,multi:!1};return this.request.send("database.deleteDocument",r).then(t=>{t.code?e(0,t):e(0,{deleted:t.data.deleted,requestId:t.requestId})}).catch(t=>{e(t)}),e.promise}get(e){e=e||te();const t={_id:this.id},r={collectionName:this._coll,query:t,queryType:w.DOC,multi:!1,projection:this.projection};return this.request.send("database.queryDocument",r).then(t=>{if(t.code)e(0,t);else{const r=U.formatResDocumentData(t.data.list);e(0,{data:r,requestId:t.requestId,total:t.TotalCount,limit:t.Limit,offset:t.Offset})}}).catch(t=>{e(t)}),e.promise}field(e){for(let t in e)e[t]?e[t]=1:e[t]=0;return new Ye(this._db,this._coll,this.id,e)}}class Ke{constructor(){}static encode(e){return(new He).encodeQuery(e)}}class He{encodeQuery(e,t){return me(e)?ae(e)?this.encodeLogicCommand(e):le(e)?this.encodeQueryCommand(e):{[t]:this.encodeQueryObject(e)}:F(e)?this.encodeQueryObject(e):e}encodeRegExp(e){return{$regex:e.source,$options:e.flags}}encodeLogicCommand(e){switch(e.operator){case oe.NOR:case oe.AND:case oe.OR:return{[de(e.operator)]:e.operands.map(t=>this.encodeQuery(t,e.fieldName))};case oe.NOT:{const t=de(e.operator),r=e.operands[0];if(H(r))return{[e.fieldName]:{[t]:this.encodeRegExp(r)}};{const n=this.encodeQuery(r)[e.fieldName];return{[e.fieldName]:{[t]:n}}}}default:{const t=de(e.operator);if(1===e.operands.length){return{[t]:this.encodeQuery(e.operands[0])}}return{[t]:e.operands.map(this.encodeQuery.bind(this))}}}}encodeQueryCommand(e){return fe(e),this.encodeComparisonCommand(e)}encodeComparisonCommand(e){if(e.fieldName===N)throw new Error("Cannot encode a comparison command with unset field name");const t=de(e.operator);switch(e.operator){case ue.EQ:case ue.NEQ:case ue.LT:case ue.LTE:case ue.GT:case ue.GTE:case ue.ELEM_MATCH:case ue.EXISTS:case ue.SIZE:case ue.MOD:return{[e.fieldName]:{[t]:be(e.operands[0])}};case ue.IN:case ue.NIN:case ue.ALL:return{[e.fieldName]:{[t]:be(e.operands)}};case ue.GEO_NEAR:{const t=e.operands[0];return{[e.fieldName]:{$nearSphere:{$geometry:t.geometry.toJSON(),$maxDistance:t.maxDistance,$minDistance:t.minDistance}}}}case ue.GEO_WITHIN:{const t=e.operands[0];return{[e.fieldName]:{$geoWithin:{$geometry:t.geometry.toJSON()}}}}case ue.GEO_INTERSECTS:{const t=e.operands[0];return{[e.fieldName]:{$geoIntersects:{$geometry:t.geometry.toJSON()}}}}default:return{[e.fieldName]:{[t]:be(e.operands[0])}}}}encodeQueryObject(e){const t=ge(e);for(const e in t){const r=t[e];if(ae(r)){t[e]=r._setFieldName(e);const n=this.encodeLogicCommand(t[e]);this.mergeConditionAfterEncode(t,n,e)}else if(fe(r)){t[e]=r._setFieldName(e);const n=this.encodeComparisonCommand(t[e]);this.mergeConditionAfterEncode(t,n,e)}else me(r)&&(t[e]=be(r))}return t}mergeConditionAfterEncode(e,t,r){t[r]||delete e[r];for(const n in t)e[n]?Y(e[n])?e[n]=e[n].concat(t[n]):F(e[n])?F(t[n])?Object.assign(e,t):(console.warn(`unmergable condition, query is object but condition is ${q(t)}, can only overwrite`,t,r),e[n]=t[n]):(console.warn(`to-merge query is of type ${q(e)}, can only overwrite`,e,t,r),e[n]=t[n]):e[n]=t[n]}}class Ge{constructor(e,t,r,n,i){this.watch=e=>(ft.ws||(ft.ws=new We({context:{appConfig:{docSizeLimit:1e3,realtimePingInterval:1e4,realtimePongWaitTimeout:5e3,request:this._request}}})),ft.ws.watch(Object.assign(Object.assign({},e),{envId:this._db.config.env,collectionName:this._coll,query:JSON.stringify(this._fieldFilters),limit:this._queryOptions.limit,orderBy:this._fieldOrders?this._fieldOrders.reduce((e,t)=>(e[t.field]=t.direction,e),{}):void 0}))),this._db=e,this._coll=t,this._fieldFilters=r,this._fieldOrders=n||[],this._queryOptions=i||{},this._request=new ft.reqClass(this._db.config)}get(e){e=e||te();let t=[];this._fieldOrders&&this._fieldOrders.forEach(e=>{t.push(e)});let r={collectionName:this._coll,queryType:w.WHERE};return this._fieldFilters&&(r.query=this._fieldFilters),t.length>0&&(r.order=t),this._queryOptions.offset&&(r.offset=this._queryOptions.offset),this._queryOptions.limit?r.limit=this._queryOptions.limit<1e3?this._queryOptions.limit:1e3:r.limit=100,this._queryOptions.projection&&(r.projection=this._queryOptions.projection),this._request.send("database.queryDocument",r).then(t=>{if(t.code)e(0,t);else{const r={data:U.formatResDocumentData(t.data.list),requestId:t.requestId};t.TotalCount&&(r.total=t.TotalCount),t.Limit&&(r.limit=t.Limit),t.Offset&&(r.offset=t.Offset),e(0,r)}}).catch(t=>{e(t)}),e.promise}count(e){e=e||te();let t={collectionName:this._coll,queryType:w.WHERE};return this._fieldFilters&&(t.query=this._fieldFilters),this._request.send("database.countDocument",t).then(t=>{t.code?e(0,t):e(0,{requestId:t.requestId,total:t.data.total})}),e.promise}where(e){if("Object"!==Object.prototype.toString.call(e).slice(8,-1))throw Error(n.QueryParamTypeError);const t=Object.keys(e),r=t.some(t=>void 0!==e[t]);if(t.length&&!r)throw Error(n.QueryParamValueError);return new Ge(this._db,this._coll,Ke.encode(e),this._fieldOrders,this._queryOptions)}orderBy(e,t){k.isFieldPath(e),k.isFieldOrder(t);const r={field:e,direction:t},n=this._fieldOrders.concat(r);return new Ge(this._db,this._coll,this._fieldFilters,n,this._queryOptions)}limit(e){k.isInteger("limit",e);let t=Object.assign({},this._queryOptions);return t.limit=e,new Ge(this._db,this._coll,this._fieldFilters,this._fieldOrders,t)}skip(e){k.isInteger("offset",e);let t=Object.assign({},this._queryOptions);return t.offset=e,new Ge(this._db,this._coll,this._fieldFilters,this._fieldOrders,t)}update(e,t){if(t=t||te(),!e||"object"!=typeof e)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(e.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});let r={collectionName:this._coll,query:this._fieldFilters,queryType:w.WHERE,multi:!0,merge:!0,upsert:!1,data:we.encode(e)};return this._request.send("database.updateDocument",r).then(e=>{e.code?t(0,e):t(0,{requestId:e.requestId,updated:e.data.updated,upsertId:e.data.upsert_id})}),t.promise}field(e){for(let t in e)e[t]?"object"!=typeof e[t]&&(e[t]=1):e[t]=0;let t=Object.assign({},this._queryOptions);return t.projection=e,new Ge(this._db,this._coll,this._fieldFilters,this._fieldOrders,t)}remove(e){e=e||te(),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");const t={collectionName:this._coll,query:Ke.encode(this._fieldFilters),queryType:w.WHERE,multi:!0};return this._request.send("database.deleteDocument",t).then(t=>{t.code?e(0,t):e(0,{requestId:t.requestId,deleted:t.data.deleted})}),e.promise}}var Je=r(0);class Ve{constructor(e,t){this._stages=[],e&&t&&(this._db=e,this._request=new ft.reqClass(this._db.config),this._collectionName=t)}async end(){if(!this._collectionName||!this._db)throw new Error("Aggregation pipeline cannot send request");const e=await this._request.send("database.aggregate",{collectionName:this._collectionName,stages:this._stages});return e&&e.data&&e.data.list?{requestId:e.requestId,data:JSON.parse(e.data.list).map(Je.a.parse)}:e}unwrap(){return this._stages}done(){return this._stages.map(({stageKey:e,stageValue:t})=>({[e]:JSON.parse(t)}))}_pipe(e,t){return this._stages.push({stageKey:"$"+e,stageValue:JSON.stringify(t)}),this}addFields(e){return this._pipe("addFields",e)}bucket(e){return this._pipe("bucket",e)}bucketAuto(e){return this._pipe("bucketAuto",e)}count(e){return this._pipe("count",e)}geoNear(e){return this._pipe("geoNear",e)}group(e){return this._pipe("group",e)}limit(e){return this._pipe("limit",e)}match(e){return this._pipe("match",Ke.encode(e))}project(e){return this._pipe("project",e)}lookup(e){return this._pipe("lookup",e)}replaceRoot(e){return this._pipe("replaceRoot",e)}sample(e){return this._pipe("sample",e)}skip(e){return this._pipe("skip",e)}sort(e){return this._pipe("sort",e)}sortByCount(e){return this._pipe("sortByCount",e)}unwind(e){return this._pipe("unwind",e)}}class Xe extends Ge{constructor(e,t){super(e,t)}get name(){return this._coll}doc(e){if("string"!=typeof e&&"number"!=typeof e)throw new Error("docId必须为字符串或数字");return new Ye(this._db,this._coll,e)}add(e,t){return new Ye(this._db,this._coll,void 0).create(e,t)}aggregate(){return new Ve(this._db,this._coll)}}const Qe={eq:e=>new ce(ue.EQ,[e]),neq:e=>new ce(ue.NEQ,[e]),lt:e=>new ce(ue.LT,[e]),lte:e=>new ce(ue.LTE,[e]),gt:e=>new ce(ue.GT,[e]),gte:e=>new ce(ue.GTE,[e]),in:e=>new ce(ue.IN,e),nin:e=>new ce(ue.NIN,e),all:e=>new ce(ue.ALL,e),elemMatch:e=>new ce(ue.ELEM_MATCH,[e]),exists:e=>new ce(ue.EXISTS,[e]),size:e=>new ce(ue.SIZE,[e]),mod:e=>new ce(ue.MOD,[e]),geoNear:e=>new ce(ue.GEO_NEAR,[e]),geoWithin:e=>new ce(ue.GEO_WITHIN,[e]),geoIntersects:e=>new ce(ue.GEO_INTERSECTS,[e]),and(...e){const t=Y(arguments[0])?arguments[0]:Array.from(arguments);return new se(oe.AND,t)},nor(...e){const t=Y(arguments[0])?arguments[0]:Array.from(arguments);return new se(oe.NOR,t)},or(...e){const t=Y(arguments[0])?arguments[0]:Array.from(arguments);return new se(oe.OR,t)},not(...e){const t=Y(arguments[0])?arguments[0]:Array.from(arguments);return new se(oe.NOT,t)},set:e=>new ne(re.SET,[e]),remove:()=>new ne(re.REMOVE,[]),inc:e=>new ne(re.INC,[e]),mul:e=>new ne(re.MUL,[e]),push(...e){let t;if(F(e[0])&&e[0].hasOwnProperty("each")){const r=e[0];t={$each:r.each,$position:r.position,$sort:r.sort,$slice:r.slice}}else t=Y(e[0])?e[0]:Array.from(e);return new ne(re.PUSH,t)},pull:e=>new ne(re.PULL,e),pullAll:e=>new ne(re.PULL_ALL,e),pop:()=>new ne(re.POP,[]),shift:()=>new ne(re.SHIFT,[]),unshift(...e){const t=Y(arguments[0])?arguments[0]:Array.from(arguments);return new ne(re.UNSHIFT,t)},addToSet:e=>new ne(re.ADD_TO_SET,e),rename:e=>new ne(re.RENAME,[e]),bit:e=>new ne(re.BIT,[e]),max:e=>new ne(re.MAX,[e]),min:e=>new ne(re.MIN,[e]),expr:e=>({$expr:e}),jsonSchema:e=>({$jsonSchema:e}),text:e=>z(e)?{$search:e.search}:{$search:e.search,$language:e.language,$caseSensitive:e.caseSensitive,$diacriticSensitive:e.diacriticSensitive},aggregate:{pipeline:()=>new Ve,abs:e=>new Ze("abs",e),add:e=>new Ze("add",e),ceil:e=>new Ze("ceil",e),divide:e=>new Ze("divide",e),exp:e=>new Ze("exp",e),floor:e=>new Ze("floor",e),ln:e=>new Ze("ln",e),log:e=>new Ze("log",e),log10:e=>new Ze("log10",e),mod:e=>new Ze("mod",e),multiply:e=>new Ze("multiply",e),pow:e=>new Ze("pow",e),sqrt:e=>new Ze("sqrt",e),subtract:e=>new Ze("subtract",e),trunc:e=>new Ze("trunc",e),arrayElemAt:e=>new Ze("arrayElemAt",e),arrayToObject:e=>new Ze("arrayToObject",e),concatArrays:e=>new Ze("concatArrays",e),filter:e=>new Ze("filter",e),in:e=>new Ze("in",e),indexOfArray:e=>new Ze("indexOfArray",e),isArray:e=>new Ze("isArray",e),map:e=>new Ze("map",e),range:e=>new Ze("range",e),reduce:e=>new Ze("reduce",e),reverseArray:e=>new Ze("reverseArray",e),size:e=>new Ze("size",e),slice:e=>new Ze("slice",e),zip:e=>new Ze("zip",e),and:e=>new Ze("and",e),not:e=>new Ze("not",e),or:e=>new Ze("or",e),cmp:e=>new Ze("cmp",e),eq:e=>new Ze("eq",e),gt:e=>new Ze("gt",e),gte:e=>new Ze("gte",e),lt:e=>new Ze("lt",e),lte:e=>new Ze("lte",e),neq:e=>new Ze("ne",e),cond:e=>new Ze("cond",e),ifNull:e=>new Ze("ifNull",e),switch:e=>new Ze("switch",e),dateFromParts:e=>new Ze("dateFromParts",e),dateFromString:e=>new Ze("dateFromString",e),dayOfMonth:e=>new Ze("dayOfMonth",e),dayOfWeek:e=>new Ze("dayOfWeek",e),dayOfYear:e=>new Ze("dayOfYear",e),isoDayOfWeek:e=>new Ze("isoDayOfWeek",e),isoWeek:e=>new Ze("isoWeek",e),isoWeekYear:e=>new Ze("isoWeekYear",e),millisecond:e=>new Ze("millisecond",e),minute:e=>new Ze("minute",e),month:e=>new Ze("month",e),second:e=>new Ze("second",e),hour:e=>new Ze("hour",e),week:e=>new Ze("week",e),year:e=>new Ze("year",e),literal:e=>new Ze("literal",e),mergeObjects:e=>new Ze("mergeObjects",e),objectToArray:e=>new Ze("objectToArray",e),allElementsTrue:e=>new Ze("allElementsTrue",e),anyElementTrue:e=>new Ze("anyElementTrue",e),setDifference:e=>new Ze("setDifference",e),setEquals:e=>new Ze("setEquals",e),setIntersection:e=>new Ze("setIntersection",e),setIsSubset:e=>new Ze("setIsSubset",e),setUnion:e=>new Ze("setUnion",e),concat:e=>new Ze("concat",e),dateToString:e=>new Ze("dateToString",e),indexOfBytes:e=>new Ze("indexOfBytes",e),indexOfCP:e=>new Ze("indexOfCP",e),split:e=>new Ze("split",e),strLenBytes:e=>new Ze("strLenBytes",e),strLenCP:e=>new Ze("strLenCP",e),strcasecmp:e=>new Ze("strcasecmp",e),substr:e=>new Ze("substr",e),substrBytes:e=>new Ze("substrBytes",e),substrCP:e=>new Ze("substrCP",e),toLower:e=>new Ze("toLower",e),toUpper:e=>new Ze("toUpper",e),meta:e=>new Ze("meta",e),addToSet:e=>new Ze("addToSet",e),avg:e=>new Ze("avg",e),first:e=>new Ze("first",e),last:e=>new Ze("last",e),max:e=>new Ze("max",e),min:e=>new Ze("min",e),push:e=>new Ze("push",e),stdDevPop:e=>new Ze("stdDevPop",e),stdDevSamp:e=>new Ze("stdDevSamp",e),sum:e=>new Ze("sum",e),let:e=>new Ze("let",e)},project:{slice:e=>new et("slice",e),elemMatch:e=>new et("elemMatch",e)}};class Ze{constructor(e,t){this["$"+e]=t}}class et{constructor(e,t){this["$"+e]=t}}class tt{constructor({regexp:e,options:t}){if(!e)throw new TypeError("regexp must be a string");this.$regex=e,this.$options=t}parse(){return{$regex:this.$regex,$options:this.$options}}get _internalType(){return L}}function rt(e){return new tt(e)}const nt={code:"INSERT_DOC_FAIL",message:"insert document failed"},it={code:"DATABASE_TRANSACTION_CONFLICT",message:"database transaction conflict"},ot="database.updateDocInTransaction";class st{constructor(e,t,r){this._coll=t,this.id=r,this._transaction=e,this._request=this._transaction.getRequestMethod(),this._transactionId=this._transaction.getTransactionId()}async create(e){let t={collectionName:this._coll,transactionId:this._transactionId,data:Je.a.stringify(pe(e),{relaxed:!1})};this.id&&(t._id=this.id);const r=await this._request.send("database.insertDocInTransaction",t);if(r.code)throw r;const n=Je.a.parse(r.inserted),i=Je.a.parse(r.ok);if(1==i&&1==n)return Object.assign(Object.assign({},r),{ok:i,inserted:n});throw new Error(nt.message)}async get(){const e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},t=await this._request.send("database.getInTransaction",e);if(t.code)throw t;return{data:"null"!==t.data?U.formatField(Je.a.parse(t.data)):Je.a.parse(t.data),requestId:t.requestId}}async set(e){const t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Je.a.stringify(pe(e),{relaxed:!1}),upsert:!0},r=await this._request.send(ot,t);if(r.code)throw r;return Object.assign(Object.assign({},r),{updated:Je.a.parse(r.updated),upserted:r.upserted?JSON.parse(r.upserted):null})}async update(e){const t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Je.a.stringify(we.encode(e),{relaxed:!1})},r=await this._request.send(ot,t);if(r.code)throw r;return Object.assign(Object.assign({},r),{updated:Je.a.parse(r.updated)})}async delete(){const e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},t=await this._request.send("database.deleteDocInTransaction",e);if(t.code)throw t;return Object.assign(Object.assign({},t),{deleted:Je.a.parse(t.deleted)})}}class at extends class{constructor(e,t){this._coll=t,this._transaction=e}}{constructor(e,t){super(e,t)}get name(){return this._coll}doc(e){if("string"!=typeof e&&"number"!=typeof e)throw new Error("docId必须为字符串或数字");return new st(this._transaction,this._coll,e)}add(e){let t;return void 0!==e._id&&(t=e._id),new st(this._transaction,this._coll,t).create(e)}}class ut{constructor(e){this._db=e,this._request=new ft.reqClass(this._db.config),this.aborted=!1,this.commited=!1,this.inited=!1}async init(){const e=await this._request.send("database.startTransaction");if(e.code)throw e;this.inited=!0,this._id=e.transactionId}collection(e){if(!e)throw new Error("Collection name is required");return new at(this,e)}getTransactionId(){return this._id}getRequestMethod(){return this._request}async commit(){const e={transactionId:this._id},t=await this._request.send("database.commitTransaction",e);if(t.code)throw t;return this.commited=!0,t}async rollback(e){const t={transactionId:this._id},r=await this._request.send("database.abortTransaction",t);if(r.code)throw r;return this.aborted=!0,this.abortReason=e,r}}async function ct(){const e=new ut(this);return await e.init(),e}async function lt(e,t=3){let r;try{r=new ut(this),await r.init();const t=await e(r);if(!0===r.aborted)throw r.abortReason;return await r.commit(),t}catch(n){if(!1===r.inited)throw n;const i=async e=>{if(!r.aborted&&!r.commited){try{await r.rollback()}catch(e){}throw e}if(!0===r.aborted)throw r.abortReason;throw e};if(t<=0&&await i(n),n&&n.code===it.code)return await lt.bind(this)(e,--t);await i(n)}}class ft{constructor(e){this.config=e,this.Geo=i,this.serverDate=j,this.command=Qe,this.RegExp=rt,this.startTransaction=ct,this.runTransaction=lt,this.logicCommand=se,this.updateCommand=ne,this.queryCommand=ce}collection(e){if(!e)throw new Error("Collection name is required");return new Xe(this,e)}createCollection(e){const t={collectionName:e};return new ft.reqClass(this.config).send("database.addCollection",t)}}}])}));
|