@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.
Files changed (332) hide show
  1. package/Dockerfile +15 -0
  2. package/README.md +1 -1
  3. package/_exmaple/assets/scripts/function/function.ts +99 -0
  4. package/_exmaple/assets/scripts/index.ts +99 -0
  5. package/_exmaple/assets/scripts/request.ts +11 -0
  6. package/_exmaple/index.html +15 -0
  7. package/_exmaple/package.json +33 -0
  8. package/_exmaple/tsconfig.json +71 -0
  9. package/_exmaple/typings.d.ts +0 -0
  10. package/_exmaple/webpack.config.js +42 -0
  11. package/cdnjs/1.0.0/cloudbase.auth.js +1 -0
  12. package/cdnjs/1.0.0/cloudbase.database.js +8 -0
  13. package/cdnjs/1.0.0/cloudbase.full.js +8 -0
  14. package/cdnjs/1.0.0/cloudbase.functions.js +1 -0
  15. package/cdnjs/1.0.0/cloudbase.js +1 -0
  16. package/cdnjs/1.0.0/cloudbase.storage.js +1 -0
  17. package/cdnjs/1.0.1/cloudbase.auth.js +1 -0
  18. package/cdnjs/1.0.1/cloudbase.database.js +8 -0
  19. package/cdnjs/1.0.1/cloudbase.full.js +8 -0
  20. package/cdnjs/1.0.1/cloudbase.functions.js +1 -0
  21. package/cdnjs/1.0.1/cloudbase.js +1 -0
  22. package/cdnjs/1.0.1/cloudbase.storage.js +1 -0
  23. package/cdnjs/1.0.2/cloudbase.auth.js +1 -0
  24. package/cdnjs/1.0.2/cloudbase.database.js +8 -0
  25. package/cdnjs/1.0.2/cloudbase.full.js +8 -0
  26. package/cdnjs/1.0.2/cloudbase.functions.js +1 -0
  27. package/cdnjs/1.0.2/cloudbase.js +1 -0
  28. package/cdnjs/1.0.2/cloudbase.storage.js +1 -0
  29. package/cdnjs/1.0.3/cloudbase.auth.js +1 -0
  30. package/cdnjs/1.0.3/cloudbase.database.js +8 -0
  31. package/cdnjs/1.0.3/cloudbase.full.js +8 -0
  32. package/cdnjs/1.0.3/cloudbase.functions.js +1 -0
  33. package/cdnjs/1.0.3/cloudbase.js +1 -0
  34. package/cdnjs/1.0.3/cloudbase.storage.js +1 -0
  35. package/cdnjs/1.0.4/cloudbase.auth.js +1 -0
  36. package/cdnjs/1.0.4/cloudbase.database.js +8 -0
  37. package/cdnjs/1.0.4/cloudbase.full.js +8 -0
  38. package/cdnjs/1.0.4/cloudbase.functions.js +1 -0
  39. package/cdnjs/1.0.4/cloudbase.js +1 -0
  40. package/cdnjs/1.0.4/cloudbase.storage.js +1 -0
  41. package/cdnjs/1.1.0/cloudbase.auth.js +1 -0
  42. package/cdnjs/1.1.0/cloudbase.database.js +8 -0
  43. package/cdnjs/1.1.0/cloudbase.full.js +8 -0
  44. package/cdnjs/1.1.0/cloudbase.functions.js +1 -0
  45. package/cdnjs/1.1.0/cloudbase.js +1 -0
  46. package/cdnjs/1.1.0/cloudbase.storage.js +1 -0
  47. package/cdnjs/1.1.1/cloudbase.auth.js +1 -0
  48. package/cdnjs/1.1.1/cloudbase.database.js +8 -0
  49. package/cdnjs/1.1.1/cloudbase.full.js +8 -0
  50. package/cdnjs/1.1.1/cloudbase.functions.js +1 -0
  51. package/cdnjs/1.1.1/cloudbase.js +1 -0
  52. package/cdnjs/1.1.1/cloudbase.storage.js +1 -0
  53. package/cdnjs/1.1.2/cloudbase.auth.js +1 -0
  54. package/cdnjs/1.1.2/cloudbase.database.js +8 -0
  55. package/cdnjs/1.1.2/cloudbase.full.js +8 -0
  56. package/cdnjs/1.1.2/cloudbase.functions.js +1 -0
  57. package/cdnjs/1.1.2/cloudbase.js +1 -0
  58. package/cdnjs/1.1.2/cloudbase.storage.js +1 -0
  59. package/cdnjs/1.1.3/cloudbase.auth.js +1 -0
  60. package/cdnjs/1.1.3/cloudbase.database.js +8 -0
  61. package/cdnjs/1.1.3/cloudbase.full.js +8 -0
  62. package/cdnjs/1.1.3/cloudbase.functions.js +1 -0
  63. package/cdnjs/1.1.3/cloudbase.js +1 -0
  64. package/cdnjs/1.1.3/cloudbase.storage.js +1 -0
  65. package/cdnjs/1.1.4/cloudbase.auth.js +1 -0
  66. package/cdnjs/1.1.4/cloudbase.database.js +8 -0
  67. package/cdnjs/1.1.4/cloudbase.full.js +8 -0
  68. package/cdnjs/1.1.4/cloudbase.functions.js +1 -0
  69. package/cdnjs/1.1.4/cloudbase.js +1 -0
  70. package/cdnjs/1.1.4/cloudbase.storage.js +1 -0
  71. package/cdnjs/1.2.1/cloudbase.auth.js +1 -0
  72. package/cdnjs/1.2.1/cloudbase.database.js +8 -0
  73. package/cdnjs/1.2.1/cloudbase.full.js +8 -0
  74. package/cdnjs/1.2.1/cloudbase.functions.js +1 -0
  75. package/cdnjs/1.2.1/cloudbase.js +1 -0
  76. package/cdnjs/1.2.1/cloudbase.storage.js +1 -0
  77. package/cdnjs/1.2.2/cloudbase.auth.js +1 -0
  78. package/cdnjs/1.2.2/cloudbase.database.js +8 -0
  79. package/cdnjs/1.2.2/cloudbase.full.js +8 -0
  80. package/cdnjs/1.2.2/cloudbase.functions.js +1 -0
  81. package/cdnjs/1.2.2/cloudbase.js +1 -0
  82. package/cdnjs/1.2.2/cloudbase.storage.js +1 -0
  83. package/cdnjs/1.2.3/cloudbase.auth.js +1 -0
  84. package/cdnjs/1.2.3/cloudbase.database.js +8 -0
  85. package/cdnjs/1.2.3/cloudbase.full.js +8 -0
  86. package/cdnjs/1.2.3/cloudbase.functions.js +1 -0
  87. package/cdnjs/1.2.3/cloudbase.js +1 -0
  88. package/cdnjs/1.2.3/cloudbase.storage.js +1 -0
  89. package/cdnjs/1.3.0/cloudbase.auth.js +1 -0
  90. package/cdnjs/1.3.0/cloudbase.database.js +8 -0
  91. package/cdnjs/1.3.0/cloudbase.full.js +8 -0
  92. package/cdnjs/1.3.0/cloudbase.functions.js +1 -0
  93. package/cdnjs/1.3.0/cloudbase.js +1 -0
  94. package/cdnjs/1.3.0/cloudbase.realtime.js +1 -0
  95. package/cdnjs/1.3.0/cloudbase.storage.js +1 -0
  96. package/cdnjs/1.3.1/cloudbase.auth.js +1 -0
  97. package/cdnjs/1.3.1/cloudbase.database.js +8 -0
  98. package/cdnjs/1.3.1/cloudbase.full.js +8 -0
  99. package/cdnjs/1.3.1/cloudbase.functions.js +1 -0
  100. package/cdnjs/1.3.1/cloudbase.js +1 -0
  101. package/cdnjs/1.3.1/cloudbase.realtime.js +1 -0
  102. package/cdnjs/1.3.1/cloudbase.storage.js +1 -0
  103. package/cdnjs/1.3.2/cloudbase.auth.js +1 -0
  104. package/cdnjs/1.3.2/cloudbase.database.js +8 -0
  105. package/cdnjs/1.3.2/cloudbase.full.js +8 -0
  106. package/cdnjs/1.3.2/cloudbase.functions.js +1 -0
  107. package/cdnjs/1.3.2/cloudbase.js +1 -0
  108. package/cdnjs/1.3.2/cloudbase.realtime.js +1 -0
  109. package/cdnjs/1.3.2/cloudbase.storage.js +1 -0
  110. package/cdnjs/1.3.3/cloudbase.auth.js +1 -0
  111. package/cdnjs/1.3.3/cloudbase.database.js +8 -0
  112. package/cdnjs/1.3.3/cloudbase.full.js +8 -0
  113. package/cdnjs/1.3.3/cloudbase.functions.js +1 -0
  114. package/cdnjs/1.3.3/cloudbase.js +1 -0
  115. package/cdnjs/1.3.3/cloudbase.realtime.js +1 -0
  116. package/cdnjs/1.3.3/cloudbase.storage.js +1 -0
  117. package/cdnjs/1.3.4-alpha.0/cloudbase.auth.js +1 -0
  118. package/cdnjs/1.3.4-alpha.0/cloudbase.database.js +8 -0
  119. package/cdnjs/1.3.4-alpha.0/cloudbase.full.js +8 -0
  120. package/cdnjs/1.3.4-alpha.0/cloudbase.functions.js +1 -0
  121. package/cdnjs/1.3.4-alpha.0/cloudbase.js +1 -0
  122. package/cdnjs/1.3.4-alpha.0/cloudbase.realtime.js +1 -0
  123. package/cdnjs/1.3.4-alpha.0/cloudbase.storage.js +1 -0
  124. package/cdnjs/1.3.5/cloudbase.analytics.js +1 -0
  125. package/cdnjs/1.3.5/cloudbase.auth.js +1 -0
  126. package/cdnjs/1.3.5/cloudbase.database.js +10 -0
  127. package/cdnjs/1.3.5/cloudbase.full.js +10 -0
  128. package/cdnjs/1.3.5/cloudbase.functions.js +1 -0
  129. package/cdnjs/1.3.5/cloudbase.js +1 -0
  130. package/cdnjs/1.3.5/cloudbase.realtime.js +1 -0
  131. package/cdnjs/1.3.5/cloudbase.storage.js +1 -0
  132. package/cdnjs/1.3.5-alpha.0/cloudbase.auth.js +1 -0
  133. package/cdnjs/1.3.5-alpha.0/cloudbase.database.js +10 -0
  134. package/cdnjs/1.3.5-alpha.0/cloudbase.full.js +10 -0
  135. package/cdnjs/1.3.5-alpha.0/cloudbase.functions.js +1 -0
  136. package/cdnjs/1.3.5-alpha.0/cloudbase.js +1 -0
  137. package/cdnjs/1.3.5-alpha.0/cloudbase.realtime.js +1 -0
  138. package/cdnjs/1.3.5-alpha.0/cloudbase.storage.js +1 -0
  139. package/cdnjs/1.4.0/cloudbase.analytics.js +1 -0
  140. package/cdnjs/1.4.0/cloudbase.auth.js +1 -0
  141. package/cdnjs/1.4.0/cloudbase.database.js +10 -0
  142. package/cdnjs/1.4.0/cloudbase.full.js +10 -0
  143. package/cdnjs/1.4.0/cloudbase.functions.js +1 -0
  144. package/cdnjs/1.4.0/cloudbase.js +1 -0
  145. package/cdnjs/1.4.0/cloudbase.realtime.js +1 -0
  146. package/cdnjs/1.4.0/cloudbase.storage.js +1 -0
  147. package/cdnjs/1.4.1/cloudbase.analytics.js +1 -0
  148. package/cdnjs/1.4.1/cloudbase.auth.js +1 -0
  149. package/cdnjs/1.4.1/cloudbase.database.js +10 -0
  150. package/cdnjs/1.4.1/cloudbase.full.js +10 -0
  151. package/cdnjs/1.4.1/cloudbase.functions.js +1 -0
  152. package/cdnjs/1.4.1/cloudbase.js +1 -0
  153. package/cdnjs/1.4.1/cloudbase.realtime.js +1 -0
  154. package/cdnjs/1.4.1/cloudbase.storage.js +1 -0
  155. package/cdnjs/1.4.1-alpha.0/cloudbase.analytics.js +1 -0
  156. package/cdnjs/1.4.1-alpha.0/cloudbase.auth.js +1 -0
  157. package/cdnjs/1.4.1-alpha.0/cloudbase.database.js +10 -0
  158. package/cdnjs/1.4.1-alpha.0/cloudbase.full.js +10 -0
  159. package/cdnjs/1.4.1-alpha.0/cloudbase.functions.js +1 -0
  160. package/cdnjs/1.4.1-alpha.0/cloudbase.js +1 -0
  161. package/cdnjs/1.4.1-alpha.0/cloudbase.realtime.js +1 -0
  162. package/cdnjs/1.4.1-alpha.0/cloudbase.storage.js +1 -0
  163. package/cdnjs/1.4.2-alpha.0/cloudbase.analytics.js +1 -0
  164. package/cdnjs/1.4.2-alpha.0/cloudbase.auth.js +1 -0
  165. package/cdnjs/1.4.2-alpha.0/cloudbase.database.js +10 -0
  166. package/cdnjs/1.4.2-alpha.0/cloudbase.full.js +10 -0
  167. package/cdnjs/1.4.2-alpha.0/cloudbase.functions.js +1 -0
  168. package/cdnjs/1.4.2-alpha.0/cloudbase.js +1 -0
  169. package/cdnjs/1.4.2-alpha.0/cloudbase.realtime.js +1 -0
  170. package/cdnjs/1.4.2-alpha.0/cloudbase.storage.js +1 -0
  171. package/cdnjs/1.5.0/cloudbase.analytics.js +1 -0
  172. package/cdnjs/1.5.0/cloudbase.auth.js +1 -0
  173. package/cdnjs/1.5.0/cloudbase.database.js +10 -0
  174. package/cdnjs/1.5.0/cloudbase.full.js +10 -0
  175. package/cdnjs/1.5.0/cloudbase.functions.js +1 -0
  176. package/cdnjs/1.5.0/cloudbase.js +1 -0
  177. package/cdnjs/1.5.0/cloudbase.realtime.js +1 -0
  178. package/cdnjs/1.5.0/cloudbase.storage.js +1 -0
  179. package/cdnjs/1.5.1/cloudbase.analytics.js +1 -0
  180. package/cdnjs/1.5.1/cloudbase.auth.js +1 -0
  181. package/cdnjs/1.5.1/cloudbase.database.js +26 -0
  182. package/cdnjs/1.5.1/cloudbase.full.js +26 -0
  183. package/cdnjs/1.5.1/cloudbase.functions.js +1 -0
  184. package/cdnjs/1.5.1/cloudbase.js +1 -0
  185. package/cdnjs/1.5.1/cloudbase.realtime.js +1 -0
  186. package/cdnjs/1.5.1/cloudbase.storage.js +1 -0
  187. package/cdnjs/1.5.1-alpha.0/cloudbase.analytics.js +1 -0
  188. package/cdnjs/1.5.1-alpha.0/cloudbase.auth.js +1 -0
  189. package/cdnjs/1.5.1-alpha.0/cloudbase.database.js +10 -0
  190. package/cdnjs/1.5.1-alpha.0/cloudbase.full.js +10 -0
  191. package/cdnjs/1.5.1-alpha.0/cloudbase.functions.js +1 -0
  192. package/cdnjs/1.5.1-alpha.0/cloudbase.js +1 -0
  193. package/cdnjs/1.5.1-alpha.0/cloudbase.realtime.js +1 -0
  194. package/cdnjs/1.5.1-alpha.0/cloudbase.storage.js +1 -0
  195. package/cdnjs/1.5.3-alpha.0/cloudbase.analytics.js +1 -0
  196. package/cdnjs/1.5.3-alpha.0/cloudbase.auth.js +1 -0
  197. package/cdnjs/1.5.3-alpha.0/cloudbase.database.js +26 -0
  198. package/cdnjs/1.5.3-alpha.0/cloudbase.full.js +26 -0
  199. package/cdnjs/1.5.3-alpha.0/cloudbase.functions.js +1 -0
  200. package/cdnjs/1.5.3-alpha.0/cloudbase.js +1 -0
  201. package/cdnjs/1.5.3-alpha.0/cloudbase.realtime.js +1 -0
  202. package/cdnjs/1.5.3-alpha.0/cloudbase.storage.js +1 -0
  203. package/cdnjs/1.6.0/cloudbase.analytics.js +1 -0
  204. package/cdnjs/1.6.0/cloudbase.auth.js +1 -0
  205. package/cdnjs/1.6.0/cloudbase.database.js +26 -0
  206. package/cdnjs/1.6.0/cloudbase.full.js +26 -0
  207. package/cdnjs/1.6.0/cloudbase.functions.js +1 -0
  208. package/cdnjs/1.6.0/cloudbase.js +1 -0
  209. package/cdnjs/1.6.0/cloudbase.realtime.js +1 -0
  210. package/cdnjs/1.6.0/cloudbase.storage.js +1 -0
  211. package/{CHANGELOG.md → changelog.md} +0 -0
  212. package/dist/README.md +153 -0
  213. package/{app → dist/app}/index.d.ts +1 -0
  214. package/{app → dist/app}/index.js +0 -0
  215. package/dist/app/index.js.map +1 -0
  216. package/{app → dist/app}/internal.d.ts +0 -0
  217. package/{app → dist/app}/internal.js +0 -0
  218. package/{app → dist/app}/internal.js.map +0 -0
  219. package/{app → dist/app}/openuri.d.ts +0 -0
  220. package/{app → dist/app}/openuri.js +2 -1
  221. package/{app → dist/app}/openuri.js.map +1 -1
  222. package/{app → dist/app}/request.d.ts +4 -3
  223. package/{app → dist/app}/request.js +20 -12
  224. package/dist/app/request.js.map +1 -0
  225. package/{app → dist/app}/storage.d.ts +0 -0
  226. package/{app → dist/app}/storage.js +0 -0
  227. package/{app → dist/app}/storage.js.map +0 -0
  228. package/{auth → dist/auth}/consts.d.ts +21 -4
  229. package/{auth → dist/auth}/consts.js +27 -5
  230. package/dist/auth/consts.js.map +1 -0
  231. package/{auth → dist/auth}/index.d.ts +83 -34
  232. package/{auth → dist/auth}/index.js +239 -92
  233. package/dist/auth/index.js.map +1 -0
  234. package/dist/auth/models.d.ts +284 -0
  235. package/{oauthclient → dist/auth}/models.js +1 -0
  236. package/dist/auth/models.js.map +1 -0
  237. package/{captcha → dist/captcha}/index.d.ts +0 -0
  238. package/{captcha → dist/captcha}/index.js +4 -2
  239. package/dist/captcha/index.js.map +1 -0
  240. package/dist/changelog.md +30 -0
  241. package/dist/function/index.d.ts +38 -0
  242. package/dist/function/index.js +80 -0
  243. package/dist/function/index.js.map +1 -0
  244. package/dist/index.d.ts +14 -0
  245. package/dist/index.js +24 -0
  246. package/dist/index.js.map +1 -0
  247. package/{oauthclient → dist/oauthclient}/consts.d.ts +0 -0
  248. package/{oauthclient → dist/oauthclient}/consts.js +0 -0
  249. package/{oauthclient → dist/oauthclient}/consts.js.map +0 -0
  250. package/{oauthclient → dist/oauthclient}/index.d.ts +0 -0
  251. package/{oauthclient → dist/oauthclient}/index.js +2 -2
  252. package/dist/oauthclient/index.js.map +1 -0
  253. package/{oauthclient → dist/oauthclient}/interface.d.ts +4 -0
  254. package/{oauthclient → dist/oauthclient}/interface.js +0 -0
  255. package/{oauthclient → dist/oauthclient}/interface.js.map +1 -1
  256. package/{oauthclient → dist/oauthclient}/models.d.ts +12 -11
  257. package/{auth → dist/oauthclient}/models.js +0 -0
  258. package/{oauthclient → dist/oauthclient}/models.js.map +0 -0
  259. package/{oauthclient → dist/oauthclient}/oauthclient.d.ts +11 -7
  260. package/{oauthclient → dist/oauthclient}/oauthclient.js +27 -12
  261. package/dist/oauthclient/oauthclient.js.map +1 -0
  262. package/dist/package.json +32 -0
  263. package/{utils/single-promise.d.ts → dist/utils/promise.d.ts} +3 -3
  264. package/{utils/single-promise.js → dist/utils/promise.js} +6 -6
  265. package/dist/utils/promise.js.map +1 -0
  266. package/{utils → dist/utils}/uuid.d.ts +0 -0
  267. package/{utils → dist/utils}/uuid.js +0 -0
  268. package/{utils → dist/utils}/uuid.js.map +0 -0
  269. package/docs/dev.md +71 -0
  270. package/docs/errlog.md +79 -0
  271. package/package.json +3 -2
  272. package/publish.sh +2 -0
  273. package/src/app/index.ts +83 -0
  274. package/src/app/internal.ts +26 -0
  275. package/src/app/openuri.ts +111 -0
  276. package/src/app/request.ts +66 -0
  277. package/src/app/storage.ts +58 -0
  278. package/src/auth/consts.ts +74 -0
  279. package/src/auth/index.ts +718 -0
  280. package/src/auth/models.ts +352 -0
  281. package/src/captcha/index.ts +170 -0
  282. package/src/function/index.ts +103 -0
  283. package/src/index.ts +32 -0
  284. package/src/oauthclient/consts.ts +48 -0
  285. package/src/oauthclient/index.ts +33 -0
  286. package/src/oauthclient/interface.ts +34 -0
  287. package/src/oauthclient/models.ts +50 -0
  288. package/src/oauthclient/oauthclient.ts +487 -0
  289. package/src/utils/promise.ts +41 -0
  290. package/src/utils/uuid.ts +11 -0
  291. package/test/e2e/cases/custom-login.test.js +122 -0
  292. package/test/e2e/cases/index.test.js +61 -0
  293. package/test/e2e/cases/login-state.test.js +89 -0
  294. package/test/e2e/environment.js +39 -0
  295. package/test/e2e/global_setup.js +33 -0
  296. package/test/e2e/global_teardown.js +15 -0
  297. package/test/e2e/setup.js +37 -0
  298. package/test/unit/index.test.js +89 -0
  299. package/test/web/cases/auth/index.js +256 -0
  300. package/test/web/cases/database/collection.js +173 -0
  301. package/test/web/cases/database/command.js +754 -0
  302. package/test/web/cases/database/date.js +122 -0
  303. package/test/web/cases/database/db.js +20 -0
  304. package/test/web/cases/database/document.js +160 -0
  305. package/test/web/cases/database/geo-advanced.js +327 -0
  306. package/test/web/cases/database/geo.js +105 -0
  307. package/test/web/cases/database/index.js +315 -0
  308. package/test/web/cases/database/order.js +83 -0
  309. package/test/web/cases/database/realtime.js +102 -0
  310. package/test/web/cases/database/regex.js +140 -0
  311. package/test/web/cases/ext/index.js +88 -0
  312. package/test/web/cases/function/index.js +77 -0
  313. package/test/web/cases/storage/cos.jpeg +0 -0
  314. package/test/web/cases/storage/index.js +207 -0
  315. package/test/web/index.html +63 -0
  316. package/test/web/index.js +109 -0
  317. package/test/web/util.js +80 -0
  318. package/tsconfig.json +35 -0
  319. package/wiki/README.md +75 -0
  320. package/app/index.js.map +0 -1
  321. package/app/request.js.map +0 -1
  322. package/auth/consts.js.map +0 -1
  323. package/auth/index.js.map +0 -1
  324. package/auth/models.d.ts +0 -158
  325. package/auth/models.js.map +0 -1
  326. package/captcha/index.js.map +0 -1
  327. package/index.d.ts +0 -8
  328. package/index.js +0 -17
  329. package/index.js.map +0 -1
  330. package/oauthclient/index.js.map +0 -1
  331. package/oauthclient/oauthclient.js.map +0 -1
  332. package/utils/single-promise.js.map +0 -1
@@ -0,0 +1,26 @@
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase_database",[],e):"object"==typeof exports?exports.cloudbase_database=e():t.cloudbase_database=e()}("undefined"!=typeof window?window:this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=2)}([function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return Dt}));var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function u(t,e){return t(e={exports:{}},e.exports),e.exports}for(var s=function(t){var e=g(t),r=e[0],n=e[1];return 3*(r+n)/4-n},f=function(t){var e,r,n=g(t),o=n[0],i=n[1],u=new p(function(t,e,r){return 3*(e+r)/4-r}(0,o,i)),s=0,f=i>0?o-4:o;for(r=0;r<f;r+=4)e=l[t.charCodeAt(r)]<<18|l[t.charCodeAt(r+1)]<<12|l[t.charCodeAt(r+2)]<<6|l[t.charCodeAt(r+3)],u[s++]=e>>16&255,u[s++]=e>>8&255,u[s++]=255&e;2===i&&(e=l[t.charCodeAt(r)]<<2|l[t.charCodeAt(r+1)]>>4,u[s++]=255&e);1===i&&(e=l[t.charCodeAt(r)]<<10|l[t.charCodeAt(r+1)]<<4|l[t.charCodeAt(r+2)]>>2,u[s++]=e>>8&255,u[s++]=255&e);return u},a=function(t){for(var e,r=t.length,n=r%3,o=[],i=0,u=r-n;i<u;i+=16383)o.push(b(t,i,i+16383>u?u:i+16383));1===n?(e=t[r-1],o.push(c[e>>2]+c[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(c[e>>10]+c[e>>4&63]+c[e<<2&63]+"="));return o.join("")},c=[],l=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,y=h.length;d<y;++d)c[d]=h[d],l[h.charCodeAt(d)]=d;function g(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function b(t,e,r){for(var n,o,i=[],u=e;u<r;u+=3)n=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),i.push(c[(o=n)>>18&63]+c[o>>12&63]+c[o>>6&63]+c[63&o]);return i.join("")}l["-".charCodeAt(0)]=62,l["_".charCodeAt(0)]=63;var _={byteLength:s,toByteArray:f,fromByteArray:a},m=function(t,e,r,n,o){var i,u,s=8*o-n-1,f=(1<<s)-1,a=f>>1,c=-7,l=r?o-1:0,p=r?-1:1,h=t[e+l];for(l+=p,i=h&(1<<-c)-1,h>>=-c,c+=s;c>0;i=256*i+t[e+l],l+=p,c-=8);for(u=i&(1<<-c)-1,i>>=-c,c+=n;c>0;u=256*u+t[e+l],l+=p,c-=8);if(0===i)i=1-a;else{if(i===f)return u?NaN:1/0*(h?-1:1);u+=Math.pow(2,n),i-=a}return(h?-1:1)*u*Math.pow(2,i-n)},w=function(t,e,r,n,o,i){var u,s,f,a=8*i-o-1,c=(1<<a)-1,l=c>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=c):(u=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-u))<1&&(u--,f*=2),(e+=u+l>=1?p/f:p*Math.pow(2,1-l))*f>=2&&(u++,f/=2),u+l>=c?(s=0,u=c):u+l>=1?(s=(e*f-1)*Math.pow(2,o),u+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[r+h]=255&s,h+=d,s/=256,o-=8);for(u=u<<o|s,a+=o;a>0;t[r+h]=255&u,h+=d,u/=256,a-=8);t[r+h-d]|=128*y},v=u((function(t,e){var r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){+t!=t&&(t=0);return o.alloc(+t)},e.INSPECT_MAX_BYTES=50;function n(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return s(t)}return i(t,e,r)}function i(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|l(t,e),i=n(r),u=i.write(t,e);u!==r&&(i=i.slice(0,u));return i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){var e=new Uint8Array(t);return a(e.buffer,e.byteOffset,e.byteLength)}return f(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t));if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return a(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return a(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return o.from(i,e,r);var u=function(t){if(o.isBuffer(t)){var e=0|c(t.length),r=n(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||$(t.length)?n(0):f(t);if("Buffer"===t.type&&Array.isArray(t.data))return f(t.data)}(t);if(u)return u;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t))}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function s(t){return u(t),n(t<0?0:0|c(t))}function f(t){for(var e=t.length<0?0:0|c(t.length),r=n(e),o=0;o<e;o+=1)r[o]=255&t[o];return r}function a(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,o.prototype),n}function c(t){if(t>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function l(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(t));var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return M(t).length;default:if(i)return n?-1:j(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return E(this,e,r);case"latin1":case"binary":return A(this,e,r);case"base64":return N(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function h(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),$(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,o){var i,u=1,s=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,s/=2,f/=2,r/=2}function a(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}if(o){var c=-1;for(i=r;i<s;i++)if(a(t,i)===a(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===f)return c*u}else-1!==c&&(i-=i-c),c=-1}else for(r+f>s&&(r=s-f),i=r;i>=0;i--){for(var l=!0,p=0;p<f;p++)if(a(t,i+p)!==a(e,p)){l=!1;break}if(l)return i}return-1}function g(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var u=0;u<n;++u){var s=parseInt(e.substr(2*u,2),16);if($(s))return u;t[r+u]=s}return u}function b(t,e,r,n){return C(j(e,t.length-r),t,r,n)}function v(t,e,r,n){return C(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function O(t,e,r,n){return C(M(e),t,r,n)}function S(t,e,r,n){return C(function(t,e){for(var r,n,o,i=[],u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function N(t,e,r){return 0===e&&r===t.length?_.fromByteArray(t):_.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,u,s,f,a=t[o],c=null,l=a>239?4:a>223?3:a>191?2:1;if(o+l<=r)switch(l){case 1:a<128&&(c=a);break;case 2:128==(192&(i=t[o+1]))&&(f=(31&a)<<6|63&i)>127&&(c=f);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(f=(15&a)<<12|(63&i)<<6|63&u)>2047&&(f<55296||f>57343)&&(c=f);break;case 4:i=t[o+1],u=t[o+2],s=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&s)&&(f=(15&a)<<18|(63&i)<<12|(63&u)<<6|63&s)>65535&&f<1114112&&(c=f)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.kMaxLength=2147483647,o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(t,e,r){return i(t,e,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(t,e,r){return function(t,e,r){return u(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}(t,e,r)},o.allocUnsafe=function(t){return s(t)},o.allocUnsafeSlow=function(t){return s(t)},o.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==o.prototype},o.compare=function(t,e){if(Y(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,i=0,u=Math.min(r,n);i<u;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=o.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var u=t[r];if(Y(u,Uint8Array))i+u.length>n.length?o.from(u).copy(n,i):Uint8Array.prototype.set.call(n,u,i);else{if(!o.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(n,i)}i+=u.length}return n},o.byteLength=l,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)h(this,e,e+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)h(this,e,e+3),h(this,e+1,e+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)h(this,e,e+7),h(this,e+1,e+6),h(this,e+2,e+5),h(this,e+3,e+4);return this},o.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(t,e,r,n,i){if(Y(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var u=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),f=Math.min(u,s),a=this.slice(n,i),c=t.slice(e,r),l=0;l<f;++l)if(a[l]!==c[l]){u=a[l],s=c[l];break}return u<s?-1:s<u?1:0},o.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},o.prototype.indexOf=function(t,e,r){return d(this,t,e,r,!0)},o.prototype.lastIndexOf=function(t,e,r){return d(this,t,e,r,!1)},o.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return g(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":case"latin1":case"binary":return v(this,t,e,r);case"base64":return O(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function E(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function A(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function T(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=q[t[i]];return o}function I(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function D(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,r,n,i,u){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<u)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function R(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,4),w(t,e,r,n,23,4),r+4}function U(t,e,r,n,o){return e=+e,r>>>=0,o||R(t,0,r,8),w(t,e,r,n,52,8),r+8}o.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUintLE=o.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},o.prototype.readUintBE=o.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},o.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return t>>>=0,e||D(t,4,this.length),m(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),m(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),m(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),m(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||x(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||x(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=0,u=1,s=0;for(this[e]=255&t;++i<r&&(u*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);x(this,t,e,r,o-1,-o)}var i=r-1,u=1,s=0;for(this[e+i]=255&t;--i>=0&&(u*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeFloatLE=function(t,e,r){return P(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return P(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},o.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var u;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(u=e;u<r;++u)this[u]=t;else{var s=o.isBuffer(t)?t:o.from(t,n),f=s.length;if(0===f)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(u=0;u<r-e;++u)this[u+e]=s[u%f]}return this};var L=/[^+/0-9A-Za-z-_]/g;function j(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],u=0;u<n;++u){if((r=t.charCodeAt(u))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function M(t){return _.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function C(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function $(t){return t!=t}var q=function(){for(var t=new Array(256),e=0;e<16;++e)for(var r=16*e,n=0;n<16;++n)t[r+n]="0123456789abcdef"[e]+"0123456789abcdef"[n];return t}()}));
2
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */v.Buffer,v.SlowBuffer,v.INSPECT_MAX_BYTES,v.kMaxLength;var O={},S="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},N=/%[sdj%]/g;function B(t){if(!C(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(T(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,o=n.length,i=String(t).replace(N,(function(t){if("%%"===t)return"%";if(r>=o)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),u=n[r];r<o;u=n[++r])j(u)||!q(u)?i+=" "+u:i+=" "+T(u);return i}var E,A={};function T(t,e){var r={seen:[],stylize:D};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),L(e)?r.showHidden=e:e&&K(r,e),Y(r.showHidden)&&(r.showHidden=!1),Y(r.depth)&&(r.depth=2),Y(r.colors)&&(r.colors=!1),Y(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=I),x(r,t,r.depth)}function I(t,e){var r=T.styles[e];return r?"["+T.colors[r][0]+"m"+t+"["+T.colors[r][1]+"m":t}function D(t,e){return t}function x(t,e,r){if(t.customInspect&&e&&z(e.inspect)&&e.inspect!==T&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(r,t);return C(n)||(n=x(t,n,r)),n}var o=function(t,e){if(Y(e))return t.stylize("undefined","undefined");if(C(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(M(e))return t.stylize(""+e,"number");if(L(e))return t.stylize(""+e,"boolean");if(j(e))return t.stylize("null","null")}(t,e);if(o)return o;var i=Object.keys(e),u=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(i);if(t.showHidden&&(i=Object.getOwnPropertyNames(e)),k(e)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return R(e);if(0===i.length){if(z(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if($(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(F(e))return t.stylize(Date.prototype.toString.call(e),"date");if(k(e))return R(e)}var f,a="",c=!1,l=["{","}"];(U(e)&&(c=!0,l=["[","]"]),z(e))&&(a=" [Function"+(e.name?": "+e.name:"")+"]");return $(e)&&(a=" "+RegExp.prototype.toString.call(e)),F(e)&&(a=" "+Date.prototype.toUTCString.call(e)),k(e)&&(a=" "+R(e)),0!==i.length||c&&0!=e.length?r<0?$(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),f=c?function(t,e,r,n,o){for(var i=[],u=0,s=e.length;u<s;++u)W(e,String(u))?i.push(P(t,e,r,n,String(u),!0)):i.push("");return o.forEach((function(o){o.match(/^\d+$/)||i.push(P(t,e,r,n,o,!0))})),i}(t,e,r,u,i):i.map((function(n){return P(t,e,r,u,n,c)})),t.seen.pop(),function(t,e,r){if(t.reduce((function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(f,a,l)):l[0]+a+l[1]}function R(t){return"["+Error.prototype.toString.call(t)+"]"}function P(t,e,r,n,o,i){var u,s,f;if((f=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]}).get?s=f.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):f.set&&(s=t.stylize("[Setter]","special")),W(n,o)||(u="["+o+"]"),s||(t.seen.indexOf(f.value)<0?(s=j(r)?x(t,f.value,null):x(t,f.value,r-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),Y(u)){if(i&&o.match(/^\d+$/))return s;(u=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=t.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=t.stylize(u,"string"))}return u+": "+s}function U(t){return Array.isArray(t)}function L(t){return"boolean"==typeof t}function j(t){return null===t}function M(t){return"number"==typeof t}function C(t){return"string"==typeof t}function Y(t){return void 0===t}function $(t){return q(t)&&"[object RegExp]"===J(t)}function q(t){return"object"===babelHelpers.typeof(t)&&null!==t}function F(t){return q(t)&&"[object Date]"===J(t)}function k(t){return q(t)&&("[object Error]"===J(t)||t instanceof Error)}function z(t){return"function"==typeof t}function J(t){return Object.prototype.toString.call(t)}function G(t){return t<10?"0"+t.toString(10):t.toString(10)}T.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]},T.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var H=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function V(){var t=new Date,e=[G(t.getHours()),G(t.getMinutes()),G(t.getSeconds())].join(":");return[t.getDate(),H[t.getMonth()],e].join(" ")}function K(t,e){if(!e||!q(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function W(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var X={inherits:S,_extend:K,log:function(){console.log("%s - %s",V(),B.apply(null,arguments))},isBuffer:function(t){return n.isBuffer(t)},isPrimitive:function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"===babelHelpers.typeof(t)||void 0===t},isFunction:z,isError:k,isDate:F,isObject:q,isRegExp:$,isUndefined:Y,isSymbol:function(t){return"symbol"===babelHelpers.typeof(t)},isString:C,isNumber:M,isNullOrUndefined:function(t){return null==t},isNull:j,isBoolean:L,isArray:U,inspect:T,deprecate:function e(r,n){if(Y(t.process))return function(){return e(r,n).apply(this,arguments)};var o=!1;return function(){return o||(console.error(n),o=!0),r.apply(this,arguments)}},format:B,debuglog:function(t){if(Y(E)&&(E=""),t=t.toUpperCase(),!A[t])if(new RegExp("\\b"+t+"\\b","i").test(E)){A[t]=function(){var e=B.apply(null,arguments);console.error("%s %d: %s",t,0,e)}}else A[t]=function(){};return A[t]}},Z=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deprecate=e.isObjectLike=e.isDate=e.haveBuffer=e.isMap=e.isRegExp=e.isBigUInt64Array=e.isBigInt64Array=e.isUint8Array=e.isAnyArrayBuffer=e.randomBytes=e.normalizedFunctionString=void 0,e.normalizedFunctionString=function(t){return t.toString().replace("function(","function (")};var r="object"==typeof o.navigator&&"ReactNative"===o.navigator.product?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.",n=function(t){console.warn(r);for(var e=v.Buffer.alloc(t),n=0;n<t;++n)e[n]=Math.floor(256*Math.random());return e};function i(t){return"object"==typeof t&&null!==t}e.randomBytes=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(v.Buffer.alloc(e))}}if(void 0!==o&&o.crypto&&o.crypto.getRandomValues)return function(t){return o.crypto.getRandomValues(v.Buffer.alloc(t))};var e;try{e=O.randomBytes}catch(t){}return e||n}(),e.isAnyArrayBuffer=function(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))},e.isUint8Array=function(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},e.isBigInt64Array=function(t){return"[object BigInt64Array]"===Object.prototype.toString.call(t)},e.isBigUInt64Array=function(t){return"[object BigUint64Array]"===Object.prototype.toString.call(t)},e.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},e.isMap=function(t){return"[object Map]"===Object.prototype.toString.call(t)},e.haveBuffer=function(){return void 0!==o&&void 0!==o.Buffer},e.isDate=function(t){return i(t)&&"[object Date]"===Object.prototype.toString.call(t)},e.isObjectLike=i,e.deprecate=function(t,e){if("undefined"==typeof window&&"undefined"==typeof self)return X.deprecate(t,e);var r=!1;return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return r||(console.warn(e),r=!0),t.apply(this,n)}}}));i(Z),Z.deprecate,Z.isObjectLike,Z.isDate,Z.haveBuffer,Z.isMap,Z.isRegExp,Z.isBigUInt64Array,Z.isBigInt64Array,Z.isUint8Array,Z.isAnyArrayBuffer,Z.randomBytes,Z.normalizedFunctionString;var Q=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ensureBuffer=void 0,e.ensureBuffer=function(t){if(ArrayBuffer.isView(t))return v.Buffer.from(t.buffer,t.byteOffset,t.byteLength);if(Z.isAnyArrayBuffer(t))return v.Buffer.from(t);throw new TypeError("Must use either Buffer or TypedArray")}}));i(Q),Q.ensureBuffer;var tt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.bufferToUuidHexString=e.uuidHexStringToBuffer=e.uuidValidateString=void 0;var r=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i;e.uuidValidateString=function(t){return"string"==typeof t&&r.test(t)};e.uuidHexStringToBuffer=function(t){if(!e.uuidValidateString(t))throw new TypeError('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var r=t.replace(/-/g,"");return v.Buffer.from(r,"hex")};e.bufferToUuidHexString=function(t,e){return void 0===e&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")}}));i(tt),tt.bufferToUuidHexString,tt.uuidHexStringToBuffer,tt.uuidValidateString;var et=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.UUID=void 0;var r=Symbol("id"),n=function(){function t(e){if(void 0===e)this.id=t.generate();else if(e instanceof t)this[r]=v.Buffer.from(e.id),this.__id=e.__id;else if(ArrayBuffer.isView(e)&&16===e.byteLength)this.id=Q.ensureBuffer(e);else{if("string"!=typeof e)throw new TypeError("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");this.id=tt.uuidHexStringToBuffer(e)}}return Object.defineProperty(t.prototype,"id",{get:function(){return this[r]},set:function(e){this[r]=e,t.cacheHexString&&(this.__id=tt.bufferToUuidHexString(e))},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(e){if(void 0===e&&(e=!0),t.cacheHexString&&this.__id)return this.__id;var r=tt.bufferToUuidHexString(this.id,e);return t.cacheHexString&&(this.__id=r),r},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(!e)return!1;if(e instanceof t)return e.id.equals(this.id);try{return new t(e).id.equals(this.id)}catch(t){return!1}},t.prototype.toBinary=function(){return new rt.Binary(this.id,rt.Binary.SUBTYPE_UUID)},t.generate=function(){var t=Z.randomBytes(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,v.Buffer.from(t)},t.isValid=function(e){if(!e)return!1;if(e instanceof t)return!0;if("string"==typeof e)return tt.uuidValidateString(e);if(Z.isUint8Array(e)){if(16!==e.length)return!1;try{return parseInt(e[6].toString(16)[0],10)===rt.Binary.SUBTYPE_UUID}catch(t){return!1}}return!1},t.createFromHexString=function(e){return new t(tt.uuidHexStringToBuffer(e))},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new UUID("'+this.toHexString()+'")'},t}();e.UUID=n,Object.defineProperty(n.prototype,"_bsontype",{value:"UUID"})}));i(et),et.UUID;var rt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Binary=void 0;var r=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(!(null==e||"string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Array.isArray(e)))throw new TypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=r?r:t.BSON_BINARY_SUBTYPE_DEFAULT,null==e?(this.buffer=v.Buffer.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=v.Buffer.from(e,"binary"):Array.isArray(e)?this.buffer=v.Buffer.from(e):this.buffer=Q.ensureBuffer(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new TypeError("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new TypeError("only accepts single character Uint8Array or Array");var r;if((r="string"==typeof e?e.charCodeAt(0):"number"==typeof e?e:e[0])<0||r>255)throw new TypeError("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=v.Buffer.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var r=v.Buffer.alloc(this.buffer.length+t.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r}ArrayBuffer.isView(t)?(this.buffer.set(Q.ensureBuffer(t),e),this.position=e+t.byteLength>this.position?e+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,e,t.length,"binary"),this.position=e+t.length>this.position?e+t.length:this.position)},t.prototype.read=function(t,e){return e=e&&e>0?e:this.position,this.buffer.slice(t,t+e)},t.prototype.value=function(t){return(t=!!t)&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(t){return this.buffer.toString(t)},t.prototype.toExtendedJSON=function(t){t=t||{};var e=this.buffer.toString("base64"),r=Number(this.sub_type).toString(16);return t.legacy?{$binary:e,$type:1===r.length?"0"+r:r}:{$binary:{base64:e,subType:1===r.length?"0"+r:r}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new et.UUID(this.buffer.slice(0,this.position));throw new Error('Binary sub_type "'+this.sub_type+'" is not supported for converting to UUID. Only "'+t.SUBTYPE_UUID+'" is currently supported.')},t.fromExtendedJSON=function(e,r){var n,o;if(r=r||{},"$binary"in e?r.legacy&&"string"==typeof e.$binary&&"$type"in e?(o=e.$type?parseInt(e.$type,16):0,n=v.Buffer.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(o=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=v.Buffer.from(e.$binary.base64,"base64")):"$uuid"in e&&(o=4,n=tt.uuidHexStringToBuffer(e.$uuid)),!n)throw new TypeError("Unexpected Binary Extended JSON format "+JSON.stringify(e));return new t(n,o)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Binary(Buffer.from("'+this.value(!0).toString("hex")+'", "hex"), '+this.sub_type+")"},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_USER_DEFINED=128,t}();e.Binary=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Binary"})}));i(rt),rt.Binary;var nt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Code=void 0;var r=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toJSON();return'new Code("'+t.code+'"'+(t.scope?", "+JSON.stringify(t.scope):"")+")"},t}();e.Code=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Code"})}));i(nt),nt.Code;var ot=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DBRef=e.isDBRefLike=void 0,e.isDBRefLike=function(t){return Z.isObjectLike(t)&&null!=t.$id&&null!=t.$ref};var r=function(){function t(e,r,n,o){if(!(this instanceof t))return new t(e,r,n,o);var i=e.split(".");2===i.length&&(n=i.shift(),e=i.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=o||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(t.$db=this.db),t},t.prototype.toExtendedJSON=function(t){t=t||{};var e={$ref:this.collection,$id:this.oid};return t.legacy?e:(this.db&&(e.$db=this.db),e=Object.assign(e,this.fields))},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'+this.namespace+'", new ObjectId("'+t+'")'+(this.db?', "'+this.db+'"':"")+")"},t}();e.DBRef=r,Object.defineProperty(r.prototype,"_bsontype",{value:"DBRef"})}));i(ot),ot.DBRef,ot.isDBRefLike;var it=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Long=void 0;var r=void 0;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(t){}var n={},o={},i=function(){function t(e,r,n){if(void 0===e&&(e=0),!(this instanceof t))return new t(e,r,n);"bigint"==typeof e?Object.assign(this,t.fromBigInt(e,!!r)):"string"==typeof e?Object.assign(this,t.fromString(e,!!r)):(this.low=0|e,this.high=0|r,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var i,u,s;return r?(s=0<=(e>>>=0)&&e<256)&&(u=o[e])?u:(i=t.fromBits(e,(0|e)<0?-1:0,!0),s&&(o[e]=i),i):(s=-128<=(e|=0)&&e<128)&&(u=n[e])?u:(i=t.fromBits(e,e<0?-1:0,!1),s&&(n[e]=i),i)},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=0x10000000000000000)return t.MAX_UNSIGNED_VALUE}else{if(e<=-0x8000000000000000)return t.MIN_VALUE;if(e+1>=0x8000000000000000)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%4294967296|0,e/4294967296|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t.ZERO;if("number"==typeof r?(n=r,r=!1):r=!!r,(n=n||10)<2||36<n)throw RangeError("radix");var o;if((o=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===o)return t.fromString(e.substring(1),r,n).neg();for(var i=t.fromNumber(Math.pow(n,8)),u=t.ZERO,s=0;s<e.length;s+=8){var f=Math.min(8,e.length-s),a=parseInt(e.substring(s,s+f),n);if(f<8){var c=t.fromNumber(Math.pow(n,f));u=u.mul(c).add(t.fromNumber(a))}else u=(u=u.mul(i)).add(t.fromNumber(a))}return u.unsigned=r,u},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(t){return Z.isObjectLike(t)&&!0===t.__isLong__},t.fromValue=function(e,r){return"number"==typeof e?t.fromNumber(e,r):"string"==typeof e?t.fromString(e,r):t.fromBits(e.low,e.high,"boolean"==typeof r?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=65535&this.high,o=this.low>>>16,i=65535&this.low,u=e.high>>>16,s=65535&e.high,f=e.low>>>16,a=0,c=0,l=0,p=0;return l+=(p+=i+(65535&e.low))>>>16,p&=65535,c+=(l+=o+f)>>>16,l&=65535,a+=(c+=n+s)>>>16,c&=65535,a+=r+u,a&=65535,t.fromBits(l<<16|p,a<<16|c,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(t){return this.compare(t)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(r){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var n=(this.unsigned?r.div_u:r.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,r.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var o,i,u;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;u=t.UZERO}else{if(this.eq(t.MIN_VALUE))return e.eq(t.ONE)||e.eq(t.NEG_ONE)?t.MIN_VALUE:e.eq(t.MIN_VALUE)?t.ONE:(o=this.shr(1).div(e).shl(1)).eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(o)),u=o.add(i.div(e)));if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();u=t.ZERO}for(i=this;i.gte(e);){o=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(o)/Math.LN2),f=s<=48?1:Math.pow(2,s-48),a=t.fromNumber(o),c=a.mul(e);c.isNegative()||c.gt(i);)o-=f,c=(a=t.fromNumber(o,this.unsigned)).mul(e);a.isZero()&&(a=t.ONE),u=u.add(a),i=i.sub(c)}return u},t.prototype.div=function(t){return this.divide(t)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},t.prototype.eq=function(t){return this.equals(t)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e,r=0!==this.high?this.high:this.low;for(e=31;e>0&&0==(r&1<<e);e--);return 0!==this.high?e+33:e+1},t.prototype.greaterThan=function(t){return this.comp(t)>0},t.prototype.gt=function(t){return this.greaterThan(t)},t.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},t.prototype.gte=function(t){return this.greaterThanOrEqual(t)},t.prototype.ge=function(t){return this.greaterThanOrEqual(t)},t.prototype.isEven=function(){return 0==(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return 1==(1&this.low)},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return 0===this.high&&0===this.low},t.prototype.lessThan=function(t){return this.comp(t)<0},t.prototype.lt=function(t){return this.lessThan(t)},t.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},t.prototype.lte=function(t){return this.lessThanOrEqual(t)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),r){var n=(this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,r.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(t){return this.modulo(t)},t.prototype.rem=function(t){return this.modulo(t)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),r){var n=r.mul(this.low,this.high,e.low,e.high);return t.fromBits(n,r.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var o=this.high>>>16,i=65535&this.high,u=this.low>>>16,s=65535&this.low,f=e.high>>>16,a=65535&e.high,c=e.low>>>16,l=65535&e.low,p=0,h=0,d=0,y=0;return d+=(y+=s*l)>>>16,y&=65535,h+=(d+=u*l)>>>16,d&=65535,h+=(d+=s*c)>>>16,d&=65535,p+=(h+=i*l)>>>16,h&=65535,p+=(h+=u*c)>>>16,h&=65535,p+=(h+=s*a)>>>16,h&=65535,p+=o*l+i*c+u*a+s*f,p&=65535,t.fromBits(d<<16|y,p<<16|h,this.unsigned)},t.prototype.mul=function(t){return this.multiply(t)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(t){return!this.equals(t)},t.prototype.neq=function(t){return this.notEquals(t)},t.prototype.ne=function(t){return this.notEquals(t)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(t){return this.shiftLeft(t)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(t){return this.shiftRight(t)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),0===(e&=63))return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}return 32===e?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},t.prototype.shru=function(t){return this.shiftRightUnsigned(t)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(t){return this.subtract(t)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},t.prototype.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),o=n.mul(r).sub(this);return n.toString(e)+o.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=t.fromNumber(Math.pow(e,6),this.unsigned),u=this,s="";;){var f=u.div(i),a=(u.sub(f.mul(i)).toInt()>>>0).toString(e);if((u=f).isZero())return a+s;for(;a.length<6;)a="0"+a;s=""+a+s}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(t){return this.lessThanOrEqual(t)},t.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'+this.toString()+'"'+(this.unsigned?", true":"")+")"},t.TWO_PWR_24=t.fromInt(1<<24),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();e.Long=i,Object.defineProperty(i.prototype,"__isLong__",{value:!0}),Object.defineProperty(i.prototype,"_bsontype",{value:"Long"})}));i(it),it.Long;var ut=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Decimal128=void 0;var r=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,n=/^(\+|-)?(Infinity|inf)$/i,o=/^(\+|-)?NaN$/i,i=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),u=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),s=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),f=/^([-+])?(\d+)?$/;function a(t){return!isNaN(parseInt(t,10))}function c(t){var e=it.Long.fromNumber(1e9),r=it.Long.fromNumber(0);if(!(t.parts[0]||t.parts[1]||t.parts[2]||t.parts[3]))return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=(r=r.shiftLeft(32)).add(new it.Long(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function l(t,e){throw new TypeError('"'+t+'" is not a valid Decimal128 string - '+e)}var p=function(){function t(e){if(!(this instanceof t))return new t(e);this.bytes="string"==typeof e?t.fromString(e).bytes:e}return t.fromString=function(e){var c,p=!1,h=!1,d=!1,y=0,g=0,b=0,_=0,m=0,w=[0],O=0,S=0,N=0,B=0,E=0,A=0,T=new it.Long(0,0),I=new it.Long(0,0),D=0;if(e.length>=7e3)throw new TypeError(e+" not a valid Decimal128 string");var x=e.match(r),R=e.match(n),P=e.match(o);if(!x&&!R&&!P||0===e.length)throw new TypeError(e+" not a valid Decimal128 string");if(x){var U=x[2],L=x[4],j=x[5],M=x[6];L&&void 0===M&&l(e,"missing exponent power"),L&&void 0===U&&l(e,"missing exponent base"),void 0===L&&(j||M)&&l(e,"missing e before exponent")}if("+"!==e[D]&&"-"!==e[D]||(p="-"===e[D++]),!a(e[D])&&"."!==e[D]){if("i"===e[D]||"I"===e[D])return new t(v.Buffer.from(p?u:s));if("N"===e[D])return new t(v.Buffer.from(i))}for(;a(e[D])||"."===e[D];)"."!==e[D]?(O<34&&("0"!==e[D]||d)&&(d||(m=g),d=!0,w[S++]=parseInt(e[D],10),O+=1),d&&(b+=1),h&&(_+=1),g+=1,D+=1):(h&&l(e,"contains multiple periods"),h=!0,D+=1);if(h&&!g)throw new TypeError(e+" not a valid Decimal128 string");if("e"===e[D]||"E"===e[D]){var C=e.substr(++D).match(f);if(!C||!C[2])return new t(v.Buffer.from(i));E=parseInt(C[0],10),D+=C[0].length}if(e[D])return new t(v.Buffer.from(i));if(N=0,O){if(B=O-1,1!==(y=b))for(;"0"===e[m+y-1];)y-=1}else N=0,B=0,w[0]=0,b=1,O=1,y=0;for(E<=_&&_-E>16384?E=-6176:E-=_;E>6111;){if((B+=1)-N>34){if(w.join("").match(/^0+$/)){E=6111;break}l(e,"overflow")}E-=1}for(;E<-6176||O<b;){if(0===B&&y<O){E=-6176,y=0;break}if(O<b?b-=1:B-=1,E<6111)E+=1;else{if(w.join("").match(/^0+$/)){E=6111;break}l(e,"overflow")}}if(B-N+1<y){var Y=g;h&&(m+=1,Y+=1),p&&(m+=1,Y+=1);var $=parseInt(e[m+B+1],10),q=0;if($>=5&&(q=1,5===$))for(q=w[B]%2==1?1:0,A=m+B+2;A<Y;A++)if(parseInt(e[A],10)){q=1;break}if(q)for(var F=B;F>=0;F--)if(++w[F]>9&&(w[F]=0,0===F)){if(!(E<6111))return new t(v.Buffer.from(p?u:s));E+=1,w[F]=1}}if(T=it.Long.fromNumber(0),I=it.Long.fromNumber(0),0===y)T=it.Long.fromNumber(0),I=it.Long.fromNumber(0);else if(B-N<17){F=N;for(I=it.Long.fromNumber(w[F++]),T=new it.Long(0,0);F<=B;F++)I=(I=I.multiply(it.Long.fromNumber(10))).add(it.Long.fromNumber(w[F]))}else{F=N;for(T=it.Long.fromNumber(w[F++]);F<=B-17;F++)T=(T=T.multiply(it.Long.fromNumber(10))).add(it.Long.fromNumber(w[F]));for(I=it.Long.fromNumber(w[F++]);F<=B;F++)I=(I=I.multiply(it.Long.fromNumber(10))).add(it.Long.fromNumber(w[F]))}var k,z,J,G,H=function(t,e){if(!t&&!e)return{high:it.Long.fromNumber(0),low:it.Long.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new it.Long(t.getLowBits(),0),o=e.shiftRightUnsigned(32),i=new it.Long(e.getLowBits(),0),u=r.multiply(o),s=r.multiply(i),f=n.multiply(o),a=n.multiply(i);return u=u.add(s.shiftRightUnsigned(32)),s=new it.Long(s.getLowBits(),0).add(f).add(a.shiftRightUnsigned(32)),{high:u=u.add(s.shiftRightUnsigned(32)),low:a=s.shiftLeft(32).add(new it.Long(a.getLowBits(),0))}}(T,it.Long.fromString("100000000000000000"));H.low=H.low.add(I),k=H.low,z=I,J=k.high>>>0,G=z.high>>>0,(J<G||J===G&&k.low>>>0<z.low>>>0)&&(H.high=H.high.add(it.Long.fromNumber(1))),c=E+6176;var V={low:it.Long.fromNumber(0),high:it.Long.fromNumber(0)};H.high.shiftRightUnsigned(49).and(it.Long.fromNumber(1)).equals(it.Long.fromNumber(1))?(V.high=V.high.or(it.Long.fromNumber(3).shiftLeft(61)),V.high=V.high.or(it.Long.fromNumber(c).and(it.Long.fromNumber(16383).shiftLeft(47))),V.high=V.high.or(H.high.and(it.Long.fromNumber(0x7fffffffffff)))):(V.high=V.high.or(it.Long.fromNumber(16383&c).shiftLeft(49)),V.high=V.high.or(H.high.and(it.Long.fromNumber(562949953421311)))),V.low=H.low,p&&(V.high=V.high.or(it.Long.fromString("9223372036854775808")));var K=v.Buffer.alloc(16);return D=0,K[D++]=255&V.low.low,K[D++]=V.low.low>>8&255,K[D++]=V.low.low>>16&255,K[D++]=V.low.low>>24&255,K[D++]=255&V.low.high,K[D++]=V.low.high>>8&255,K[D++]=V.low.high>>16&255,K[D++]=V.low.high>>24&255,K[D++]=255&V.high.low,K[D++]=V.high.low>>8&255,K[D++]=V.high.low>>16&255,K[D++]=V.high.low>>24&255,K[D++]=255&V.high.high,K[D++]=V.high.high>>8&255,K[D++]=V.high.high>>16&255,K[D++]=V.high.high>>24&255,new t(K)},t.prototype.toString=function(){for(var t,e=0,r=new Array(36),n=0;n<r.length;n++)r[n]=0;var o,i,u,s=0,f=!1,a={parts:[0,0,0,0]},l=[];s=0;var p=this.bytes,h=p[s++]|p[s++]<<8|p[s++]<<16|p[s++]<<24,d=p[s++]|p[s++]<<8|p[s++]<<16|p[s++]<<24,y=p[s++]|p[s++]<<8|p[s++]<<16|p[s++]<<24,g=p[s++]|p[s++]<<8|p[s++]<<16|p[s++]<<24;s=0,{low:new it.Long(h,d),high:new it.Long(y,g)}.high.lessThan(it.Long.ZERO)&&l.push("-");var b=g>>26&31;if(b>>3==3){if(30===b)return l.join("")+"Infinity";if(31===b)return"NaN";t=g>>15&16383,o=8+(g>>14&1)}else o=g>>14&7,t=g>>17&16383;var _=t-6176;if(a.parts[0]=(16383&g)+((15&o)<<14),a.parts[1]=y,a.parts[2]=d,a.parts[3]=h,0===a.parts[0]&&0===a.parts[1]&&0===a.parts[2]&&0===a.parts[3])f=!0;else for(u=3;u>=0;u--){var m=0,w=c(a);if(a=w.quotient,m=w.rem.low)for(i=8;i>=0;i--)r[9*u+i]=m%10,m=Math.floor(m/10)}if(f)e=1,r[s]=0;else for(e=36;!r[s];)e-=1,s+=1;var v=e-1+_;if(v>=34||v<=-7||_>0){if(e>34)return l.push("0"),_>0?l.push("E+"+_):_<0&&l.push("E"+_),l.join("");l.push(""+r[s++]),(e-=1)&&l.push(".");for(n=0;n<e;n++)l.push(""+r[s++]);l.push("E"),v>0?l.push("+"+v):l.push(""+v)}else if(_>=0)for(n=0;n<e;n++)l.push(""+r[s++]);else{var O=e+_;if(O>0)for(n=0;n<O;n++)l.push(""+r[s++]);else l.push("0");for(l.push(".");O++<0;)l.push("0");for(n=0;n<e-Math.max(O-1,0);n++)l.push(""+r[s++])}return l.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'+this.toString()+'")'},t}();e.Decimal128=p,Object.defineProperty(p.prototype,"_bsontype",{value:"Decimal128"})}));i(ut),ut.Decimal128;var st=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Double=void 0;var r=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-"+this.value.toFixed(1)}:(Number.isInteger(this.value)?(e=this.value.toFixed(1)).length>=13&&(e=this.value.toExponential(13).toUpperCase()):e=this.value.toString(),{$numberDouble:e});var e},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Double("+this.toExtendedJSON().$numberDouble+")"},t}();e.Double=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Double"})}));i(st),st.Double;var ft=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Int32=void 0;var r=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32("+this.valueOf()+")"},t}();e.Int32=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Int32"})}));i(ft),ft.Int32;var at=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MaxKey=void 0;var r=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();e.MaxKey=r,Object.defineProperty(r.prototype,"_bsontype",{value:"MaxKey"})}));i(at),at.MaxKey;var ct=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MinKey=void 0;var r=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();e.MinKey=r,Object.defineProperty(r.prototype,"_bsontype",{value:"MinKey"})}));i(ct),ct.MinKey;var lt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectId=void 0;var r=new RegExp("^[0-9a-fA-F]{24}$"),n=null,o=Symbol("id"),i=function(){function t(e){if(!(this instanceof t))return new t(e);if(e instanceof t&&(this[o]=e.id,this.__id=e.__id),"object"==typeof e&&e&&"id"in e&&("toHexString"in e&&"function"==typeof e.toHexString?this[o]=v.Buffer.from(e.toHexString(),"hex"):this[o]="string"==typeof e.id?v.Buffer.from(e.id):e.id),null!=e&&"number"!=typeof e||(this[o]=t.generate("number"==typeof e?e:void 0),t.cacheHexString&&(this.__id=this.id.toString("hex"))),ArrayBuffer.isView(e)&&12===e.byteLength&&(this[o]=Q.ensureBuffer(e)),"string"==typeof e)if(12===e.length){var n=v.Buffer.from(e);12===n.byteLength&&(this[o]=n)}else{if(24!==e.length||!r.test(e))throw new TypeError("Argument passed in must be a Buffer or string of 12 bytes or a string of 24 hex characters");this[o]=v.Buffer.from(e,"hex")}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[o]},set:function(e){this[o]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){"number"!=typeof e&&(e=~~(Date.now()/1e3));var r=t.getInc(),o=v.Buffer.alloc(12);return o.writeUInt32BE(e,0),null===n&&(n=Z.randomBytes(5)),o[4]=n[0],o[5]=n[1],o[6]=n[2],o[7]=n[3],o[8]=n[4],o[11]=255&r,o[10]=r>>8&255,o[9]=r>>16&255,o},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){return null!=e&&(e instanceof t?this.toString()===e.toString():"string"==typeof e&&t.isValid(e)&&12===e.length&&Z.isUint8Array(this.id)?e===v.Buffer.prototype.toString.call(this.id,"latin1"):"string"==typeof e&&t.isValid(e)&&24===e.length?e.toLowerCase()===this.toHexString():"string"==typeof e&&t.isValid(e)&&12===e.length?v.Buffer.from(e).equals(this.id):"object"==typeof e&&"toHexString"in e&&"function"==typeof e.toHexString&&e.toHexString()===this.toHexString())},t.prototype.getTimestamp=function(){var t=new Date,e=this.id.readUInt32BE(0);return t.setTime(1e3*Math.floor(e)),t},t.createPk=function(){return new t},t.createFromTime=function(e){var r=v.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(v.Buffer.from(e,"hex"))},t.isValid=function(e){return null!=e&&("number"==typeof e||("string"==typeof e?12===e.length||24===e.length&&r.test(e):e instanceof t||(!(!Z.isUint8Array(e)||12!==e.length)||"object"==typeof e&&"toHexString"in e&&"function"==typeof e.toHexString&&("string"==typeof e.id?12===e.id.length:24===e.toHexString().length&&r.test(e.id.toString("hex"))))))},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'+this.toHexString()+'")'},t.index=~~(16777215*Math.random()),t}();e.ObjectId=i,Object.defineProperty(i.prototype,"generate",{value:Z.deprecate((function(t){return i.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(i.prototype,"getInc",{value:Z.deprecate((function(){return i.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(i.prototype,"get_inc",{value:Z.deprecate((function(){return i.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(i,"get_inc",{value:Z.deprecate((function(){return i.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(i.prototype,"_bsontype",{value:"ObjectID"})}));i(lt),lt.ObjectId;var pt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONRegExp=void 0;var r=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.pattern=e,this.options=null!=r?r:"",this.options.split("").sort().join("");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 ["+this.options[n]+"] is not supported")}return t.parseOptions=function(t){return t?t.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(t){return(t=t||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e){if("string"==typeof e.$regex)return new t(e.$regex,t.parseOptions(e.$options));if("BSONRegExp"===e.$regex._bsontype)return e}if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new TypeError("Unexpected BSONRegExp EJSON object form: "+JSON.stringify(e))},t}();e.BSONRegExp=r,Object.defineProperty(r.prototype,"_bsontype",{value:"BSONRegExp"})}));i(pt),pt.BSONRegExp;var ht=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONSymbol=void 0;var r=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'+this.value+'")'},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();e.BSONSymbol=r,Object.defineProperty(r.prototype,"_bsontype",{value:"Symbol"})}));i(ht),ht.BSONSymbol;
3
+ /*! *****************************************************************************
4
+ Copyright (c) Microsoft Corporation.
5
+
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
+ ***************************************************************************** */
17
+ var dt=function(t,e){return(dt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var yt=function(){return(yt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function gt(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function bt(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function _t(t){return this instanceof _t?(this.v=t,this):new _t(t)}var mt=Object.freeze({__proto__:null,__extends:function(t,e){function r(){this.constructor=t}dt(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},get __assign(){return yt},__rest:function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r},__decorate:function(t,e,r,n){var o,i=arguments.length,u=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"===("undefined"==typeof Reflect?"undefined":babelHelpers.typeof(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(u=(i<3?o(u):i>3?o(e,r,u):o(e,r))||u);return i>3&&u&&Object.defineProperty(e,r,u),u},__param:function(t,e){return function(r,n){e(r,n,t)}},__metadata:function(t,e){if("object"===("undefined"==typeof Reflect?"undefined":babelHelpers.typeof(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__awaiter:function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{f(n.next(t))}catch(t){i(t)}}function s(t){try{f(n.throw(t))}catch(t){i(t)}}function f(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}f((n=n.apply(t,e||[])).next())}))},__generator:function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},__createBinding:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},__exportStar:function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||(e[r]=t[r])},__values:gt,__read:bt,__spread:function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(bt(arguments[e]));return t},__spreadArrays:function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],u=0,s=i.length;u<s;u++,o++)n[o]=i[u];return n},__await:_t,__asyncGenerator:function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(t,e||[]),i=[];return n={},u("next"),u("throw"),u("return"),n[Symbol.asyncIterator]=function(){return this},n;function u(t){o[t]&&(n[t]=function(e){return new Promise((function(r,n){i.push([t,e,r,n])>1||s(t,e)}))})}function s(t,e){try{(r=o[t](e)).value instanceof _t?Promise.resolve(r.value.v).then(f,a):c(i[0][2],r)}catch(t){c(i[0][3],t)}var r}function f(t){s("next",t)}function a(t){s("throw",t)}function c(t,e){t(e),i.shift(),i.length&&s(i[0][0],i[0][1])}},__asyncDelegator:function(t){var e,r;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,o){e[n]=t[n]?function(e){return(r=!r)?{value:_t(t[n](e)),done:"return"===n}:o?o(e):e}:o}},__asyncValues:function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=gt(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}},__makeTemplateObject:function(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t},__importStar:function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e},__importDefault:function(t){return t&&t.__esModule?t:{default:t}},__classPrivateFieldGet:function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)},__classPrivateFieldSet:function(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}}),wt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.LongWithoutOverridesClass=void 0,e.LongWithoutOverridesClass=it.Long;var r=function(t){function e(r,n){var o=this;return o instanceof e?(o=it.Long.isLong(r)?t.call(this,r.low,r.high,!0)||this:t.call(this,r,n,!0)||this,Object.defineProperty(o,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),o):new e(r,n)}return mt.__extends(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(it.Long.fromInt(t,!0))},e.fromNumber=function(t){return new e(it.Long.fromNumber(t,!0))},e.fromBits=function(t,r){return new e(t,r)},e.fromString=function(t,r){return new e(it.Long.fromString(t,!0,r))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp.i,t.$timestamp.t)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp("+this.getLowBits().toString()+", "+this.getHighBits().toString()+")"},e.MAX_VALUE=it.Long.MAX_UNSIGNED_VALUE,e}(e.LongWithoutOverridesClass);e.Timestamp=r}));i(wt),wt.Timestamp,wt.LongWithoutOverridesClass;var vt=u((function(t,e){function r(t){return Z.isObjectLike(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}Object.defineProperty(e,"__esModule",{value:!0}),e.EJSON=e.isBSONType=void 0,e.isBSONType=r;var n={$oid:lt.ObjectId,$binary:rt.Binary,$uuid:rt.Binary,$symbol:ht.BSONSymbol,$numberInt:ft.Int32,$numberDecimal:ut.Decimal128,$numberDouble:st.Double,$numberLong:it.Long,$minKey:ct.MinKey,$maxKey:at.MaxKey,$regex:pt.BSONRegExp,$regularExpression:pt.BSONRegExp,$timestamp:wt.Timestamp};function o(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function i(t,e){if(("object"==typeof t||"function"==typeof t)&&null!==t){var n=e.seenObjects.findIndex((function(e){return e.obj===t}));if(-1!==n){var s=e.seenObjects.map((function(t){return t.propertyName})),f=s.slice(0,n).map((function(t){return t+" -> "})).join(""),a=s[n],c=" -> "+s.slice(n+1,s.length-1).map((function(t){return t+" -> "})).join(""),l=s[s.length-1],p=" ".repeat(f.length+a.length/2),h="-".repeat(c.length+(a.length+l.length)/2-1);throw new TypeError("Converting circular structure to EJSON:\n "+f+a+c+l+"\n "+p+"\\"+h+"/")}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,e){return t.map((function(t,r){e.seenObjects.push({propertyName:"index "+r,obj:null});try{return i(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||Z.isDate(t)){var d=t.getTime(),y=d>-1&&d<2534023188e5;return e.legacy?e.relaxed&&y?{$date:t.getTime()}:{$date:o(t)}:e.relaxed&&y?{$date:o(t)}:{$date:{$numberLong:t.getTime().toString()}}}if("number"==typeof t&&!e.relaxed){if(Math.floor(t)===t){var g=t>=-0x8000000000000000&&t<=0x8000000000000000;if(t>=-2147483648&&t<=2147483647)return{$numberInt:t.toString()};if(g)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||Z.isRegExp(t)){var b=t.flags;if(void 0===b){var _=t.toString().match(/[gimuy]*$/);_&&(b=_[0])}return new pt.BSONRegExp(t.source,b).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new Error("not an object instance");var n=t._bsontype;if(void 0===n){var o={};for(var s in t){e.seenObjects.push({propertyName:s,obj:null});try{o[s]=i(t[s],e)}finally{e.seenObjects.pop()}}return o}if(r(t)){var f=t;if("function"!=typeof f.toExtendedJSON){var a=u[t._bsontype];if(!a)throw new TypeError("Unrecognized or invalid _bsontype: "+t._bsontype);f=a(f)}return"Code"===n&&f.scope?f=new nt.Code(f.code,i(f.scope,e)):"DBRef"===n&&f.oid&&(f=new ot.DBRef(f.collection,i(f.oid,e),f.db,f.fields)),f.toExtendedJSON(e)}throw new Error("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var u={Binary:function(t){return new rt.Binary(t.value(),t.sub_type)},Code:function(t){return new nt.Code(t.code,t.scope)},DBRef:function(t){return new ot.DBRef(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new ut.Decimal128(t.bytes)},Double:function(t){return new st.Double(t.value)},Int32:function(t){return new ft.Int32(t.value)},Long:function(t){return it.Long.fromBits(null!=t.low?t.low:t.low_,null!=t.low?t.high:t.high_,null!=t.low?t.unsigned:t.unsigned_)},MaxKey:function(){return new at.MaxKey},MinKey:function(){return new ct.MinKey},ObjectID:function(t){return new lt.ObjectId(t)},ObjectId:function(t){return new lt.ObjectId(t)},BSONRegExp:function(t){return new pt.BSONRegExp(t.pattern,t.options)},Symbol:function(t){return new ht.BSONSymbol(t.value)},Timestamp:function(t){return wt.Timestamp.fromBits(t.low,t.high)}};!function(t){function e(t,e){var r=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof r.relaxed&&(r.strict=!r.relaxed),"boolean"==typeof r.strict&&(r.relaxed=!r.strict),JSON.parse(t,(function(t,e){return function t(e,r){if(void 0===r&&(r={}),"number"==typeof e){if(r.relaxed||r.legacy)return e;if(Math.floor(e)===e){if(e>=-2147483648&&e<=2147483647)return new ft.Int32(e);if(e>=-0x8000000000000000&&e<=0x8000000000000000)return it.Long.fromNumber(e)}return new st.Double(e)}if(null==e||"object"!=typeof e)return e;if(e.$undefined)return null;for(var o=Object.keys(e).filter((function(t){return t.startsWith("$")&&null!=e[t]})),i=0;i<o.length;i++){var u=n[o[i]];if(u)return u.fromExtendedJSON(e,r)}if(null!=e.$date){var s=e.$date,f=new Date;return r.legacy?"number"==typeof s?f.setTime(s):"string"==typeof s&&f.setTime(Date.parse(s)):"string"==typeof s?f.setTime(Date.parse(s)):it.Long.isLong(s)?f.setTime(s.toNumber()):"number"==typeof s&&r.relaxed&&f.setTime(s),f}if(null!=e.$code){var a=Object.assign({},e);return e.$scope&&(a.$scope=t(e.$scope)),nt.Code.fromExtendedJSON(e)}if(null!=e.$ref||null!=e.$dbPointer){var c=e.$ref?e:e.$dbPointer;if(c instanceof ot.DBRef)return c;var l=Object.keys(c).filter((function(t){return t.startsWith("$")})),p=!0;if(l.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(p=!1)})),p)return ot.DBRef.fromExtendedJSON(c)}return e}(e,r)}))}function r(t,e,r,n){null!=r&&"object"==typeof r&&(n=r,r=0),null==e||"object"!=typeof e||Array.isArray(e)||(n=e,e=void 0,r=0);var o=i(t,Object.assign({relaxed:!0,legacy:!1},n,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(o,e,r)}t.parse=e,t.stringify=r,t.serialize=function(t,e){return e=e||{},JSON.parse(r(t,e))},t.deserialize=function(t,r){return r=r||{},e(JSON.stringify(t),r)}}(e.EJSON||(e.EJSON={}))}));i(vt),vt.EJSON,vt.isBSONType;var Ot=u((function(t,e){var r;Object.defineProperty(e,"__esModule",{value:!0}),e.Map=void 0,e.Map=r;var n=function(t){return t&&t.Math==Math&&t};var i=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof o&&o)||Function("return this")();Object.prototype.hasOwnProperty.call(i,"Map")?e.Map=r=i.Map:e.Map=r=function(){function t(t){void 0===t&&(t=[]),this._keys=[],this._values={};for(var e=0;e<t.length;e++)if(null!=t[e]){var r=t[e],n=r[0],o=r[1];this._keys.push(n),this._values[n]={v:o,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(t){var e=this._values[t];return null!=e&&(delete this._values[t],this._keys.splice(e.i,1),!0)},t.prototype.entries=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?[r,t._values[r].v]:void 0,done:void 0===r}}}},t.prototype.forEach=function(t,e){e=e||this;for(var r=0;r<this._keys.length;r++){var n=this._keys[r];t.call(e,this._values[n].v,n,e)}},t.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},t.prototype.has=function(t){return null!=this._values[t]},t.prototype.keys=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?r:void 0,done:void 0===r}}}},t.prototype.set=function(t,e){return this._values[t]?(this._values[t].v=e,this):(this._keys.push(t),this._values[t]={v:e,i:this._keys.length-1},this)},t.prototype.values=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?t._values[r].v:void 0,done:void 0===r}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}()}));i(Ot),Ot.Map;var St=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_DATA_MAX_KEY=e.BSON_DATA_MIN_KEY=e.BSON_DATA_DECIMAL128=e.BSON_DATA_LONG=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_INT=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_SYMBOL=e.BSON_DATA_CODE=e.BSON_DATA_DBPOINTER=e.BSON_DATA_REGEXP=e.BSON_DATA_NULL=e.BSON_DATA_DATE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_OID=e.BSON_DATA_UNDEFINED=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_DATA_OBJECT=e.BSON_DATA_STRING=e.BSON_DATA_NUMBER=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=void 0,e.BSON_INT32_MAX=2147483647,e.BSON_INT32_MIN=-2147483648,e.BSON_INT64_MAX=Math.pow(2,63)-1,e.BSON_INT64_MIN=-Math.pow(2,63),e.JS_INT_MAX=Math.pow(2,53),e.JS_INT_MIN=-Math.pow(2,53),e.BSON_DATA_NUMBER=1,e.BSON_DATA_STRING=2,e.BSON_DATA_OBJECT=3,e.BSON_DATA_ARRAY=4,e.BSON_DATA_BINARY=5,e.BSON_DATA_UNDEFINED=6,e.BSON_DATA_OID=7,e.BSON_DATA_BOOLEAN=8,e.BSON_DATA_DATE=9,e.BSON_DATA_NULL=10,e.BSON_DATA_REGEXP=11,e.BSON_DATA_DBPOINTER=12,e.BSON_DATA_CODE=13,e.BSON_DATA_SYMBOL=14,e.BSON_DATA_CODE_W_SCOPE=15,e.BSON_DATA_INT=16,e.BSON_DATA_TIMESTAMP=17,e.BSON_DATA_LONG=18,e.BSON_DATA_DECIMAL128=19,e.BSON_DATA_MIN_KEY=255,e.BSON_DATA_MAX_KEY=127,e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BSON_BINARY_SUBTYPE_FUNCTION=1,e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,e.BSON_BINARY_SUBTYPE_UUID=3,e.BSON_BINARY_SUBTYPE_UUID_NEW=4,e.BSON_BINARY_SUBTYPE_MD5=5,e.BSON_BINARY_SUBTYPE_USER_DEFINED=128}));i(St),St.BSON_BINARY_SUBTYPE_USER_DEFINED,St.BSON_BINARY_SUBTYPE_MD5,St.BSON_BINARY_SUBTYPE_UUID_NEW,St.BSON_BINARY_SUBTYPE_UUID,St.BSON_BINARY_SUBTYPE_BYTE_ARRAY,St.BSON_BINARY_SUBTYPE_FUNCTION,St.BSON_BINARY_SUBTYPE_DEFAULT,St.BSON_DATA_MAX_KEY,St.BSON_DATA_MIN_KEY,St.BSON_DATA_DECIMAL128,St.BSON_DATA_LONG,St.BSON_DATA_TIMESTAMP,St.BSON_DATA_INT,St.BSON_DATA_CODE_W_SCOPE,St.BSON_DATA_SYMBOL,St.BSON_DATA_CODE,St.BSON_DATA_DBPOINTER,St.BSON_DATA_REGEXP,St.BSON_DATA_NULL,St.BSON_DATA_DATE,St.BSON_DATA_BOOLEAN,St.BSON_DATA_OID,St.BSON_DATA_UNDEFINED,St.BSON_DATA_BINARY,St.BSON_DATA_ARRAY,St.BSON_DATA_OBJECT,St.BSON_DATA_STRING,St.BSON_DATA_NUMBER,St.JS_INT_MIN,St.JS_INT_MAX,St.BSON_INT64_MIN,St.BSON_INT64_MAX,St.BSON_INT32_MIN,St.BSON_INT32_MAX;var Nt=u((function(t,e){function r(t,e,r){var o=5;if(Array.isArray(t))for(var i=0;i<t.length;i++)o+=n(i.toString(),t[i],e,!0,r);else for(var u in t.toBSON&&(t=t.toBSON()),t)o+=n(u,t[u],e,!1,r);return o}function n(t,e,n,o,i){switch(void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===i&&(i=!1),e&&e.toBSON&&(e=e.toBSON()),typeof e){case"string":return 1+v.Buffer.byteLength(t,"utf8")+1+4+v.Buffer.byteLength(e,"utf8")+1;case"number":return Math.floor(e)===e&&e>=St.JS_INT_MIN&&e<=St.JS_INT_MAX&&e>=St.BSON_INT32_MIN&&e<=St.BSON_INT32_MAX?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+5:(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;case"undefined":return o||!i?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1:0;case"boolean":return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+2;case"object":if(null==e||"MinKey"===e._bsontype||"MaxKey"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1;if("ObjectId"===e._bsontype||"ObjectID"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+13;if(e instanceof Date||Z.isDate(e))return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Z.isAnyArrayBuffer(e))return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+6+e.byteLength;if("Long"===e._bsontype||"Double"===e._bsontype||"Timestamp"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+9;if("Decimal128"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+17;if("Code"===e._bsontype)return null!=e.scope&&Object.keys(e.scope).length>0?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+4+v.Buffer.byteLength(e.code.toString(),"utf8")+1+r(e.scope,n,i):(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+v.Buffer.byteLength(e.code.toString(),"utf8")+1;if("Binary"===e._bsontype)return e.sub_type===rt.Binary.SUBTYPE_BYTE_ARRAY?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+(e.position+1+4+1+4):(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+(e.position+1+4+1);if("Symbol"===e._bsontype)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+v.Buffer.byteLength(e.value,"utf8")+4+1+1;if("DBRef"===e._bsontype){var u=Object.assign({$ref:e.collection,$id:e.oid},e.fields);return null!=e.db&&(u.$db=e.db),(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+r(u,n,i)}return e instanceof RegExp||Z.isRegExp(e)?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1:"BSONRegExp"===e._bsontype?(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.pattern,"utf8")+1+v.Buffer.byteLength(e.options,"utf8")+1:(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+r(e,n,i)+1;case"function":if(e instanceof RegExp||Z.isRegExp(e)||"[object RegExp]"===String.call(e))return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+v.Buffer.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1;if(n&&null!=e.scope&&Object.keys(e.scope).length>0)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+4+v.Buffer.byteLength(Z.normalizedFunctionString(e),"utf8")+1+r(e.scope,n,i);if(n)return(null!=t?v.Buffer.byteLength(t,"utf8")+1:0)+1+4+v.Buffer.byteLength(Z.normalizedFunctionString(e),"utf8")+1}return 0}Object.defineProperty(e,"__esModule",{value:!0}),e.calculateObjectSize=void 0,e.calculateObjectSize=r}));i(Nt),Nt.calculateObjectSize;var Bt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUtf8=void 0;e.validateUtf8=function(t,e,r){for(var n=0,o=e;o<r;o+=1){var i=t[o];if(n){if(128!=(192&i))return!1;n-=1}else if(128&i)if(192==(224&i))n=1;else if(224==(240&i))n=2;else{if(240!=(248&i))return!1;n=3}}return!n}}));i(Bt),Bt.validateUtf8;var Et=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserialize=void 0;var r=it.Long.fromNumber(St.JS_INT_MAX),n=it.Long.fromNumber(St.JS_INT_MIN),o={};function i(t,e,s,f){void 0===f&&(f=!1);var a=null!=s.evalFunctions&&s.evalFunctions,c=null!=s.cacheFunctions&&s.cacheFunctions,l=null==s.fieldsAsRaw?null:s.fieldsAsRaw,p=null!=s.raw&&s.raw,h="boolean"==typeof s.bsonRegExp&&s.bsonRegExp,d=null!=s.promoteBuffers&&s.promoteBuffers,y=null==s.promoteLongs||s.promoteLongs,g=null==s.promoteValues||s.promoteValues,b=e;if(t.length<5)throw new Error("corrupt bson message < 5 bytes long");var _=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(_<5||_>t.length)throw new Error("corrupt bson message");for(var m=f?[]:{},w=0;;){var O=t[e++];if(0===O)break;for(var S=e;0!==t[S]&&S<t.length;)S++;if(S>=t.byteLength)throw new Error("Bad BSON Document: illegal CString");var N=f?w++:t.toString("utf8",e,S),B=void 0;if(e=S+1,O===St.BSON_DATA_STRING){if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");if(!Bt.validateUtf8(t,e,e+V-1))throw new Error("Invalid UTF-8 string in BSON document");B=t.toString("utf8",e,e+V-1),e+=V}else if(O===St.BSON_DATA_OID){var E=v.Buffer.alloc(12);t.copy(E,0,e,e+12),B=new lt.ObjectId(E),e+=12}else if(O===St.BSON_DATA_INT&&!1===g)B=new ft.Int32(t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24);else if(O===St.BSON_DATA_INT)B=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;else if(O===St.BSON_DATA_NUMBER&&!1===g)B=new st.Double(t.readDoubleLE(e)),e+=8;else if(O===St.BSON_DATA_NUMBER)B=t.readDoubleLE(e),e+=8;else if(O===St.BSON_DATA_DATE){var A=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;B=new Date(new it.Long(A,T).toNumber())}else if(O===St.BSON_DATA_BOOLEAN){if(0!==t[e]&&1!==t[e])throw new Error("illegal boolean type value");B=1===t[e++]}else if(O===St.BSON_DATA_OBJECT){var I=e;if((G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)<=0||G>t.length-e)throw new Error("bad embedded document length in bson");B=p?t.slice(e,e+G):i(t,I,s,!1),e+=G}else if(O===St.BSON_DATA_ARRAY){I=e;var D=s,x=e+(G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24);if(l&&l[N]){for(var R in D={},s)D[R]=s[R];D.raw=!0}if(B=i(t,I,D,!0),0!==t[(e+=G)-1])throw new Error("invalid array terminator byte");if(e!==x)throw new Error("corrupted array bson")}else if(O===St.BSON_DATA_UNDEFINED)B=void 0;else if(O===St.BSON_DATA_NULL)B=null;else if(O===St.BSON_DATA_LONG){A=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;var P=new it.Long(A,T);B=y&&!0===g&&P.lessThanOrEqual(r)&&P.greaterThanOrEqual(n)?P.toNumber():P}else if(O===St.BSON_DATA_DECIMAL128){var U=v.Buffer.alloc(16);t.copy(U,0,e,e+16),e+=16;var L=new ut.Decimal128(U);B="toObject"in L&&"function"==typeof L.toObject?L.toObject():L}else if(O===St.BSON_DATA_BINARY){var j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,M=j,C=t[e++];if(j<0)throw new Error("Negative binary type element size found");if(j>t.byteLength)throw new Error("Binary type size larger than document size");if(null!=t.slice){if(C===rt.Binary.SUBTYPE_BYTE_ARRAY){if((j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>M-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(j<M-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}B=d&&g?t.slice(e,e+j):new rt.Binary(t.slice(e,e+j),C)}else{var Y=v.Buffer.alloc(j);if(C===rt.Binary.SUBTYPE_BYTE_ARRAY){if((j=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(j>M-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(j<M-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(S=0;S<j;S++)Y[S]=t[e+S];B=d&&g?Y:new rt.Binary(Y,C)}e+=j}else if(O===St.BSON_DATA_REGEXP&&!1===h){for(S=e;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");var $=t.toString("utf8",e,S);for(S=e=S+1;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");var q=t.toString("utf8",e,S);e=S+1;var F=new Array(q.length);for(S=0;S<q.length;S++)switch(q[S]){case"m":F[S]="m";break;case"s":F[S]="g";break;case"i":F[S]="i"}B=new RegExp($,F.join(""))}else if(O===St.BSON_DATA_REGEXP&&!0===h){for(S=e;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");$=t.toString("utf8",e,S);for(S=e=S+1;0!==t[S]&&S<t.length;)S++;if(S>=t.length)throw new Error("Bad BSON Document: illegal CString");q=t.toString("utf8",e,S);e=S+1,B=new pt.BSONRegExp($,q)}else if(O===St.BSON_DATA_SYMBOL){if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");var k=t.toString("utf8",e,e+V-1);B=g?k:new ht.BSONSymbol(k),e+=V}else if(O===St.BSON_DATA_TIMESTAMP){A=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24,T=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;B=new wt.Timestamp(A,T)}else if(O===St.BSON_DATA_MIN_KEY)B=new ct.MinKey;else if(O===St.BSON_DATA_MAX_KEY)B=new at.MaxKey;else if(O===St.BSON_DATA_CODE){if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");var z=t.toString("utf8",e,e+V-1);B=a?c?u(z,o,m):u(z):new nt.Code(z),e+=V}else if(O===St.BSON_DATA_CODE_W_SCOPE){var J=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24;if(J<13)throw new Error("code_w_scope total size shorter minimum expected length");if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");z=t.toString("utf8",e,e+V-1),I=e+=V;var G=t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24,H=i(t,I,s,!1);if(e+=G,J<8+G+V)throw new Error("code_w_scope total size is too short, truncating scope");if(J>8+G+V)throw new Error("code_w_scope total size is too long, clips outer document");a?(B=c?u(z,o,m):u(z)).scope=H:B=new nt.Code(z,H)}else{if(O!==St.BSON_DATA_DBPOINTER)throw new Error("Detected unknown BSON type "+O.toString(16)+' for fieldname "'+N+'"');var V;if((V=t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24)<=0||V>t.length-e||0!==t[e+V-1])throw new Error("bad string length in bson");if(!Bt.validateUtf8(t,e,e+V-1))throw new Error("Invalid UTF-8 string in BSON document");var K=t.toString("utf8",e,e+V-1);e+=V;var W=v.Buffer.alloc(12);t.copy(W,0,e,e+12);E=new lt.ObjectId(W);e+=12,B=new ot.DBRef(K,E)}"__proto__"===N?Object.defineProperty(m,N,{value:B,writable:!0,enumerable:!0,configurable:!0}):m[N]=B}if(_!==e-b){if(f)throw new Error("corrupt array bson");throw new Error("corrupt object bson")}var X=Object.keys(m).filter((function(t){return t.startsWith("$")})),Z=!0;if(X.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(Z=!1)})),!Z)return m;if(ot.isDBRefLike(m)){var Q=Object.assign({},m);return delete Q.$ref,delete Q.$id,delete Q.$db,new ot.DBRef(m.$ref,m.$id,m.$db,Q)}return m}function u(t,e,r){return e?(null==e[t]&&(e[t]=new Function(t)),e[t].bind(r)):new Function(t)}e.deserialize=function(t,e,r){var n=(e=null==e?{}:e)&&e.index?e.index:0,o=t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24;if(o<5)throw new Error("bson size must be >= 5, is "+o);if(e.allowObjectSmallerThanBufferSize&&t.length<o)throw new Error("buffer length "+t.length+" must be >= bson size "+o);if(!e.allowObjectSmallerThanBufferSize&&t.length!==o)throw new Error("buffer length "+t.length+" must === bson size "+o);if(o+n>t.byteLength)throw new Error("(bson size "+o+" + options.index "+n+" must be <= buffer length "+t.byteLength+")");if(0!==t[n+o-1])throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return i(t,n,e,r)}}));i(Et),Et.deserialize;var At=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.writeIEEE754=e.readIEEE754=void 0,e.readIEEE754=function(t,e,r,n,o){var i,u,s="big"===r,f=8*o-n-1,a=(1<<f)-1,c=a>>1,l=-7,p=s?0:o-1,h=s?1:-1,d=t[e+p];for(p+=h,i=d&(1<<-l)-1,d>>=-l,l+=f;l>0;i=256*i+t[e+p],p+=h,l-=8);for(u=i&(1<<-l)-1,i>>=-l,l+=n;l>0;u=256*u+t[e+p],p+=h,l-=8);if(0===i)i=1-c;else{if(i===a)return u?NaN:1/0*(d?-1:1);u+=Math.pow(2,n),i-=c}return(d?-1:1)*u*Math.pow(2,i-n)},e.writeIEEE754=function(t,e,r,n,o,i){var u,s,f,a="big"===n,c=8*i-o-1,l=(1<<c)-1,p=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=a?i-1:0,y=a?-1:1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=l):(u=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-u))<1&&(u--,f*=2),(e+=u+p>=1?h/f:h*Math.pow(2,1-p))*f>=2&&(u++,f/=2),u+p>=l?(s=0,u=l):u+p>=1?(s=(e*f-1)*Math.pow(2,o),u+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,o),u=0)),isNaN(e)&&(s=0);o>=8;)t[r+d]=255&s,d+=y,s/=256,o-=8;for(u=u<<o|s,isNaN(e)&&(u+=8),c+=o;c>0;)t[r+d]=255&u,d+=y,u/=256,c-=8;t[r+d-y]|=128*g}}));i(At),At.writeIEEE754,At.readIEEE754;var Tt=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeInto=void 0;var r=/\x00/,n=new Set(["$db","$ref","$id","$clusterTime"]);function o(t,e,r,n,o){t[n++]=St.BSON_DATA_STRING;var i=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8");t[(n=n+i+1)-1]=0;var u=t.write(r,n+4,void 0,"utf8");return t[n+3]=u+1>>24&255,t[n+2]=u+1>>16&255,t[n+1]=u+1>>8&255,t[n]=u+1&255,n=n+4+u,t[n++]=0,n}function i(t,e,r,n,o){Number.isInteger(r)&&r>=St.BSON_INT32_MIN&&r<=St.BSON_INT32_MAX?(t[n++]=St.BSON_DATA_INT,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255):(t[n++]=St.BSON_DATA_NUMBER,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,At.writeIEEE754(t,r,n,"little",52,8),n+=8);return n}function u(t,e,r,n,o){return t[n++]=St.BSON_DATA_NULL,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function s(t,e,r,n,o){return t[n++]=St.BSON_DATA_BOOLEAN,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=r?1:0,n}function f(t,e,r,n,o){t[n++]=St.BSON_DATA_DATE,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=it.Long.fromNumber(r.getTime()),u=i.getLowBits(),s=i.getHighBits();return t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,n}function a(t,e,n,o,i){if(t[o++]=St.BSON_DATA_REGEXP,o+=i?t.write(e,o,void 0,"ascii"):t.write(e,o,void 0,"utf8"),t[o++]=0,n.source&&null!=n.source.match(r))throw Error("value "+n.source+" must not contain null bytes");return o+=t.write(n.source,o,void 0,"utf8"),t[o++]=0,n.ignoreCase&&(t[o++]=105),n.global&&(t[o++]=115),n.multiline&&(t[o++]=109),t[o++]=0,o}function c(t,e,n,o,i){if(t[o++]=St.BSON_DATA_REGEXP,o+=i?t.write(e,o,void 0,"ascii"):t.write(e,o,void 0,"utf8"),t[o++]=0,null!=n.pattern.match(r))throw Error("pattern "+n.pattern+" must not contain null bytes");return o+=t.write(n.pattern,o,void 0,"utf8"),t[o++]=0,o+=t.write(n.options.split("").sort().join(""),o,void 0,"utf8"),t[o++]=0,o}function l(t,e,r,n,o){return null===r?t[n++]=St.BSON_DATA_NULL:"MinKey"===r._bsontype?t[n++]=St.BSON_DATA_MIN_KEY:t[n++]=St.BSON_DATA_MAX_KEY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function p(t,e,r,n,o){if(t[n++]=St.BSON_DATA_OID,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,"string"==typeof r.id)t.write(r.id,n,void 0,"binary");else{if(!r.id||!r.id.copy)throw new TypeError("object ["+JSON.stringify(r)+"] is not a valid ObjectId");r.id.copy(t,n,0,12)}return n+12}function h(t,e,r,n,o){t[n++]=St.BSON_DATA_BINARY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.length;return t[n++]=255&i,t[n++]=i>>8&255,t[n++]=i>>16&255,t[n++]=i>>24&255,t[n++]=St.BSON_BINARY_SUBTYPE_DEFAULT,t.set(Q.ensureBuffer(r),n),n+=i}function d(t,e,r,n,o,i,u,s,f,a){void 0===o&&(o=!1),void 0===i&&(i=0),void 0===u&&(u=!1),void 0===s&&(s=!0),void 0===f&&(f=!1),void 0===a&&(a=[]);for(var c=0;c<a.length;c++)if(a[c]===r)throw new Error("cyclic dependency detected");a.push(r),t[n++]=Array.isArray(r)?St.BSON_DATA_ARRAY:St.BSON_DATA_OBJECT,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var l=N(t,r,o,n,i+1,u,s,a);return a.pop(),l}function y(t,e,r,n,o){return t[n++]=St.BSON_DATA_DECIMAL128,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,r.bytes.copy(t,n,0,16),n+16}function g(t,e,r,n,o){t[n++]="Long"===r._bsontype?St.BSON_DATA_LONG:St.BSON_DATA_TIMESTAMP,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.getLowBits(),u=r.getHighBits();return t[n++]=255&i,t[n++]=i>>8&255,t[n++]=i>>16&255,t[n++]=i>>24&255,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,n}function b(t,e,r,n,o){return r=r.valueOf(),t[n++]=St.BSON_DATA_INT,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255,n}function _(t,e,r,n,o){return t[n++]=St.BSON_DATA_NUMBER,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,At.writeIEEE754(t,r.value,n,"little",52,8),n+=8}function m(t,e,r,n,o,i,u){t[n++]=St.BSON_DATA_CODE,n+=u?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var s=Z.normalizedFunctionString(r),f=t.write(s,n+4,void 0,"utf8")+1;return t[n]=255&f,t[n+1]=f>>8&255,t[n+2]=f>>16&255,t[n+3]=f>>24&255,n=n+4+f-1,t[n++]=0,n}function w(t,e,r,n,o,i,u,s,f){if(void 0===o&&(o=!1),void 0===i&&(i=0),void 0===u&&(u=!1),void 0===s&&(s=!0),void 0===f&&(f=!1),r.scope&&"object"==typeof r.scope){t[n++]=St.BSON_DATA_CODE_W_SCOPE,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var a=n,c="string"==typeof r.code?r.code:r.code.toString();n+=4;var l=t.write(c,n+4,void 0,"utf8")+1;t[n]=255&l,t[n+1]=l>>8&255,t[n+2]=l>>16&255,t[n+3]=l>>24&255,t[n+4+l-1]=0,n=n+l+4;var p=N(t,r.scope,o,n,i+1,u,s);n=p-1;var h=p-a;t[a++]=255&h,t[a++]=h>>8&255,t[a++]=h>>16&255,t[a++]=h>>24&255,t[n++]=0}else{t[n++]=St.BSON_DATA_CODE,n+=f?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;c=r.code.toString();var d=t.write(c,n+4,void 0,"utf8")+1;t[n]=255&d,t[n+1]=d>>8&255,t[n+2]=d>>16&255,t[n+3]=d>>24&255,n=n+4+d-1,t[n++]=0}return n}function v(t,e,r,n,o){t[n++]=St.BSON_DATA_BINARY,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=r.value(!0),u=r.position;return r.sub_type===rt.Binary.SUBTYPE_BYTE_ARRAY&&(u+=4),t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255,t[n++]=r.sub_type,r.sub_type===rt.Binary.SUBTYPE_BYTE_ARRAY&&(u-=4,t[n++]=255&u,t[n++]=u>>8&255,t[n++]=u>>16&255,t[n++]=u>>24&255),t.set(i,n),n+=r.position}function O(t,e,r,n,o){t[n++]=St.BSON_DATA_SYMBOL,n+=o?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var i=t.write(r.value,n+4,void 0,"utf8")+1;return t[n]=255&i,t[n+1]=i>>8&255,t[n+2]=i>>16&255,t[n+3]=i>>24&255,n=n+4+i-1,t[n++]=0,n}function S(t,e,r,n,o,i,u){t[n++]=St.BSON_DATA_OBJECT,n+=u?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var s=n,f={$ref:r.collection||r.namespace,$id:r.oid};null!=r.db&&(f.$db=r.db);var a=N(t,f=Object.assign(f,r.fields),!1,n,o+1,i),c=a-s;return t[s++]=255&c,t[s++]=c>>8&255,t[s++]=c>>16&255,t[s++]=c>>24&255,a}function N(t,e,N,B,E,A,T,I){void 0===N&&(N=!1),void 0===B&&(B=0),void 0===E&&(E=0),void 0===A&&(A=!1),void 0===T&&(T=!0),void 0===I&&(I=[]),B=B||0,(I=I||[]).push(e);var D=B+4;if(Array.isArray(e))for(var x=0;x<e.length;x++){var R=""+x;if((M=e[x])&&M.toBSON){if("function"!=typeof M.toBSON)throw new TypeError("toBSON is not a function");M=M.toBSON()}if("string"==typeof M)D=o(t,R,M,D,!0);else if("number"==typeof M)D=i(t,R,M,D,!0);else{if("bigint"==typeof M)throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"==typeof M)D=s(t,R,M,D,!0);else if(M instanceof Date||Z.isDate(M))D=f(t,R,M,D,!0);else if(void 0===M)D=u(t,R,0,D,!0);else if(null===M)D=u(t,R,0,D,!0);else if("ObjectId"===M._bsontype||"ObjectID"===M._bsontype)D=p(t,R,M,D,!0);else if(Z.isUint8Array(M))D=h(t,R,M,D,!0);else if(M instanceof RegExp||Z.isRegExp(M))D=a(t,R,M,D,!0);else if("object"==typeof M&&null==M._bsontype)D=d(t,R,M,D,N,E,A,T,!0,I);else if("object"==typeof M&&vt.isBSONType(M)&&"Decimal128"===M._bsontype)D=y(t,R,M,D,!0);else if("Long"===M._bsontype||"Timestamp"===M._bsontype)D=g(t,R,M,D,!0);else if("Double"===M._bsontype)D=_(t,R,M,D,!0);else if("function"==typeof M&&A)D=m(t,R,M,D,0,0,!0);else if("Code"===M._bsontype)D=w(t,R,M,D,N,E,A,T,!0);else if("Binary"===M._bsontype)D=v(t,R,M,D,!0);else if("Symbol"===M._bsontype)D=O(t,R,M,D,!0);else if("DBRef"===M._bsontype)D=S(t,R,M,D,E,A,!0);else if("BSONRegExp"===M._bsontype)D=c(t,R,M,D,!0);else if("Int32"===M._bsontype)D=b(t,R,M,D,!0);else if("MinKey"===M._bsontype||"MaxKey"===M._bsontype)D=l(t,R,M,D,!0);else if(void 0!==M._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+M._bsontype)}}else if(e instanceof Ot.Map||Z.isMap(e))for(var P=e.entries(),U=!1;!U;){var L=P.next();if(!(U=!!L.done)){R=L.value[0];var j=typeof(M=L.value[1]);if("string"==typeof R&&!n.has(R)){if(null!=R.match(r))throw Error("key "+R+" must not contain null bytes");if(N){if("$"===R[0])throw Error("key "+R+" must not start with '$'");if(~R.indexOf("."))throw Error("key "+R+" must not contain '.'")}}if("string"===j)D=o(t,R,M,D);else if("number"===j)D=i(t,R,M,D);else{if("bigint"===j||Z.isBigInt64Array(M)||Z.isBigUInt64Array(M))throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"===j)D=s(t,R,M,D);else if(M instanceof Date||Z.isDate(M))D=f(t,R,M,D);else if(null===M||void 0===M&&!1===T)D=u(t,R,0,D);else if("ObjectId"===M._bsontype||"ObjectID"===M._bsontype)D=p(t,R,M,D);else if(Z.isUint8Array(M))D=h(t,R,M,D);else if(M instanceof RegExp||Z.isRegExp(M))D=a(t,R,M,D);else if("object"===j&&null==M._bsontype)D=d(t,R,M,D,N,E,A,T,!1,I);else if("object"===j&&"Decimal128"===M._bsontype)D=y(t,R,M,D);else if("Long"===M._bsontype||"Timestamp"===M._bsontype)D=g(t,R,M,D);else if("Double"===M._bsontype)D=_(t,R,M,D);else if("Code"===M._bsontype)D=w(t,R,M,D,N,E,A,T);else if("function"==typeof M&&A)D=m(t,R,M,D,0,0,A);else if("Binary"===M._bsontype)D=v(t,R,M,D);else if("Symbol"===M._bsontype)D=O(t,R,M,D);else if("DBRef"===M._bsontype)D=S(t,R,M,D,E,A);else if("BSONRegExp"===M._bsontype)D=c(t,R,M,D);else if("Int32"===M._bsontype)D=b(t,R,M,D);else if("MinKey"===M._bsontype||"MaxKey"===M._bsontype)D=l(t,R,M,D);else if(void 0!==M._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+M._bsontype)}}}else{if(e.toBSON){if("function"!=typeof e.toBSON)throw new TypeError("toBSON is not a function");if(null!=(e=e.toBSON())&&"object"!=typeof e)throw new TypeError("toBSON function did not return an object")}for(var R in e){var M;if((M=e[R])&&M.toBSON){if("function"!=typeof M.toBSON)throw new TypeError("toBSON is not a function");M=M.toBSON()}j=typeof M;if("string"==typeof R&&!n.has(R)){if(null!=R.match(r))throw Error("key "+R+" must not contain null bytes");if(N){if("$"===R[0])throw Error("key "+R+" must not start with '$'");if(~R.indexOf("."))throw Error("key "+R+" must not contain '.'")}}if("string"===j)D=o(t,R,M,D);else if("number"===j)D=i(t,R,M,D);else{if("bigint"===j)throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"===j)D=s(t,R,M,D);else if(M instanceof Date||Z.isDate(M))D=f(t,R,M,D);else if(void 0===M)!1===T&&(D=u(t,R,0,D));else if(null===M)D=u(t,R,0,D);else if("ObjectId"===M._bsontype||"ObjectID"===M._bsontype)D=p(t,R,M,D);else if(Z.isUint8Array(M))D=h(t,R,M,D);else if(M instanceof RegExp||Z.isRegExp(M))D=a(t,R,M,D);else if("object"===j&&null==M._bsontype)D=d(t,R,M,D,N,E,A,T,!1,I);else if("object"===j&&"Decimal128"===M._bsontype)D=y(t,R,M,D);else if("Long"===M._bsontype||"Timestamp"===M._bsontype)D=g(t,R,M,D);else if("Double"===M._bsontype)D=_(t,R,M,D);else if("Code"===M._bsontype)D=w(t,R,M,D,N,E,A,T);else if("function"==typeof M&&A)D=m(t,R,M,D,0,0,A);else if("Binary"===M._bsontype)D=v(t,R,M,D);else if("Symbol"===M._bsontype)D=O(t,R,M,D);else if("DBRef"===M._bsontype)D=S(t,R,M,D,E,A);else if("BSONRegExp"===M._bsontype)D=c(t,R,M,D);else if("Int32"===M._bsontype)D=b(t,R,M,D);else if("MinKey"===M._bsontype||"MaxKey"===M._bsontype)D=l(t,R,M,D);else if(void 0!==M._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+M._bsontype)}}}I.pop(),t[D++]=0;var C=D-B;return t[B++]=255&C,t[B++]=C>>8&255,t[B++]=C>>16&255,t[B++]=C>>24&255,D}e.serializeInto=N}));i(Tt),Tt.serializeInto;var It=u((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectID=e.Decimal128=e.BSONRegExp=e.MaxKey=e.MinKey=e.Int32=e.Double=e.Timestamp=e.Long=e.UUID=e.ObjectId=e.Binary=e.DBRef=e.BSONSymbol=e.Map=e.Code=e.LongWithoutOverridesClass=e.EJSON=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=e.BSON_DATA_UNDEFINED=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_SYMBOL=e.BSON_DATA_STRING=e.BSON_DATA_REGEXP=e.BSON_DATA_OID=e.BSON_DATA_OBJECT=e.BSON_DATA_NUMBER=e.BSON_DATA_NULL=e.BSON_DATA_MIN_KEY=e.BSON_DATA_MAX_KEY=e.BSON_DATA_LONG=e.BSON_DATA_INT=e.BSON_DATA_DECIMAL128=e.BSON_DATA_DBPOINTER=e.BSON_DATA_DATE=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_CODE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=void 0,e.deserializeStream=e.calculateObjectSize=e.deserialize=e.serializeWithBufferAndIndex=e.serialize=e.setInternalBufferSize=void 0,Object.defineProperty(e,"Binary",{enumerable:!0,get:function(){return rt.Binary}}),Object.defineProperty(e,"Code",{enumerable:!0,get:function(){return nt.Code}}),Object.defineProperty(e,"DBRef",{enumerable:!0,get:function(){return ot.DBRef}}),Object.defineProperty(e,"Decimal128",{enumerable:!0,get:function(){return ut.Decimal128}}),Object.defineProperty(e,"Double",{enumerable:!0,get:function(){return st.Double}}),Object.defineProperty(e,"Int32",{enumerable:!0,get:function(){return ft.Int32}}),Object.defineProperty(e,"Long",{enumerable:!0,get:function(){return it.Long}}),Object.defineProperty(e,"Map",{enumerable:!0,get:function(){return Ot.Map}}),Object.defineProperty(e,"MaxKey",{enumerable:!0,get:function(){return at.MaxKey}}),Object.defineProperty(e,"MinKey",{enumerable:!0,get:function(){return ct.MinKey}}),Object.defineProperty(e,"ObjectId",{enumerable:!0,get:function(){return lt.ObjectId}}),Object.defineProperty(e,"ObjectID",{enumerable:!0,get:function(){return lt.ObjectId}}),Object.defineProperty(e,"BSONRegExp",{enumerable:!0,get:function(){return pt.BSONRegExp}}),Object.defineProperty(e,"BSONSymbol",{enumerable:!0,get:function(){return ht.BSONSymbol}}),Object.defineProperty(e,"Timestamp",{enumerable:!0,get:function(){return wt.Timestamp}}),Object.defineProperty(e,"UUID",{enumerable:!0,get:function(){return et.UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return St.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(e,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return St.BSON_DATA_ARRAY}}),Object.defineProperty(e,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return St.BSON_DATA_BINARY}}),Object.defineProperty(e,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return St.BSON_DATA_BOOLEAN}}),Object.defineProperty(e,"BSON_DATA_CODE",{enumerable:!0,get:function(){return St.BSON_DATA_CODE}}),Object.defineProperty(e,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return St.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(e,"BSON_DATA_DATE",{enumerable:!0,get:function(){return St.BSON_DATA_DATE}}),Object.defineProperty(e,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return St.BSON_DATA_DBPOINTER}}),Object.defineProperty(e,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return St.BSON_DATA_DECIMAL128}}),Object.defineProperty(e,"BSON_DATA_INT",{enumerable:!0,get:function(){return St.BSON_DATA_INT}}),Object.defineProperty(e,"BSON_DATA_LONG",{enumerable:!0,get:function(){return St.BSON_DATA_LONG}}),Object.defineProperty(e,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return St.BSON_DATA_MAX_KEY}}),Object.defineProperty(e,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return St.BSON_DATA_MIN_KEY}}),Object.defineProperty(e,"BSON_DATA_NULL",{enumerable:!0,get:function(){return St.BSON_DATA_NULL}}),Object.defineProperty(e,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return St.BSON_DATA_NUMBER}}),Object.defineProperty(e,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return St.BSON_DATA_OBJECT}}),Object.defineProperty(e,"BSON_DATA_OID",{enumerable:!0,get:function(){return St.BSON_DATA_OID}}),Object.defineProperty(e,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return St.BSON_DATA_REGEXP}}),Object.defineProperty(e,"BSON_DATA_STRING",{enumerable:!0,get:function(){return St.BSON_DATA_STRING}}),Object.defineProperty(e,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return St.BSON_DATA_SYMBOL}}),Object.defineProperty(e,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return St.BSON_DATA_TIMESTAMP}}),Object.defineProperty(e,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return St.BSON_DATA_UNDEFINED}}),Object.defineProperty(e,"BSON_INT32_MAX",{enumerable:!0,get:function(){return St.BSON_INT32_MAX}}),Object.defineProperty(e,"BSON_INT32_MIN",{enumerable:!0,get:function(){return St.BSON_INT32_MIN}}),Object.defineProperty(e,"BSON_INT64_MAX",{enumerable:!0,get:function(){return St.BSON_INT64_MAX}}),Object.defineProperty(e,"BSON_INT64_MIN",{enumerable:!0,get:function(){return St.BSON_INT64_MIN}});var r=vt;Object.defineProperty(e,"EJSON",{enumerable:!0,get:function(){return r.EJSON}});var n=wt;Object.defineProperty(e,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return n.LongWithoutOverridesClass}});var o=v.Buffer.alloc(17825792);function i(t){o.length<t&&(o=v.Buffer.alloc(t))}function u(t,e){void 0===e&&(e={});var r="boolean"==typeof e.checkKeys&&e.checkKeys,n="boolean"==typeof e.serializeFunctions&&e.serializeFunctions,i="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined,u="number"==typeof e.minInternalBufferSize?e.minInternalBufferSize:17825792;o.length<u&&(o=v.Buffer.alloc(u));var s=Tt.serializeInto(o,t,r,0,0,n,i,[]),f=v.Buffer.alloc(s);return o.copy(f,0,0,f.length),f}function s(t,e,r){void 0===r&&(r={});var n="boolean"==typeof r.checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,u="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,s="number"==typeof r.index?r.index:0,f=Tt.serializeInto(o,t,n,0,0,i,u);return o.copy(e,s,0,f),s+f-1}function f(t,e){return void 0===e&&(e={}),Et.deserialize(Q.ensureBuffer(t),e)}function a(t,e){void 0===e&&(e={});var r="boolean"==typeof(e=e||{}).serializeFunctions&&e.serializeFunctions,n="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined;return Nt.calculateObjectSize(t,r,n)}function c(t,e,r,n,o,i){for(var u=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},i),s=Q.ensureBuffer(t),f=e,a=0;a<r;a++){var c=s[f]|s[f+1]<<8|s[f+2]<<16|s[f+3]<<24;u.index=f,n[o+a]=Et.deserialize(s,u),f+=c}return f}e.setInternalBufferSize=i,e.serialize=u,e.serializeWithBufferAndIndex=s,e.deserialize=f,e.calculateObjectSize=a,e.deserializeStream=c;var l={Binary:rt.Binary,Code:nt.Code,DBRef:ot.DBRef,Decimal128:ut.Decimal128,Double:st.Double,Int32:ft.Int32,Long:it.Long,UUID:et.UUID,Map:Ot.Map,MaxKey:at.MaxKey,MinKey:ct.MinKey,ObjectId:lt.ObjectId,ObjectID:lt.ObjectId,BSONRegExp:pt.BSONRegExp,BSONSymbol:ht.BSONSymbol,Timestamp:wt.Timestamp,EJSON:vt.EJSON,setInternalBufferSize:i,serialize:u,serializeWithBufferAndIndex:s,deserialize:f,calculateObjectSize:a,deserializeStream:c};e.default=l})),Dt=(i(It),It.ObjectID,It.Decimal128,It.BSONRegExp,It.MaxKey,It.MinKey,It.Int32,It.Double,It.Timestamp,It.Long,It.UUID,It.ObjectId,It.Binary,It.DBRef,It.BSONSymbol,It.Map,It.Code,It.LongWithoutOverridesClass,It.EJSON);It.BSON_INT64_MIN,It.BSON_INT64_MAX,It.BSON_INT32_MIN,It.BSON_INT32_MAX,It.BSON_DATA_UNDEFINED,It.BSON_DATA_TIMESTAMP,It.BSON_DATA_SYMBOL,It.BSON_DATA_STRING,It.BSON_DATA_REGEXP,It.BSON_DATA_OID,It.BSON_DATA_OBJECT,It.BSON_DATA_NUMBER,It.BSON_DATA_NULL,It.BSON_DATA_MIN_KEY,It.BSON_DATA_MAX_KEY,It.BSON_DATA_LONG,It.BSON_DATA_INT,It.BSON_DATA_DECIMAL128,It.BSON_DATA_DBPOINTER,It.BSON_DATA_DATE,It.BSON_DATA_CODE_W_SCOPE,It.BSON_DATA_CODE,It.BSON_DATA_BOOLEAN,It.BSON_DATA_BINARY,It.BSON_DATA_ARRAY,It.BSON_BINARY_SUBTYPE_UUID_NEW,It.BSON_BINARY_SUBTYPE_UUID,It.BSON_BINARY_SUBTYPE_USER_DEFINED,It.BSON_BINARY_SUBTYPE_MD5,It.BSON_BINARY_SUBTYPE_FUNCTION,It.BSON_BINARY_SUBTYPE_DEFAULT,It.BSON_BINARY_SUBTYPE_BYTE_ARRAY,It.deserializeStream,It.calculateObjectSize,It.deserialize,It.serializeWithBufferAndIndex,It.serialize,It.setInternalBufferSize}).call(this,r(1),r(3).Buffer)},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";var n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.registerDatabase=void 0;var o=r(7);var i={name:"database",entity:{database:function(t){var e=this.platform,r=e.adapter,i=e.runtime;return o.Db.reqClass=this.request.constructor,o.Db.getAccessToken=this.authInstance?this.authInstance.getAccessToken.bind(this.authInstance):function(){return""},o.Db.runtime=i,this.wsClientClass&&(o.Db.wsClass=r.wsClass,o.Db.wsClientClass=this.wsClientClass),o.Db.ws||(o.Db.ws=null),new o.Db(n(n({},this.config),t))}}};try{cloudbase.registerComponent(i)}catch(t){}e.registerDatabase=function(t){try{t.registerComponent(i)}catch(t){console.warn(t)}}},function(t,e,r){"use strict";(function(t){
18
+ /*!
19
+ * The buffer module from node.js, for the browser.
20
+ *
21
+ * @author Feross Aboukhadijeh <http://feross.org>
22
+ * @license MIT
23
+ */
24
+ var n=r(4),o=r(5),i=r(6);function u(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(u()<e)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=f.prototype:(null===t&&(t=new f(e)),t.length=e),t}function f(t,e,r){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return a(this,t,e,r)}function a(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);f.TYPED_ARRAY_SUPPORT?(t=e).__proto__=f.prototype:t=p(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!f.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),o=(t=s(t,n)).write(e,r);o!==n&&(t=t.slice(0,o));return t}(t,e,r):function(t,e){if(f.isBuffer(e)){var r=0|h(e.length);return 0===(t=s(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):p(t,e);if("Buffer"===e.type&&i(e.data))return p(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(c(e),t=s(t,e<0?0:0|h(e)),!f.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function p(t,e){var r=e.length<0?0:0|h(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function h(t){if(t>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function d(t,e){if(f.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(n)return $(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return A(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=f.from(e,n)),f.isBuffer(e))return 0===e.length?-1:_(t,e,r,n,o);if("number"==typeof e)return e&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):_(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function _(t,e,r,n,o){var i,u=1,s=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,s/=2,f/=2,r/=2}function a(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}if(o){var c=-1;for(i=r;i<s;i++)if(a(t,i)===a(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===f)return c*u}else-1!==c&&(i-=i-c),c=-1}else for(r+f>s&&(r=s-f),i=r;i>=0;i--){for(var l=!0,p=0;p<f;p++)if(a(t,i+p)!==a(e,p)){l=!1;break}if(l)return i}return-1}function m(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;u<n;++u){var s=parseInt(e.substr(2*u,2),16);if(isNaN(s))return u;t[r+u]=s}return u}function w(t,e,r,n){return F($(e,t.length-r),t,r,n)}function v(t,e,r,n){return F(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function O(t,e,r,n){return v(t,e,r,n)}function S(t,e,r,n){return F(q(e),t,r,n)}function N(t,e,r,n){return F(function(t,e){for(var r,n,o,i=[],u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function B(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,u,s,f,a=t[o],c=null,l=a>239?4:a>223?3:a>191?2:1;if(o+l<=r)switch(l){case 1:a<128&&(c=a);break;case 2:128==(192&(i=t[o+1]))&&(f=(31&a)<<6|63&i)>127&&(c=f);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(f=(15&a)<<12|(63&i)<<6|63&u)>2047&&(f<55296||f>57343)&&(c=f);break;case 4:i=t[o+1],u=t[o+2],s=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&s)&&(f=(15&a)<<18|(63&i)<<12|(63&u)<<6|63&s)>65535&&f<1114112&&(c=f)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=f,e.SlowBuffer=function(t){+t!=t&&(t=0);return f.alloc(+t)},e.INSPECT_MAX_BYTES=50,f.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=u(),f.poolSize=8192,f._augment=function(t){return t.__proto__=f.prototype,t},f.from=function(t,e,r){return a(null,t,e,r)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},f.allocUnsafe=function(t){return l(null,t)},f.allocUnsafeSlow=function(t){return l(null,t)},f.isBuffer=function(t){return!(null==t||!t._isBuffer)},f.compare=function(t,e){if(!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=f.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var u=t[r];if(!f.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(n,o),o+=u.length}return n},f.byteLength=d,f.prototype._isBuffer=!0,f.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},f.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},f.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},f.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?E(this,0,t):y.apply(this,arguments)},f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},f.prototype.compare=function(t,e,r,n,o){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),u=(r>>>=0)-(e>>>=0),s=Math.min(i,u),a=this.slice(n,o),c=t.slice(e,r),l=0;l<s;++l)if(a[l]!==c[l]){i=a[l],u=c[l];break}return i<u?-1:u<i?1:0},f.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},f.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},f.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},f.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return O(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function T(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function I(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=Y(t[i]);return o}function D(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function x(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,o,i){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function P(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function U(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function L(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,n,i){return i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,i){return i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}f.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),f.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=f.prototype;else{var o=e-t;r=new f(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},f.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},f.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},f.prototype.readUInt8=function(t,e){return e||x(t,1,this.length),this[t]},f.prototype.readUInt16LE=function(t,e){return e||x(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUInt16BE=function(t,e){return e||x(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUInt32LE=function(t,e){return e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUInt32BE=function(t,e){return e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},f.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},f.prototype.readInt8=function(t,e){return e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,e){e||x(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt16BE=function(t,e){e||x(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt32LE=function(t,e){return e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,e){return e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readFloatLE=function(t,e){return e||x(t,4,this.length),o.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,e){return e||x(t,4,this.length),o.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,e){return e||x(t,8,this.length),o.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,e){return e||x(t,8,this.length),o.read(this,t,!1,52,8)},f.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||R(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},f.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||R(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},f.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,1,255,0),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},f.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},f.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},f.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},f.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},f.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);R(this,t,e,r,o-1,-o)}var i=0,u=1,s=0;for(this[e]=255&t;++i<r&&(u*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},f.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);R(this,t,e,r,o-1,-o)}var i=r-1,u=1,s=0;for(this[e+i]=255&t;--i>=0&&(u*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},f.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,1,127,-128),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},f.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},f.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},f.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},f.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),f.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},f.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},f.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},f.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},f.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},f.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<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),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!f.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},f.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var u=f.isBuffer(t)?t:$(new f(t,n).toString()),s=u.length;for(i=0;i<r-e;++i)this[i+e]=u[i%s]}return this};var C=/[^+\/0-9A-Za-z-_]/g;function Y(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],u=0;u<n;++u){if((r=t.charCodeAt(u))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function q(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(this,r(1))},function(t,e,r){"use strict";e.byteLength=function(t){var e=a(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=a(t),u=n[0],s=n[1],f=new i(function(t,e,r){return 3*(e+r)/4-r}(0,u,s)),c=0,l=s>0?u-4:u;for(r=0;r<l;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],f[c++]=e>>16&255,f[c++]=e>>8&255,f[c++]=255&e;2===s&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,f[c++]=255&e);1===s&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,f[c++]=e>>8&255,f[c++]=255&e);return f},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],u=0,s=r-o;u<s;u+=16383)i.push(c(t,u,u+16383>s?s:u+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,f=u.length;s<f;++s)n[s]=u[s],o[u.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var o,i,u=[],s=e;s<r;s+=3)o=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),u.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){
25
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
26
+ e.read=function(t,e,r,n,o){var i,u,s=8*o-n-1,f=(1<<s)-1,a=f>>1,c=-7,l=r?o-1:0,p=r?-1:1,h=t[e+l];for(l+=p,i=h&(1<<-c)-1,h>>=-c,c+=s;c>0;i=256*i+t[e+l],l+=p,c-=8);for(u=i&(1<<-c)-1,i>>=-c,c+=n;c>0;u=256*u+t[e+l],l+=p,c-=8);if(0===i)i=1-a;else{if(i===f)return u?NaN:1/0*(h?-1:1);u+=Math.pow(2,n),i-=a}return(h?-1:1)*u*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var u,s,f,a=8*i-o-1,c=(1<<a)-1,l=c>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=c):(u=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-u))<1&&(u--,f*=2),(e+=u+l>=1?p/f:p*Math.pow(2,1-l))*f>=2&&(u++,f/=2),u+l>=c?(s=0,u=c):u+l>=1?(s=(e*f-1)*Math.pow(2,o),u+=l):(s=e*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[r+h]=255&s,h+=d,s/=256,o-=8);for(u=u<<o|s,a+=o;a>0;t[r+h]=255&u,h+=d,u/=256,a-=8);t[r+h-d]|=128*y}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";r.r(e),r.d(e,"Query",(function(){return zt})),r.d(e,"CollectionReference",(function(){return Wt})),r.d(e,"DocumentReference",(function(){return $t})),r.d(e,"Db",(function(){return be}));var n,o,i={};r.r(i),r.d(i,"Point",(function(){return Q})),r.d(i,"LineString",(function(){return et})),r.d(i,"Polygon",(function(){return nt})),r.d(i,"MultiPoint",(function(){return it})),r.d(i,"MultiLineString",(function(){return st})),r.d(i,"MultiPolygon",(function(){return at})),function(t){t.DocIDError="文档ID不合法",t.CollNameError="集合名称不合法",t.OpStrError="操作符不合法",t.DirectionError="排序字符不合法",t.IntergerError="must be integer",t.QueryParamTypeError="查询参数必须为对象",t.QueryParamValueError="查询参数对象值不能均为undefined"}(o||(o={}));var u,s="Number",f="Object",a="Array",c="GeoPoint",l="GeoLineString",p="GeoPolygon",h="GeoMultiPoint",d="GeoMultiLineString",y="GeoMultiPolygon",g="Date",b="ServerDate",_="BsonDate",m=["desc","asc"],w=["<","<=","==",">=",">"];!function(t){t.lt="<",t.gt=">",t.lte="<=",t.gte=">=",t.eq="=="}(u||(u={}));var v;(n={})[u.eq]="$eq",n[u.lt]="$lt",n[u.lte]="$lte",n[u.gt]="$gt",n[u.gte]="$gte";!function(t){t.WHERE="WHERE",t.DOC="DOC"}(v||(v={}));var O,S=(O=function(t,e){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}O(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),N=[],B={},E=function(t){function e(e,r){if(r!==B)throw new TypeError("InternalSymbol cannot be constructed with new operator");return t.call(this,e)||this}return S(e,t),e.for=function(t){for(var r=0,n=N.length;r<n;r++)if(N[r].target===t)return N[r].instance;var o=new e(t,B);return N.push({target:t,instance:o}),o},e}((function(t){Object.defineProperties(this,{target:{enumerable:!1,writable:!1,configurable:!1,value:t}})})),A=E,T=A.for("UNSET_FIELD_NAME"),I=A.for("UPDATE_COMMAND"),D=A.for("QUERY_COMMAND"),x=A.for("LOGIC_COMMAND"),R=A.for("GEO_POINT"),P=A.for("SYMBOL_GEO_LINE_STRING"),U=A.for("SYMBOL_GEO_POLYGON"),L=A.for("SYMBOL_GEO_MULTI_POINT"),j=A.for("SYMBOL_GEO_MULTI_LINE_STRING"),M=A.for("SYMBOL_GEO_MULTI_POLYGON"),C=A.for("SERVER_DATE"),Y=A.for("REGEXP"),$=function(){function t(t){var e=(void 0===t?{}:t).offset,r=void 0===e?0:e;this.offset=r}return Object.defineProperty(t.prototype,"_internalType",{get:function(){return C},enumerable:!0,configurable:!0}),t.prototype.parse=function(){return{$date:{offset:this.offset}}},t}();function q(t){return new $(t)}var F,k=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u},z=function(){function t(){}return t.formatResDocumentData=function(e){return e.map((function(e){return t.formatField(e)}))},t.formatField=function(e){var r=Object.keys(e),n={};return Array.isArray(e)&&(n=[]),r.forEach((function(r){var o,i=e[r];switch(t.whichType(i)){case c:o=new Q(i.coordinates[0],i.coordinates[1]);break;case l:o=new et(i.coordinates.map((function(t){return new Q(t[0],t[1])})));break;case p:o=new nt(i.coordinates.map((function(t){return new et(t.map((function(t){var e=k(t,2),r=e[0],n=e[1];return new Q(r,n)})))})));break;case h:o=new it(i.coordinates.map((function(t){return new Q(t[0],t[1])})));break;case d:o=new st(i.coordinates.map((function(t){return new et(t.map((function(t){var e=k(t,2),r=e[0],n=e[1];return new Q(r,n)})))})));break;case y:o=new at(i.coordinates.map((function(t){return new nt(t.map((function(t){return new et(t.map((function(t){var e=k(t,2),r=e[0],n=e[1];return new Q(r,n)})))})))})));break;case g:o=new Date(1e3*i.$timestamp);break;case f:case a:o=t.formatField(i);break;case b:o=new Date(i.$date);break;default:o=i}Array.isArray(n)?n.push(o):n[r]=o})),n},t.whichType=function(t){var e=Object.prototype.toString.call(t).slice(8,-1);if(e===g)return _;if(e===f){if(t instanceof Q)return c;if(t instanceof Date)return g;if(t instanceof $)return b;t.$timestamp?e=g:t.$date?e=b:Q.validate(t)?e=c:et.validate(t)?e=l:nt.validate(t)?e=p:it.validate(t)?e=h:st.validate(t)?e=d:at.validate(t)&&(e=y)}return e},t.generateDocId=function(){for(var t="ABCDEFabcdef0123456789",e="",r=0;r<24;r++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},t}(),J=function(){function t(){}return t.isGeopoint=function(t,e){if(z.whichType(e)!==s)throw new Error("Geo Point must be number type");var r=Math.abs(e);if("latitude"===t&&r>90)throw new Error("latitude should be a number ranges from -90 to 90");if("longitude"===t&&r>180)throw new Error("longitude should be a number ranges from -180 to 180");return!0},t.isInteger=function(t,e){if(!Number.isInteger(e))throw new Error(t+o.IntergerError);return!0},t.isFieldOrder=function(t){if(-1===m.indexOf(t))throw new Error(o.DirectionError);return!0},t.isFieldPath=function(t){if(!/^[a-zA-Z0-9-_\.]/.test(t))throw new Error;return!0},t.isOperator=function(t){if(-1===w.indexOf(t))throw new Error(o.OpStrError);return!0},t.isCollName=function(t){if(!/^[a-zA-Z0-9]([a-zA-Z0-9-_]){1,32}$/.test(t))throw new Error(o.CollNameError);return!0},t.isDocID=function(t){if(!/^([a-fA-F0-9]){24}$/.test(t))throw new Error(o.DocIDError);return!0},t}(),G=function(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()},H=function(t){return"object"===G(t)},V=function(t){return"number"===G(t)},K=function(t){return Array.isArray(t)},W=function(t){return"date"===G(t)},X=function(t){return"regexp"===G(t)},Z=function(t){return t&&t._internalType instanceof E},Q=function(){function t(t,e){J.isGeopoint("longitude",t),J.isGeopoint("latitude",e),this.longitude=t,this.latitude=e}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Point",coordinates:[this.longitude,this.latitude]},e},t.prototype.toJSON=function(){return{type:"Point",coordinates:[this.longitude,this.latitude]}},t.prototype.toReadableString=function(){return"["+this.longitude+","+this.latitude+"]"},t.validate=function(t){return"Point"===t.type&&K(t.coordinates)&&J.isGeopoint("longitude",t.coordinates[0])&&J.isGeopoint("latitude",t.coordinates[1])},Object.defineProperty(t.prototype,"_internalType",{get:function(){return R},enumerable:!0,configurable:!0}),t}(),tt=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},et=function(){function t(t){if(!K(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(t.length<2)throw new Error('"points" must contain 2 points at least');t.forEach((function(t){if(!(t instanceof Q))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,r;if("LineString"!==t.type||!K(t.coordinates))return!1;try{for(var n=tt(t.coordinates),o=n.next();!o.done;o=n.next()){var i=o.value;if(!V(i[0])||!V(i[1]))return!1}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return!0},t.isClosed=function(t){var e=t.points[0],r=t.points[t.points.length-1];if(e.latitude===r.latitude&&e.longitude===r.longitude)return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return P},enumerable:!0,configurable:!0}),t}(),rt=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},nt=function(){function t(t){if(!K(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof et))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]");if(!et.isClosed(t))throw new Error("LineString "+t.points.map((function(t){return t.toReadableString()}))+" is not a closed cycle")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,r,n,o;if("Polygon"!==t.type||!K(t.coordinates))return!1;try{for(var i=rt(t.coordinates),u=i.next();!u.done;u=i.next()){var s=u.value;if(!this.isCloseLineString(s))return!1;try{for(var f=(n=void 0,rt(s)),a=f.next();!a.done;a=f.next()){var c=a.value;if(!V(c[0])||!V(c[1]))return!1}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return!0},t.isCloseLineString=function(t){var e=t[0],r=t[t.length-1];return e[0]===r[0]&&e[1]===r[1]},Object.defineProperty(t.prototype,"_internalType",{get:function(){return M},enumerable:!0,configurable:!0}),t}(),ot=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},it=function(){function t(t){if(!K(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(0===t.length)throw new Error('"points" must contain 1 point at least');t.forEach((function(t){if(!(t instanceof Q))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,r;if("MultiPoint"!==t.type||!K(t.coordinates))return!1;try{for(var n=ot(t.coordinates),o=n.next();!o.done;o=n.next()){var i=o.value;if(!V(i[0])||!V(i[1]))return!1}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return L},enumerable:!0,configurable:!0}),t}(),ut=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},st=function(){function t(t){if(!K(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof et))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,r,n,o;if("MultiLineString"!==t.type||!K(t.coordinates))return!1;try{for(var i=ut(t.coordinates),u=i.next();!u.done;u=i.next()){var s=u.value;try{for(var f=(n=void 0,ut(s)),a=f.next();!a.done;a=f.next()){var c=a.value;if(!V(c[0])||!V(c[1]))return!1}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return j},enumerable:!0,configurable:!0}),t}(),ft=function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},at=function(){function t(t){var e,r;if(!K(t))throw new TypeError('"polygons" must be of type Polygon[]. Received type '+typeof t);if(0===t.length)throw new Error("MultiPolygon must contain 1 polygon at least");try{for(var n=ft(t),o=n.next();!o.done;o=n.next()){var i=o.value;if(!(i instanceof nt))throw new TypeError('"polygon" must be of type Polygon[]. Received type '+typeof i+"[]")}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}this.polygons=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))},e},t.prototype.toJSON=function(){return{type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))}},t.validate=function(t){var e,r,n,o,i,u;if("MultiPolygon"!==t.type||!K(t.coordinates))return!1;try{for(var s=ft(t.coordinates),f=s.next();!f.done;f=s.next()){var a=f.value;try{for(var c=(n=void 0,ft(a)),l=c.next();!l.done;l=c.next()){var p=l.value;try{for(var h=(i=void 0,ft(p)),d=h.next();!d.done;d=h.next()){var y=d.value;if(!V(y[0])||!V(y[1]))return!1}}catch(t){i={error:t}}finally{try{d&&!d.done&&(u=h.return)&&u.call(h)}finally{if(i)throw i.error}}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{f&&!f.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return U},enumerable:!0,configurable:!0}),t}(),ct=function(){var t;if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var r=new Promise((function(e,r){t=function(t,n){return t?r(t):e(n)}}));return t.promise=r,t};!function(t){t.SET="set",t.REMOVE="remove",t.INC="inc",t.MUL="mul",t.PUSH="push",t.PULL="pull",t.PULL_ALL="pullAll",t.POP="pop",t.SHIFT="shift",t.UNSHIFT="unshift",t.ADD_TO_SET="addToSet",t.BIT="bit",t.RENAME="rename",t.MAX="max",t.MIN="min"}(F||(F={}));var lt=function(){function t(t,e,r){this._internalType=I,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=r||T}return t.prototype._setFieldName=function(e){return new t(this.operator,this.operands,e)},t}();function pt(t){return t&&t instanceof lt&&t._internalType===I}var ht;!function(t){t.AND="and",t.OR="or",t.NOT="not",t.NOR="nor"}(ht||(ht={}));var dt=function(){function t(t,e,r){if(this._internalType=x,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=r||T,this.fieldName!==T)if(Array.isArray(e)){e=e.slice(),this.operands=e;for(var n=0,o=e.length;n<o;n++){(yt(i=e[n])||mt(i))&&(e[n]=i._setFieldName(this.fieldName))}}else{var i;(yt(i=e)||mt(i))&&(e=i._setFieldName(this.fieldName))}}return t.prototype._setFieldName=function(e){var r=this.operands.map((function(r){return r instanceof t?r._setFieldName(e):r}));return new t(this.operator,r,e)},t.prototype.and=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return n.unshift(this),new t(ht.AND,n,this.fieldName)},t.prototype.or=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return n.unshift(this),new t(ht.OR,n,this.fieldName)},t}();function yt(t){return t&&t instanceof dt&&t._internalType===x}var gt,bt=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();!function(t){t.EQ="eq",t.NEQ="neq",t.GT="gt",t.GTE="gte",t.LT="lt",t.LTE="lte",t.IN="in",t.NIN="nin",t.ALL="all",t.ELEM_MATCH="elemMatch",t.EXISTS="exists",t.SIZE="size",t.MOD="mod",t.GEO_NEAR="geoNear",t.GEO_WITHIN="geoWithin",t.GEO_INTERSECTS="geoIntersects"}(gt||(gt={}));var _t=function(t){function e(e,r,n){var o=t.call(this,e,r,n)||this;return o.operator=e,o._internalType=D,o}return bt(e,t),e.prototype.toJSON=function(){var t,e;switch(this.operator){case gt.IN:case gt.NIN:return(t={})["$"+this.operator]=this.operands,t;default:return(e={})["$"+this.operator]=this.operands[0],e}},e.prototype._setFieldName=function(t){return new e(this.operator,this.operands,t)},e.prototype.eq=function(t){var r=new e(gt.EQ,[t],this.fieldName);return this.and(r)},e.prototype.neq=function(t){var r=new e(gt.NEQ,[t],this.fieldName);return this.and(r)},e.prototype.gt=function(t){var r=new e(gt.GT,[t],this.fieldName);return this.and(r)},e.prototype.gte=function(t){var r=new e(gt.GTE,[t],this.fieldName);return this.and(r)},e.prototype.lt=function(t){var r=new e(gt.LT,[t],this.fieldName);return this.and(r)},e.prototype.lte=function(t){var r=new e(gt.LTE,[t],this.fieldName);return this.and(r)},e.prototype.in=function(t){var r=new e(gt.IN,t,this.fieldName);return this.and(r)},e.prototype.nin=function(t){var r=new e(gt.NIN,t,this.fieldName);return this.and(r)},e.prototype.geoNear=function(t){if(!(t.geometry instanceof Q))throw new TypeError('"geometry" must be of type Point. Received type '+typeof t.geometry);if(void 0!==t.maxDistance&&!V(t.maxDistance))throw new TypeError('"maxDistance" must be of type Number. Received type '+typeof t.maxDistance);if(void 0!==t.minDistance&&!V(t.minDistance))throw new TypeError('"minDistance" must be of type Number. Received type '+typeof t.minDistance);var r=new e(gt.GEO_NEAR,[t],this.fieldName);return this.and(r)},e.prototype.geoWithin=function(t){if(!(t.geometry instanceof at||t.geometry instanceof nt))throw new TypeError('"geometry" must be of type Polygon or MultiPolygon. Received type '+typeof t.geometry);var r=new e(gt.GEO_WITHIN,[t],this.fieldName);return this.and(r)},e.prototype.geoIntersects=function(t){if(!(t.geometry instanceof Q||t.geometry instanceof et||t.geometry instanceof nt||t.geometry instanceof it||t.geometry instanceof st||t.geometry instanceof at))throw new TypeError('"geometry" must be of type Point, LineString, Polygon, MultiPoint, MultiLineString or MultiPolygon. Received type '+typeof t.geometry);var r=new e(gt.GEO_INTERSECTS,[t],this.fieldName);return this.and(r)},e}(dt);function mt(t){return t&&t instanceof _t&&t._internalType===D}function wt(t){return mt(t)}var vt={};for(var Ot in gt)vt[Ot]="$"+Ot;for(var Ot in ht)vt[Ot]="$"+Ot;for(var Ot in F)vt[Ot]="$"+Ot;function St(t){return vt[t]||"$"+t}vt[gt.NEQ]="$ne",vt[F.REMOVE]="$unset",vt[F.SHIFT]="$pop",vt[F.UNSHIFT]="$push";var Nt=function(){return(Nt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},Bt=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u},Et=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Bt(arguments[e]));return t};function At(t){return function t(e,r){if(!Z(e)){if(W(e))return{$date:+e};if(X(e))return{$regex:e.source,$options:e.flags};if(K(e))return e.map((function(e){if(r.indexOf(e)>-1)throw new Error("Cannot convert circular structure to JSON");return t(e,Et(r,[e]))}));if(H(e)){var n=Nt({},e);for(var o in n){if(r.indexOf(n[o])>-1)throw new Error("Cannot convert circular structure to JSON");n[o]=t(n[o],Et(r,[n[o]]))}return n}return e}switch(e._internalType){case R:return e.toJSON();case C:case Y:return e.parse();default:return e.toJSON?e.toJSON():e}}(t,[t])}var Tt=function(){return(Tt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},It=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u},Dt=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(It(arguments[e]));return t};function xt(t,e,r,n){var o=Tt({},t);for(var i in t)if(!/^\$/.test(i)){var u=t[i];if(u&&H(u)&&!e(u)){if(n.indexOf(u)>-1)throw new Error("Cannot convert circular structure to JSON");var s=xt(u,e,Dt(r,[i]),Dt(n,[u]));o[i]=s;var f=!1;for(var a in s)/^\$/.test(a)?f=!0:(o[i+"."+a]=s[a],delete o[i][a]);f||delete o[i]}}return o}function Rt(t){return xt(t,Ut,[],[t])}function Pt(t,e,r){for(var n in e[r]||delete t[r],e)t[n]?K(t[n])?t[n].push(e[n]):H(t[n])?H(e[n])?Object.assign(t[n],e[n]):(console.warn("unmergable condition, query is object but condition is "+G(e)+", can only overwrite",e,r),t[n]=e[n]):(console.warn("to-merge query is of type "+G(t)+", can only overwrite",t,e,r),t[n]=e[n]):t[n]=e[n]}function Ut(t){return Z(t)||W(t)||X(t)}function Lt(t){return At(t)}var jt=function(){function t(){}return t.encode=function(e){return(new t).encodeUpdate(e)},t.prototype.encodeUpdate=function(t){return pt(t)?this.encodeUpdateCommand(t):"object"===G(t)?this.encodeUpdateObject(t):t},t.prototype.encodeUpdateCommand=function(t){if(t.fieldName===T)throw new Error("Cannot encode a comparison command with unset field name");switch(t.operator){case F.PUSH:case F.PULL:case F.PULL_ALL:case F.POP:case F.SHIFT:case F.UNSHIFT:case F.ADD_TO_SET:return this.encodeArrayUpdateCommand(t);default:return this.encodeFieldUpdateCommand(t)}},t.prototype.encodeFieldUpdateCommand=function(t){var e,r,n,o,i=St(t.operator);switch(t.operator){case F.REMOVE:return(e={})[i]=((r={})[t.fieldName]="",r),e;default:return(n={})[i]=((o={})[t.fieldName]=t.operands[0],o),n}},t.prototype.encodeArrayUpdateCommand=function(t){var e,r,n,o,i,u,s,f,a,c,l=St(t.operator);switch(t.operator){case F.PUSH:var p=void 0;return p=K(t.operands)?{$each:t.operands.map(Lt)}:t.operands,(e={})[l]=((r={})[t.fieldName]=p,r),e;case F.UNSHIFT:p={$each:t.operands.map(Lt),$position:0};return(n={})[l]=((o={})[t.fieldName]=p,o),n;case F.POP:return(i={})[l]=((u={})[t.fieldName]=1,u),i;case F.SHIFT:return(s={})[l]=((f={})[t.fieldName]=-1,f),s;default:return(a={})[l]=((c={})[t.fieldName]=Lt(t.operands),c),a}},t.prototype.encodeUpdateObject=function(t){var e=Rt(t);for(var r in e)if(!/^\$/.test(r)){var n=e[r];if(pt(n)){e[r]=n._setFieldName(r),Pt(e,this.encodeUpdateCommand(e[r]),r)}else{e[r]=n=Lt(n);var o=new lt(F.SET,[n],r);Pt(e,this.encodeUpdateCommand(o),r)}}return e},t}(),Mt={};function Ct(t){if(!be.wsClientClass)throw new Error("to use realtime you must import realtime module first");var e=t.config.env;return Mt[e]||(Mt[e]=new be.wsClientClass({context:{appConfig:{docSizeLimit:1e3,realtimePingInterval:1e4,realtimePongWaitTimeout:5e3,request:new be.reqClass(t.config)}}})),Mt[e]}var Yt=function(){return(Yt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},$t=function(){function t(t,e,r,n){var o=this;void 0===n&&(n={}),this.watch=function(t){return Ct(o._db).watch(Yt(Yt({},t),{envId:o._db.config.env,collectionName:o._coll,query:JSON.stringify({_id:o.id})}))},this._db=t,this._coll=e,this.id=r,this.request=new be.reqClass(this._db.config),this.projection=n}return t.prototype.create=function(t,e){e=e||ct();var r={collectionName:this._coll,data:At(t)};return this.id&&(r._id=this.id),this.request.send("database.addDocument",r).then((function(t){t.code?e(0,t):e(0,{id:t.data._id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.set=function(t,e){if(e=e||ct(),!this.id)return Promise.resolve({code:"INVALID_PARAM",message:"docId不能为空"});if(!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var r=!1,n=function(t){if("object"==typeof t)for(var e in t)t[e]instanceof lt?r=!0:"object"==typeof t[e]&&n(t[e])};if(n(t),r)return Promise.resolve({code:"DATABASE_REQUEST_FAILED",message:"update operator complicit"});var o={collectionName:this._coll,queryType:v.DOC,data:At(t),multi:!1,merge:!1,upsert:!0};return this.id&&(o.query={_id:this.id}),this.request.send("database.updateDocument",o).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.update=function(t,e){if(e=e||ct(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var r={_id:this.id},n={collectionName:this._coll,data:jt.encode(t),query:r,queryType:v.DOC,multi:!1,merge:!0,upsert:!1};return this.request.send("database.updateDocument",n).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.remove=function(t){t=t||ct();var e={_id:this.id},r={collectionName:this._coll,query:e,queryType:v.DOC,multi:!1};return this.request.send("database.deleteDocument",r).then((function(e){e.code?t(0,e):t(0,{deleted:e.data.deleted,requestId:e.requestId})})).catch((function(e){t(e)})),t.promise},t.prototype.get=function(t){t=t||ct();var e={_id:this.id},r={collectionName:this._coll,query:e,queryType:v.DOC,multi:!1,projection:this.projection};return this.request.send("database.queryDocument",r).then((function(e){if(e.code)t(0,e);else{var r=z.formatResDocumentData(e.data.list);t(0,{data:r,requestId:e.requestId,total:e.TotalCount,limit:e.Limit,offset:e.Offset})}})).catch((function(e){t(e)})),t.promise},t.prototype.field=function(e){for(var r in e)e[r]?e[r]=1:e[r]=0;return new t(this._db,this._coll,this.id,e)},t}(),qt=function(){function t(){}return t.encode=function(t){return(new Ft).encodeQuery(t)},t}(),Ft=function(){function t(){}return t.prototype.encodeQuery=function(t,e){var r;return Ut(t)?yt(t)?this.encodeLogicCommand(t):mt(t)?this.encodeQueryCommand(t):((r={})[e]=this.encodeQueryObject(t),r):H(t)?this.encodeQueryObject(t):t},t.prototype.encodeRegExp=function(t){return{$regex:t.source,$options:t.flags}},t.prototype.encodeLogicCommand=function(t){var e,r,n,o,i,u,s,f=this;switch(t.operator){case ht.NOR:case ht.AND:case ht.OR:var a=St(t.operator),c=t.operands.map((function(e){return f.encodeQuery(e,t.fieldName)}));return(e={})[a]=c,e;case ht.NOT:a=St(t.operator);var l=t.operands[0];if(X(l))return(r={})[t.fieldName]=((n={})[a]=this.encodeRegExp(l),n),r;c=this.encodeQuery(l)[t.fieldName];return(o={})[t.fieldName]=((i={})[a]=c,i),o;default:a=St(t.operator);if(1===t.operands.length){var p=this.encodeQuery(t.operands[0]);return(u={})[a]=p,u}c=t.operands.map(this.encodeQuery.bind(this));return(s={})[a]=c,s}},t.prototype.encodeQueryCommand=function(t){return wt(t),this.encodeComparisonCommand(t)},t.prototype.encodeComparisonCommand=function(t){var e,r,n,o,i,u,s,f,a;if(t.fieldName===T)throw new Error("Cannot encode a comparison command with unset field name");var c=St(t.operator);switch(t.operator){case gt.EQ:case gt.NEQ:case gt.LT:case gt.LTE:case gt.GT:case gt.GTE:case gt.ELEM_MATCH:case gt.EXISTS:case gt.SIZE:case gt.MOD:return(e={})[t.fieldName]=((r={})[c]=Lt(t.operands[0]),r),e;case gt.IN:case gt.NIN:case gt.ALL:return(n={})[t.fieldName]=((o={})[c]=Lt(t.operands),o),n;case gt.GEO_NEAR:var l=t.operands[0];return(i={})[t.fieldName]={$nearSphere:{$geometry:l.geometry.toJSON(),$maxDistance:l.maxDistance,$minDistance:l.minDistance}},i;case gt.GEO_WITHIN:l=t.operands[0];return(u={})[t.fieldName]={$geoWithin:{$geometry:l.geometry.toJSON()}},u;case gt.GEO_INTERSECTS:l=t.operands[0];return(s={})[t.fieldName]={$geoIntersects:{$geometry:l.geometry.toJSON()}},s;default:return(f={})[t.fieldName]=((a={})[c]=Lt(t.operands[0]),a),f}},t.prototype.encodeQueryObject=function(t){var e=Rt(t);for(var r in e){var n=e[r];if(yt(n)){e[r]=n._setFieldName(r);var o=this.encodeLogicCommand(e[r]);this.mergeConditionAfterEncode(e,o,r)}else if(wt(n)){e[r]=n._setFieldName(r);o=this.encodeComparisonCommand(e[r]);this.mergeConditionAfterEncode(e,o,r)}else Ut(n)&&(e[r]=Lt(n))}return e},t.prototype.mergeConditionAfterEncode=function(t,e,r){for(var n in e[r]||delete t[r],e)t[n]?K(t[n])?t[n]=t[n].concat(e[n]):H(t[n])?H(e[n])?Object.assign(t,e):(console.warn("unmergable condition, query is object but condition is "+G(e)+", can only overwrite",e,r),t[n]=e[n]):(console.warn("to-merge query is of type "+G(t)+", can only overwrite",t,e,r),t[n]=e[n]):t[n]=e[n]},t}(),kt=function(){return(kt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},zt=function(){function t(t,e,r,n,o){var i=this;this.watch=function(t){return Ct(i._db).watch(kt(kt({},t),{envId:i._db.config.env,collectionName:i._coll,query:JSON.stringify(i._fieldFilters||{}),limit:i._queryOptions.limit,orderBy:i._fieldOrders?i._fieldOrders.reduce((function(t,e){return t[e.field]=e.direction,t}),{}):void 0}))},this._db=t,this._coll=e,this._fieldFilters=r,this._fieldOrders=n||[],this._queryOptions=o||{},this._request=new be.reqClass(this._db.config)}return t.prototype.get=function(t){t=t||ct();var e=[];this._fieldOrders&&this._fieldOrders.forEach((function(t){e.push(t)}));var r={collectionName:this._coll,queryType:v.WHERE};return this._fieldFilters&&(r.query=this._fieldFilters),e.length>0&&(r.order=e),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((function(e){if(e.code)t(0,e);else{var r={data:z.formatResDocumentData(e.data.list),requestId:e.requestId};e.TotalCount&&(r.total=e.TotalCount),e.Limit&&(r.limit=e.Limit),e.Offset&&(r.offset=e.Offset),t(0,r)}})).catch((function(e){t(e)})),t.promise},t.prototype.count=function(t){t=t||ct();var e={collectionName:this._coll,queryType:v.WHERE};return this._fieldFilters&&(e.query=this._fieldFilters),this._request.send("database.countDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,total:e.data.total})})).catch((function(e){t(e)})),t.promise},t.prototype.where=function(e){if("Object"!==Object.prototype.toString.call(e).slice(8,-1))throw Error(o.QueryParamTypeError);var r=Object.keys(e),n=r.some((function(t){return void 0!==e[t]}));if(r.length&&!n)throw Error(o.QueryParamValueError);return new t(this._db,this._coll,qt.encode(e),this._fieldOrders,this._queryOptions)},t.prototype.orderBy=function(e,r){J.isFieldPath(e),J.isFieldOrder(r);var n={field:e,direction:r},o=this._fieldOrders.concat(n);return new t(this._db,this._coll,this._fieldFilters,o,this._queryOptions)},t.prototype.limit=function(e){J.isInteger("limit",e);var r=kt({},this._queryOptions);return r.limit=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,r)},t.prototype.skip=function(e){J.isInteger("offset",e);var r=kt({},this._queryOptions);return r.offset=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,r)},t.prototype.update=function(t,e){if(e=e||ct(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var r={collectionName:this._coll,query:this._fieldFilters,queryType:v.WHERE,multi:!0,merge:!0,upsert:!1,data:jt.encode(t)};return this._request.send("database.updateDocument",r).then((function(t){t.code?e(0,t):e(0,{requestId:t.requestId,updated:t.data.updated,upsertId:t.data.upsert_id})})).catch((function(t){e(t)})),e.promise},t.prototype.field=function(e){for(var r in e)e[r]?"object"!=typeof e[r]&&(e[r]=1):e[r]=0;var n=kt({},this._queryOptions);return n.projection=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.remove=function(t){t=t||ct(),Object.keys(this._queryOptions).length>0&&console.warn("`offset`, `limit` and `projection` are not supported in remove() operation"),this._fieldOrders.length>0&&console.warn("`orderBy` is not supported in remove() operation");var e={collectionName:this._coll,query:qt.encode(this._fieldFilters),queryType:v.WHERE,multi:!0};return this._request.send("database.deleteDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,deleted:e.data.deleted})})).catch((function(e){t(e)})),t.promise},t}(),Jt=r(0),Gt=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{f(n.next(t))}catch(t){i(t)}}function s(t){try{f(n.throw(t))}catch(t){i(t)}}function f(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}f((n=n.apply(t,e||[])).next())}))},Ht=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Vt=function(){function t(t,e){this._stages=[],t&&e&&(this._db=t,this._request=new be.reqClass(this._db.config),this._collectionName=e)}return t.prototype.end=function(){return Gt(this,void 0,void 0,(function(){var t;return Ht(this,(function(e){switch(e.label){case 0:if(!this._collectionName||!this._db)throw new Error("Aggregation pipeline cannot send request");return[4,this._request.send("database.aggregate",{collectionName:this._collectionName,stages:this._stages})];case 1:return(t=e.sent())&&t.data&&t.data.list?[2,{requestId:t.requestId,data:JSON.parse(t.data.list).map(Jt.a.parse)}]:[2,t]}}))}))},t.prototype.unwrap=function(){return this._stages},t.prototype.done=function(){return this._stages.map((function(t){var e,r=t.stageKey,n=t.stageValue;return(e={})[r]=JSON.parse(n),e}))},t.prototype._pipe=function(t,e){return this._stages.push({stageKey:"$"+t,stageValue:JSON.stringify(e)}),this},t.prototype.addFields=function(t){return this._pipe("addFields",t)},t.prototype.bucket=function(t){return this._pipe("bucket",t)},t.prototype.bucketAuto=function(t){return this._pipe("bucketAuto",t)},t.prototype.count=function(t){return this._pipe("count",t)},t.prototype.geoNear=function(t){return this._pipe("geoNear",t)},t.prototype.group=function(t){return this._pipe("group",t)},t.prototype.limit=function(t){return this._pipe("limit",t)},t.prototype.match=function(t){return this._pipe("match",qt.encode(t))},t.prototype.project=function(t){return this._pipe("project",t)},t.prototype.lookup=function(t){return this._pipe("lookup",t)},t.prototype.replaceRoot=function(t){return this._pipe("replaceRoot",t)},t.prototype.sample=function(t){return this._pipe("sample",t)},t.prototype.skip=function(t){return this._pipe("skip",t)},t.prototype.sort=function(t){return this._pipe("sort",t)},t.prototype.sortByCount=function(t){return this._pipe("sortByCount",t)},t.prototype.unwind=function(t){return this._pipe("unwind",t)},t}(),Kt=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Wt=function(t){function e(e,r){return t.call(this,e,r)||this}return Kt(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new $t(this._db,this._coll,t)},e.prototype.add=function(t,e){return new $t(this._db,this._coll,void 0).create(t,e)},e.prototype.aggregate=function(){return new Vt(this._db,this._coll)},e}(zt),Xt={eq:function(t){return new _t(gt.EQ,[t])},neq:function(t){return new _t(gt.NEQ,[t])},lt:function(t){return new _t(gt.LT,[t])},lte:function(t){return new _t(gt.LTE,[t])},gt:function(t){return new _t(gt.GT,[t])},gte:function(t){return new _t(gt.GTE,[t])},in:function(t){return new _t(gt.IN,t)},nin:function(t){return new _t(gt.NIN,t)},all:function(t){return new _t(gt.ALL,t)},elemMatch:function(t){return new _t(gt.ELEM_MATCH,[t])},exists:function(t){return new _t(gt.EXISTS,[t])},size:function(t){return new _t(gt.SIZE,[t])},mod:function(t){return new _t(gt.MOD,[t])},geoNear:function(t){return new _t(gt.GEO_NEAR,[t])},geoWithin:function(t){return new _t(gt.GEO_WITHIN,[t])},geoIntersects:function(t){return new _t(gt.GEO_INTERSECTS,[t])},and:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=K(arguments[0])?arguments[0]:Array.from(arguments);return new dt(ht.AND,r)},nor:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=K(arguments[0])?arguments[0]:Array.from(arguments);return new dt(ht.NOR,r)},or:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=K(arguments[0])?arguments[0]:Array.from(arguments);return new dt(ht.OR,r)},not:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=K(arguments[0])?arguments[0]:Array.from(arguments);return new dt(ht.NOT,r)},set:function(t){return new lt(F.SET,[t])},remove:function(){return new lt(F.REMOVE,[])},inc:function(t){return new lt(F.INC,[t])},mul:function(t){return new lt(F.MUL,[t])},push:function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(H(e[0])&&e[0].hasOwnProperty("each")){var n=e[0];t={$each:n.each,$position:n.position,$sort:n.sort,$slice:n.slice}}else t=K(e[0])?e[0]:Array.from(e);return new lt(F.PUSH,t)},pull:function(t){return new lt(F.PULL,t)},pullAll:function(t){return new lt(F.PULL_ALL,t)},pop:function(){return new lt(F.POP,[])},shift:function(){return new lt(F.SHIFT,[])},unshift:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=K(arguments[0])?arguments[0]:Array.from(arguments);return new lt(F.UNSHIFT,r)},addToSet:function(t){return new lt(F.ADD_TO_SET,t)},rename:function(t){return new lt(F.RENAME,[t])},bit:function(t){return new lt(F.BIT,[t])},max:function(t){return new lt(F.MAX,[t])},min:function(t){return new lt(F.MIN,[t])},expr:function(t){return{$expr:t}},jsonSchema:function(t){return{$jsonSchema:t}},text:function(t){return"string"===G(t)?{$search:t.search}:{$search:t.search,$language:t.language,$caseSensitive:t.caseSensitive,$diacriticSensitive:t.diacriticSensitive}},aggregate:{pipeline:function(){return new Vt},abs:function(t){return new Zt("abs",t)},add:function(t){return new Zt("add",t)},ceil:function(t){return new Zt("ceil",t)},divide:function(t){return new Zt("divide",t)},exp:function(t){return new Zt("exp",t)},floor:function(t){return new Zt("floor",t)},ln:function(t){return new Zt("ln",t)},log:function(t){return new Zt("log",t)},log10:function(t){return new Zt("log10",t)},mod:function(t){return new Zt("mod",t)},multiply:function(t){return new Zt("multiply",t)},pow:function(t){return new Zt("pow",t)},sqrt:function(t){return new Zt("sqrt",t)},subtract:function(t){return new Zt("subtract",t)},trunc:function(t){return new Zt("trunc",t)},arrayElemAt:function(t){return new Zt("arrayElemAt",t)},arrayToObject:function(t){return new Zt("arrayToObject",t)},concatArrays:function(t){return new Zt("concatArrays",t)},filter:function(t){return new Zt("filter",t)},in:function(t){return new Zt("in",t)},indexOfArray:function(t){return new Zt("indexOfArray",t)},isArray:function(t){return new Zt("isArray",t)},map:function(t){return new Zt("map",t)},range:function(t){return new Zt("range",t)},reduce:function(t){return new Zt("reduce",t)},reverseArray:function(t){return new Zt("reverseArray",t)},size:function(t){return new Zt("size",t)},slice:function(t){return new Zt("slice",t)},zip:function(t){return new Zt("zip",t)},and:function(t){return new Zt("and",t)},not:function(t){return new Zt("not",t)},or:function(t){return new Zt("or",t)},cmp:function(t){return new Zt("cmp",t)},eq:function(t){return new Zt("eq",t)},gt:function(t){return new Zt("gt",t)},gte:function(t){return new Zt("gte",t)},lt:function(t){return new Zt("lt",t)},lte:function(t){return new Zt("lte",t)},neq:function(t){return new Zt("ne",t)},cond:function(t){return new Zt("cond",t)},ifNull:function(t){return new Zt("ifNull",t)},switch:function(t){return new Zt("switch",t)},dateFromParts:function(t){return new Zt("dateFromParts",t)},dateFromString:function(t){return new Zt("dateFromString",t)},dayOfMonth:function(t){return new Zt("dayOfMonth",t)},dayOfWeek:function(t){return new Zt("dayOfWeek",t)},dayOfYear:function(t){return new Zt("dayOfYear",t)},isoDayOfWeek:function(t){return new Zt("isoDayOfWeek",t)},isoWeek:function(t){return new Zt("isoWeek",t)},isoWeekYear:function(t){return new Zt("isoWeekYear",t)},millisecond:function(t){return new Zt("millisecond",t)},minute:function(t){return new Zt("minute",t)},month:function(t){return new Zt("month",t)},second:function(t){return new Zt("second",t)},hour:function(t){return new Zt("hour",t)},week:function(t){return new Zt("week",t)},year:function(t){return new Zt("year",t)},literal:function(t){return new Zt("literal",t)},mergeObjects:function(t){return new Zt("mergeObjects",t)},objectToArray:function(t){return new Zt("objectToArray",t)},allElementsTrue:function(t){return new Zt("allElementsTrue",t)},anyElementTrue:function(t){return new Zt("anyElementTrue",t)},setDifference:function(t){return new Zt("setDifference",t)},setEquals:function(t){return new Zt("setEquals",t)},setIntersection:function(t){return new Zt("setIntersection",t)},setIsSubset:function(t){return new Zt("setIsSubset",t)},setUnion:function(t){return new Zt("setUnion",t)},concat:function(t){return new Zt("concat",t)},dateToString:function(t){return new Zt("dateToString",t)},indexOfBytes:function(t){return new Zt("indexOfBytes",t)},indexOfCP:function(t){return new Zt("indexOfCP",t)},split:function(t){return new Zt("split",t)},strLenBytes:function(t){return new Zt("strLenBytes",t)},strLenCP:function(t){return new Zt("strLenCP",t)},strcasecmp:function(t){return new Zt("strcasecmp",t)},substr:function(t){return new Zt("substr",t)},substrBytes:function(t){return new Zt("substrBytes",t)},substrCP:function(t){return new Zt("substrCP",t)},toLower:function(t){return new Zt("toLower",t)},toUpper:function(t){return new Zt("toUpper",t)},meta:function(t){return new Zt("meta",t)},addToSet:function(t){return new Zt("addToSet",t)},avg:function(t){return new Zt("avg",t)},first:function(t){return new Zt("first",t)},last:function(t){return new Zt("last",t)},max:function(t){return new Zt("max",t)},min:function(t){return new Zt("min",t)},push:function(t){return new Zt("push",t)},stdDevPop:function(t){return new Zt("stdDevPop",t)},stdDevSamp:function(t){return new Zt("stdDevSamp",t)},sum:function(t){return new Zt("sum",t)},let:function(t){return new Zt("let",t)}},project:{slice:function(t){return new Qt("slice",t)},elemMatch:function(t){return new Qt("elemMatch",t)}}},Zt=function(t,e){this["$"+t]=e},Qt=function(t,e){this["$"+t]=e},te=function(){function t(t){var e=t.regexp,r=t.options;if(!e)throw new TypeError("regexp must be a string");this.$regex=e,this.$options=r}return t.prototype.parse=function(){return{$regex:this.$regex,$options:this.$options}},Object.defineProperty(t.prototype,"_internalType",{get:function(){return Y},enumerable:!0,configurable:!0}),t}();function ee(t){return new te(t)}var re={code:"INSERT_DOC_FAIL",message:"insert document failed"},ne={code:"DATABASE_TRANSACTION_CONFLICT",message:"database transaction conflict"},oe=function(){return(oe=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},ie=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{f(n.next(t))}catch(t){i(t)}}function s(t){try{f(n.throw(t))}catch(t){i(t)}}function f(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}f((n=n.apply(t,e||[])).next())}))},ue=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},se="database.updateDocInTransaction",fe=function(){function t(t,e,r){this._coll=e,this.id=r,this._transaction=t,this._request=this._transaction.getRequestMethod(),this._transactionId=this._transaction.getTransactionId()}return t.prototype.create=function(t){return ie(this,void 0,void 0,(function(){var e,r,n,o;return ue(this,(function(i){switch(i.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,data:Jt.a.stringify(At(t),{relaxed:!1})},this.id&&(e._id=this.id),[4,this._request.send("database.insertDocInTransaction",e)];case 1:if((r=i.sent()).code)throw r;if(n=Jt.a.parse(r.inserted),1==(o=Jt.a.parse(r.ok))&&1==n)return[2,oe(oe({},r),{ok:o,inserted:n})];throw new Error(re.message)}}))}))},t.prototype.get=function(){return ie(this,void 0,void 0,(function(){var t,e;return ue(this,(function(r){switch(r.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.getInTransaction",t)];case 1:if((e=r.sent()).code)throw e;return[2,{data:"null"!==e.data?z.formatField(Jt.a.parse(e.data)):Jt.a.parse(e.data),requestId:e.requestId}]}}))}))},t.prototype.set=function(t){return ie(this,void 0,void 0,(function(){var e,r;return ue(this,(function(n){switch(n.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Jt.a.stringify(At(t),{relaxed:!1}),upsert:!0},[4,this._request.send(se,e)];case 1:if((r=n.sent()).code)throw r;return[2,oe(oe({},r),{updated:Jt.a.parse(r.updated),upserted:r.upserted?JSON.parse(r.upserted):null})]}}))}))},t.prototype.update=function(t){return ie(this,void 0,void 0,(function(){var e,r;return ue(this,(function(n){switch(n.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:Jt.a.stringify(jt.encode(t),{relaxed:!1})},[4,this._request.send(se,e)];case 1:if((r=n.sent()).code)throw r;return[2,oe(oe({},r),{updated:Jt.a.parse(r.updated)})]}}))}))},t.prototype.delete=function(){return ie(this,void 0,void 0,(function(){var t,e;return ue(this,(function(r){switch(r.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.deleteDocInTransaction",t)];case 1:if((e=r.sent()).code)throw e;return[2,oe(oe({},e),{deleted:Jt.a.parse(e.deleted)})]}}))}))},t}(),ae=function(t,e){this._coll=e,this._transaction=t},ce=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),le=function(t){function e(e,r){return t.call(this,e,r)||this}return ce(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new fe(this._transaction,this._coll,t)},e.prototype.add=function(t){var e;return void 0!==t._id&&(e=t._id),new fe(this._transaction,this._coll,e).create(t)},e}(ae),pe=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{f(n.next(t))}catch(t){i(t)}}function s(t){try{f(n.throw(t))}catch(t){i(t)}}function f(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}f((n=n.apply(t,e||[])).next())}))},he=function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},de=function(){function t(t){this._db=t,this._request=new be.reqClass(this._db.config),this.aborted=!1,this.commited=!1,this.inited=!1}return t.prototype.init=function(){return pe(this,void 0,void 0,(function(){var t;return he(this,(function(e){switch(e.label){case 0:return[4,this._request.send("database.startTransaction")];case 1:if((t=e.sent()).code)throw t;return this.inited=!0,this._id=t.transactionId,[2]}}))}))},t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new le(this,t)},t.prototype.getTransactionId=function(){return this._id},t.prototype.getRequestMethod=function(){return this._request},t.prototype.commit=function(){return pe(this,void 0,void 0,(function(){var t,e;return he(this,(function(r){switch(r.label){case 0:return t={transactionId:this._id},[4,this._request.send("database.commitTransaction",t)];case 1:if((e=r.sent()).code)throw e;return this.commited=!0,[2,e]}}))}))},t.prototype.rollback=function(t){return pe(this,void 0,void 0,(function(){var e,r;return he(this,(function(n){switch(n.label){case 0:return e={transactionId:this._id},[4,this._request.send("database.abortTransaction",e)];case 1:if((r=n.sent()).code)throw r;return this.aborted=!0,this.abortReason=t,[2,r]}}))}))},t}();function ye(){return pe(this,void 0,void 0,(function(){var t;return he(this,(function(e){switch(e.label){case 0:return[4,(t=new de(this)).init()];case 1:return e.sent(),[2,t]}}))}))}function ge(t,e){return void 0===e&&(e=3),pe(this,void 0,void 0,(function(){var r,n,o,i,u=this;return he(this,(function(s){switch(s.label){case 0:return s.trys.push([0,4,,10]),[4,(r=new de(this)).init()];case 1:return s.sent(),[4,t(r)];case 2:if(n=s.sent(),!0===r.aborted)throw r.abortReason;return[4,r.commit()];case 3:return s.sent(),[2,n];case 4:if(o=s.sent(),!1===r.inited)throw o;return i=function(t){return pe(u,void 0,void 0,(function(){return he(this,(function(e){switch(e.label){case 0:if(r.aborted||r.commited)return[3,5];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,r.rollback()];case 2:return e.sent(),[3,4];case 3:return e.sent(),[3,4];case 4:throw t;case 5:if(!0===r.aborted)throw r.abortReason;throw t}}))}))},e<=0?[4,i(o)]:[3,6];case 5:s.sent(),s.label=6;case 6:return o&&o.code===ne.code?[4,ge.bind(this)(t,--e)]:[3,8];case 7:return[2,s.sent()];case 8:return[4,i(o)];case 9:return s.sent(),[3,10];case 10:return[2]}}))}))}var be=function(){function t(t){this.config=t,this.Geo=i,this.serverDate=q,this.command=Xt,this.RegExp=ee,this.startTransaction=ye,this.runTransaction=ge,this.logicCommand=dt,this.updateCommand=lt,this.queryCommand=_t}return t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new Wt(this,t)},t.prototype.createCollection=function(e){var r={collectionName:e};return new t.reqClass(this.config).send("database.addCollection",r)},t}()}])}));