@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 @@
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(function(){try{return require("null")}catch(t){}}()):"function"==typeof define&&define.amd?define("cloudbase_functions",["null"],e):"object"==typeof exports?exports.cloudbase_functions=e(function(){try{return require("null")}catch(t){}}()):t.cloudbase_functions=e(t.null)}("undefined"!=typeof window?window:this,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=6)}([function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.throwError=e.printInfo=e.printError=e.printWarn=e.execCallback=e.createPromiseCallback=e.removeParam=e.getHash=e.getQuery=e.toQueryString=e.createSign=e.formatUrl=e.genSeqId=e.isFormData=e.isInstanceOf=e.isNull=e.isPalinObject=e.isUndefined=e.isString=e.isArray=void 0;var o=r(n(11)),i=r(n(16)),s=r(n(17)),a=n(3);function u(t){var e=i.default.stringify(t);return e=(e=(e=e.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}e.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},e.isString=function(t){return"string"==typeof t},e.isUndefined=function(t){return void 0===t},e.isPalinObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},e.isNull=function(t){return"[object Null]"===Object.prototype.toString.call(t)},e.isInstanceOf=function(t,e){return t instanceof e},e.isFormData=function(t){return"[object FormData]"===Object.prototype.toString.call(t)},e.genSeqId=function(){return Math.random().toString(16).slice(2)},e.formatUrl=function(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";for(var i in n)""===o?!r&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(n[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e},e.createSign=function(t,e){var n=u(s.default.parse(JSON.stringify({alg:"HS256",typ:"JWT"})))+"."+u(s.default.parse(JSON.stringify(t)));return n+"."+u(o.default(n,e))},e.toQueryString=function(t){void 0===t&&(t={});var e=[];for(var n in t)e.push(n+"="+encodeURIComponent(t[n]));return e.join("&")},e.getQuery=function(t,e){if("undefined"==typeof window)return!1;var n=e||window.location.search,r=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),o=n.substr(n.indexOf("?")+1).match(r);return null!=o?o[2]:""},e.getHash=function(t){if("undefined"==typeof window)return"";var e=window.location.hash.match(new RegExp("[#?&/]"+t+"=([^&#]*)"));return e?e[1]:""},e.removeParam=function(t,e){var n=e.split("?")[0],r=[],o=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==o){for(var i=(r=o.split("&")).length-1;i>=0;i-=1)r[i].split("=")[0]===t&&r.splice(i,1);n=n+"?"+r.join("&")}return n},e.createPromiseCallback=function(){var t;if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var n=new Promise((function(e,n){t=function(t,r){return t?n(t):e(r)}}));return t.promise=n,t},e.execCallback=function(t,e,n){if(void 0===n&&(n=null),t&&"function"==typeof t)return t(e,n);if(e)throw e;return n},e.printWarn=function(t,e){console.warn("["+a.SDK_NAME+"]["+t+"]:"+e)},e.printError=function(t,e){console.error({code:t,msg:"["+a.SDK_NAME+"]["+t+"]:"+e})},e.printInfo=function(t,e){console.log("["+a.SDK_NAME+"]["+t+"]:"+e)},e.throwError=function(t,e){throw new Error(JSON.stringify({code:t,msg:"["+a.SDK_NAME+"]["+t+"]:"+e}))}},function(t,e,n){(function(e){var r;t.exports=(r=r||function(t,r){var o;if("undefined"!=typeof window&&window.crypto&&(o=window.crypto),!o&&"undefined"!=typeof window&&window.msCrypto&&(o=window.msCrypto),!o&&void 0!==e&&e.crypto&&(o=e.crypto),!o)try{o=n(13)}catch(t){}var i=function(){if(o){if("function"==typeof o.getRandomValues)try{return o.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof o.randomBytes)try{return o.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),a={},u=a.lib={},c=u.Base={extend:function(t){var e=s(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},f=u.WordArray=c.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||p).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var s=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=s<<24-(r+i)%4*8}else for(i=0;i<o;i+=4)e[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(i());return new f.init(e,t)}}),l=a.enc={},p=l.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new f.init(n,e/2)}},h=l.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new f.init(n,e)}},d=l.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},v=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,r=this._data,o=r.words,i=r.sigBytes,s=this.blockSize,a=i/(4*s),u=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,c=t.min(4*u,i);if(u){for(var l=0;l<u;l+=s)this._doProcessBlock(o,l);n=o.splice(0,u),r.sigBytes-=c}return new f.init(n,c)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),y=(u.Hasher=v.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new y.HMAC.init(t,n).finalize(e)}}}),a.algo={});return a}(Math),r)}).call(this,n(12))},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.events=e.cache=e.adapters=e.constants=void 0;var s=i(n(3));e.constants=s;var a=i(n(9));e.adapters=a;var u=i(n(18));e.cache=u;var c=i(n(20));e.events=c;var f=i(n(0));e.utils=f},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),o(n(4),e),o(n(8),e)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PROTOCOL=e.SDK_NAME=void 0,e.SDK_NAME="@cloudbase/js-sdk",e.PROTOCOL="https:"},function(t,e,n){"use strict";var r;n.r(e),n.d(e,"StorageType",(function(){return r})),n.d(e,"AbstractSDKRequest",(function(){return o})),n.d(e,"AbstractStorage",(function(){return i})),n.d(e,"formatUrl",(function(){return s})),function(t){t.local="local",t.none="none",t.session="session"}(r||(r={}));var o=function(){},i=function(){};function s(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";for(var i in n)""===o?!r&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(n[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.registerFunctions=void 0;var r=n(7);Object.defineProperty(e,"registerFunctions",{enumerable:!0,get:function(){return r.registerFunctions}})},function(t,e,n){"use strict";n.r(e),n.d(e,"registerFunctions",(function(){return f}));var r=n(2),o=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},i=function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=r.constants.SDK_NAME,a=r.constants.ERRORS,u=r.utils.execCallback,c={name:"functions",entity:{callFunction:function(t,e){return o(this,void 0,void 0,(function(){var n,r,o,c,f,l,p,h,d,v,y,_;return i(this,(function(i){switch(i.label){case 0:n=t.name,r=t.data,o=t.query,c=t.parse,f=t.search,n||u(e,new Error("["+s+"]["+a.INVALID_PARAMS+"][functions.callFunction] invalid name"));try{l=r?JSON.stringify(r):""}catch(t){u(e,new Error("["+s+"]["+a.INVALID_PARAMS+"][functions.callFunction] invalid data"))}p="functions.invokeFunction",h={inQuery:o,parse:c,search:f,function_name:n,request_data:l},d=this.request,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,d.send(p,h)];case 2:if((v=i.sent()).code)return[2,u(e,null,v)];if(y=v.data.response_data,c)return[2,u(e,null,{result:y,requestId:v.requestId})];try{return y=JSON.parse(v.data.response_data),[2,u(e,null,{result:y,requestId:v.requestId})]}catch(t){u(e,new Error("["+s+"]["+a.INVALID_PARAMS+"][functions.callFunction] response data must be json"))}return[3,4];case 3:return _=i.sent(),u(e,_),[3,4];case 4:return[2]}}))}))}}};try{cloudbase.registerComponent(c)}catch(t){}function f(t){t.registerComponent(c)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ERRORS=void 0,e.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},function(t,e,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.useDefaultAdapter=e.useAdapters=e.RUNTIME=void 0;var s,a=i(n(10)),u=n(0);!function(t){t.WEB="web",t.WX_MP="wx_mp"}(s=e.RUNTIME||(e.RUNTIME={})),e.useAdapters=function(t){for(var e=0,n=u.isArray(t)?t:[t];e<n.length;e++){var r=n[e],o=r.isMatch,i=r.genAdapter,s=r.runtime;if(o())return{adapter:i(),runtime:s}}},e.useDefaultAdapter=function(){return{adapter:a.genAdapter(),runtime:s.WEB}}},function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},s=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.WebRequest=e.genAdapter=void 0;var u=n(5),c=n(0),f=n(4),l=function(t){function e(e){var n=t.call(this)||this,r=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return n._timeout=r||0,n._timeoutMsg=o||"请求超时",n._restrictedMethods=i||["get","post","upload","download"],n}return o(e,t),e.prototype.get=function(t){return this._request(i(i({},t),{method:"get"}),this._restrictedMethods.includes("get"))},e.prototype.post=function(t){return this._request(i(i({},t),{method:"post"}),this._restrictedMethods.includes("post"))},e.prototype.put=function(t){return this._request(i(i({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,o=new FormData;for(var s in e)o.append(s,e[s]);return o.append("key",r),o.append("file",n),this._request(i(i({},t),{data:o,method:"post"}),this._restrictedMethods.includes("upload"))},e.prototype.download=function(t){return s(this,void 0,void 0,(function(){var e,n;return a(this,(function(r){return e=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(n=document.createElement("a")).href=t.url,n.setAttribute("download",e),n.setAttribute("target","_blank"),document.body.appendChild(n),n.click(),[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}))}))},e.prototype._request=function(t,e){var n=this;void 0===e&&(e=!1);var r=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=t.url,u=t.headers,l=void 0===u?{}:u,p=t.data,h=t.responseType,d=t.withCredentials,v=t.body,y=t.onUploadProgress,_=c.formatUrl(f.PROTOCOL,a,"get"===r?p:{}),g=new XMLHttpRequest;for(var m in g.open(r,_),h&&(g.responseType=h),l)g.setRequestHeader(m,l[m]);y&&g.addEventListener("progress",y),g.onreadystatechange=function(){var t={};if(4===g.readyState){var e=g.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),r=e.shift().toLowerCase(),o=e.join(": ");n[r]=o})),t.header=n,t.statusCode=g.status;try{t.data=JSON.parse(g.responseText)}catch(e){t.data=g.responseText}clearTimeout(i),o(t)}},e&&n._timeout&&(i=setTimeout((function(){console.warn(n._timeoutMsg),g.abort()}),n._timeout)),s=c.isFormData(p)?p:"application/x-www-form-urlencoded"===l["content-type"]?c.toQueryString(p):v||(p?JSON.stringify(p):void 0),d&&(g.withCredentials=!0),g.send(s)}))},e}(u.AbstractSDKRequest);e.WebRequest=l,e.genAdapter=function(){return{root:window,reqClass:l,wsClass:WebSocket,localStorage:localStorage,sessionStorage:sessionStorage}}},function(t,e,n){var r;t.exports=(r=n(1),n(14),n(15),r.HmacSHA256)},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(e,n){if(void 0===t){var r=new Error("Cannot find module 'null'");throw r.code="MODULE_NOT_FOUND",r}e.exports=t},function(t,e,n){var r;t.exports=(r=n(1),function(t){var e=r,n=e.lib,o=n.WordArray,i=n.Hasher,s=e.algo,a=[],u=[];!function(){function e(e){for(var n=t.sqrt(e),r=2;r<=n;r++)if(!(e%r))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var r=2,o=0;o<64;)e(r)&&(o<8&&(a[o]=n(t.pow(r,.5))),u[o]=n(t.pow(r,1/3)),o++),r++}();var c=[],f=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],s=n[3],a=n[4],f=n[5],l=n[6],p=n[7],h=0;h<64;h++){if(h<16)c[h]=0|t[e+h];else{var d=c[h-15],v=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=c[h-2],_=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[h]=v+c[h-7]+_+c[h-16]}var g=r&o^r&i^o&i,m=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),b=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&f^~a&l)+u[h]+c[h];p=l,l=f,f=a,a=s+b|0,s=i,i=o,o=r,r=b+(m+g)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+f|0,n[6]=n[6]+l|0,n[7]=n[7]+p|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=t.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(f),e.HmacSHA256=i._createHmacHelper(f)}(Math),r.SHA256)},function(t,e,n){var r,o,i,s;t.exports=(r=n(1),i=(o=r).lib.Base,s=o.enc.Utf8,void(o.algo.HMAC=i.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=s.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),i=this._iKey=e.clone(),a=o.words,u=i.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;o.sigBytes=i.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})))},function(t,e,n){var r,o,i;t.exports=(i=n(1),o=(r=i).lib.WordArray,r.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,r=this._map;t.clamp();for(var o=[],i=0;i<n;i+=3)for(var s=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<n;a++)o.push(r.charAt(s>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(t){var e=t.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var i=0;i<n.length;i++)r[n.charCodeAt(i)]=i}var s=n.charAt(64);if(s){var a=t.indexOf(s);-1!==a&&(e=a)}return function(t,e,n){for(var r=[],i=0,s=0;s<e;s++)if(s%4){var a=n[t.charCodeAt(s-1)]<<s%4*2,u=n[t.charCodeAt(s)]>>>6-s%4*2,c=a|u;r[i>>>2]|=c<<24-i%4*8,i++}return o.create(r,i)}(t,e,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},function(t,e,n){var r;t.exports=(r=n(1),r.enc.Utf8)},function(t,e,n){"use strict";(function(t){var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.CloudbaseCache=void 0;var a=n(5),u=n(0),c=n(3),f=function(t){function e(e){var n=t.call(this)||this;return n._root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return o(e,t),e.prototype.setItem=function(t,e){this._root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this._root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this._root.tcbCacheObject[t]},e.prototype.clear=function(){delete this._root.tcbCacheObject},e}(a.AbstractStorage);function l(t,e){switch(t){case"local":return e.localStorage?e.localStorage:(u.printWarn(c.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new f(e.root));case"none":return new f(e.root);default:return e.sessionStorage?e.sessionStorage:(u.printWarn(c.ERRORS.INVALID_PARAMS,"sessionStorage is not supported on current platform"),new f(e.root))}}var p=function(){function e(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,o=t.keys,i=void 0===o?{}:o,s=t.alwaysLocalKeys,a=void 0===s?[]:s;this._platformInfo=r,this._alwaysLocalKeys=a,this._storage||(this._persistence=r.adapter.primaryStorage||e,this._storage=l(this._persistence,r.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this._storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this._persistence},enumerable:!1,configurable:!0}),e.prototype.updatePersistence=function(t){if("async"!==this.mode){if(t!==this._persistence){var e="local"===this._persistence;this._persistence=t;var n=l(t,this._platformInfo.adapter);for(var r in this.keys){var o=this.keys[r];if(!e||!this._alwaysLocalKeys.includes(r)){var i=this._storage.getItem(o);u.isUndefined(i)||u.isNull(i)||(n.setItem(o,i),this._storage.removeItem(o))}}this._storage=n}}else u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use updatePersistenceAsync insteed")},e.prototype.updatePersistenceAsync=function(t){return i(this,void 0,void 0,(function(){var e,n,r,o,i,a,c,f;return s(this,(function(s){switch(s.label){case 0:if(t===this._persistence)return[2];for(o in e="local"===this._persistence,this._persistence=t,n=l(t,this._platformInfo.adapter),r=[],this.keys)r.push(o);i=0,s.label=1;case 1:return i<r.length?(a=r[i],c=this.keys[a],e&&this._alwaysLocalKeys.includes(a)?[3,4]:[4,this._storage.getItem(c)]):[3,5];case 2:return f=s.sent(),u.isUndefined(f)||u.isNull(f)?[3,4]:(n.setItem(c,f),[4,this._storage.removeItem(c)]);case 3:s.sent(),s.label=4;case 4:return i++,[3,1];case 5:return this._storage=n,[2]}}))}))},e.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this._storage)try{var r={version:n||"localCachev1",content:e};this._storage.setItem(t,JSON.stringify(r))}catch(t){return}}else u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(t,e,n){return i(this,void 0,void 0,(function(){var r;return s(this,(function(o){switch(o.label){case 0:if(!this._storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),r={version:n||"localCachev1",content:e},[4,this._storage.setItem(t,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,n){var r;if("async"!==this.mode){try{if(void 0!==t&&(null===(r=t.env)||void 0===r?void 0:r.tcb_token))return t.env.tcb_token;if(!this._storage)return""}catch(t){return""}n=n||"localCachev1";var o=this._storage.getItem(e);return o&&o.indexOf(n)>=0?JSON.parse(o).content:""}u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,n){var r;return i(this,void 0,void 0,(function(){var o;return s(this,(function(i){switch(i.label){case 0:try{if(void 0!==t&&(null===(r=t.env)||void 0===r?void 0:r.tcb_token))return[2,t.env.tcb_token];if(!this._storage)return[2,""]}catch(t){return[2,""]}return n=n||"localCachev1",[4,this._storage.getItem(e)];case 1:return(o=i.sent())&&o.indexOf(n)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},e.prototype.removeStore=function(t){"async"!==this.mode?this._storage.removeItem(t):u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this._storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},e}();e.CloudbaseCache=p}).call(this,n(19))},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],f=!1,l=-1;function p(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&h())}function h(){if(!f){var t=a(p);f=!0;for(var e=c.length;e;){for(u=c,c=[];++l<e;)u&&u[l].run();l=-1,e=c.length}u=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new d(t,e)),1!==c.length||f||a(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r};Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.activateEvent=e.addEventListener=e.CloudbaseEventEmitter=e.IErrorEvent=e.CloudbaseEvent=void 0;var s=n(0);var a=function(t,e){this.data=e||null,this.name=t};e.CloudbaseEvent=a;var u=function(t){function e(e,n){var r=t.call(this,"error",{error:e,data:n})||this;return r.error=e,r}return o(e,t),e}(a);e.IErrorEvent=u;var c=function(){function t(){this._listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this._listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}(t,e,this._listeners),this},t.prototype.fire=function(t,e){if(s.isInstanceOf(t,u))return console.error(t.error),this;var n=s.isString(t)?new a(t,e||{}):t,r=n.name;if(this._listens(r)){n.target=this;for(var o=0,c=this._listeners[r]?i(this._listeners[r]):[];o<c.length;o++){c[o].call(this,n)}}return this},t.prototype._listens=function(t){return this._listeners[t]&&this._listeners[t].length>0},t}();e.CloudbaseEventEmitter=c;var f=new c;e.addEventListener=function(t,e){f.on(t,e)},e.activateEvent=function(t,e){void 0===e&&(e={}),f.fire(t,e)},e.removeEventListener=function(t,e){f.off(t,e)}}])}));
@@ -0,0 +1 @@
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(function(){try{return require("crypto")}catch(t){}}()):"function"==typeof define&&define.amd?define("cloudbase",["crypto"],e):"object"==typeof exports?exports.cloudbase=e(function(){try{return require("crypto")}catch(t){}}()):t.cloudbase=e(t.crypto)}("undefined"!=typeof window?window:this,(function(t){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=8)}([function(t,e,r){"use strict";(function(t){r.d(e,"g",(function(){return o})),r.d(e,"f",(function(){return i})),r.d(e,"e",(function(){return a})),r.d(e,"b",(function(){return c})),r.d(e,"d",(function(){return u})),r.d(e,"a",(function(){return f})),r.d(e,"c",(function(){return s}));var n="";function o(t){n=t}function i(){return n}var s,a="@cloudbase/js-sdk",c="2020-01-10",u="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:",f="//tcb-api.tencentcloudapi.com/web";!function(t){t.ANONYMOUS="ANONYMOUS",t.WECHAT="WECHAT",t.CUSTOM="CUSTOM",t.NULL="NULL"}(s||(s={}))}).call(this,r(7))},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.events=e.cache=e.adapters=e.constants=void 0;var s=i(r(5));e.constants=s;var a=i(r(12));e.adapters=a;var c=i(r(21));e.cache=c;var u=i(r(22));e.events=u;var f=i(r(2));e.utils=f},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.throwError=e.printInfo=e.printError=e.printWarn=e.execCallback=e.createPromiseCallback=e.removeParam=e.getHash=e.getQuery=e.toQueryString=e.createSign=e.formatUrl=e.genSeqId=e.isFormData=e.isInstanceOf=e.isNull=e.isPalinObject=e.isUndefined=e.isString=e.isArray=void 0;var o=n(r(14)),i=n(r(19)),s=n(r(20)),a=r(5);function c(t){var e=i.default.stringify(t);return e=(e=(e=e.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}e.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},e.isString=function(t){return"string"==typeof t},e.isUndefined=function(t){return void 0===t},e.isPalinObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},e.isNull=function(t){return"[object Null]"===Object.prototype.toString.call(t)},e.isInstanceOf=function(t,e){return t instanceof e},e.isFormData=function(t){return"[object FormData]"===Object.prototype.toString.call(t)},e.genSeqId=function(){return Math.random().toString(16).slice(2)},e.formatUrl=function(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";for(var i in r)""===o?!n&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e},e.createSign=function(t,e){var r=c(s.default.parse(JSON.stringify({alg:"HS256",typ:"JWT"})))+"."+c(s.default.parse(JSON.stringify(t)));return r+"."+c(o.default(r,e))},e.toQueryString=function(t){void 0===t&&(t={});var e=[];for(var r in t)e.push(r+"="+encodeURIComponent(t[r]));return e.join("&")},e.getQuery=function(t,e){if("undefined"==typeof window)return!1;var r=e||window.location.search,n=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""},e.getHash=function(t){if("undefined"==typeof window)return"";var e=window.location.hash.match(new RegExp("[#?&/]"+t+"=([^&#]*)"));return e?e[1]:""},e.removeParam=function(t,e){var r=e.split("?")[0],n=[],o=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==o){for(var i=(n=o.split("&")).length-1;i>=0;i-=1)n[i].split("=")[0]===t&&n.splice(i,1);r=r+"?"+n.join("&")}return r},e.createPromiseCallback=function(){var t;if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var r=new Promise((function(e,r){t=function(t,n){return t?r(t):e(n)}}));return t.promise=r,t},e.execCallback=function(t,e,r){if(void 0===r&&(r=null),t&&"function"==typeof t)return t(e,r);if(e)throw e;return r},e.printWarn=function(t,e){console.warn("["+a.SDK_NAME+"]["+t+"]:"+e)},e.printError=function(t,e){console.error({code:t,msg:"["+a.SDK_NAME+"]["+t+"]:"+e})},e.printInfo=function(t,e){console.log("["+a.SDK_NAME+"]["+t+"]:"+e)},e.throwError=function(t,e){throw new Error(JSON.stringify({code:t,msg:"["+a.SDK_NAME+"]["+t+"]:"+e}))}},function(t,e,r){"use strict";var n;r.r(e),r.d(e,"StorageType",(function(){return n})),r.d(e,"AbstractSDKRequest",(function(){return o})),r.d(e,"AbstractStorage",(function(){return i})),r.d(e,"formatUrl",(function(){return s})),function(t){t.local="local",t.none="none",t.session="session"}(n||(n={}));var o=function(){},i=function(){};function s(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";for(var i in r)""===o?!n&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e}},function(t,e,r){(function(e){var n;t.exports=(n=n||function(t,n){var o;if("undefined"!=typeof window&&window.crypto&&(o=window.crypto),!o&&"undefined"!=typeof window&&window.msCrypto&&(o=window.msCrypto),!o&&void 0!==e&&e.crypto&&(o=e.crypto),!o)try{o=r(16)}catch(t){}var i=function(){if(o){if("function"==typeof o.getRandomValues)try{return o.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof o.randomBytes)try{return o.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),a={},c=a.lib={},u=c.Base={extend:function(t){var e=s(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},f=c.WordArray=u.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||h).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,o=t.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var s=r[i>>>2]>>>24-i%4*8&255;e[n+i>>>2]|=s<<24-(n+i)%4*8}else for(i=0;i<o;i+=4)e[n+i>>>2]=r[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=u.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(i());return new f.init(e,t)}}),l=a.enc={},h=l.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],o=0;o<r;o++){var i=e[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new f.init(r,e/2)}},p=l.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],o=0;o<r;o++){var i=e[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new f.init(r,e)}},d=l.Utf8={stringify:function(t){try{return decodeURIComponent(escape(p.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return p.parse(unescape(encodeURIComponent(t)))}},y=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,n=this._data,o=n.words,i=n.sigBytes,s=this.blockSize,a=i/(4*s),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,u=t.min(4*c,i);if(c){for(var l=0;l<c;l+=s)this._doProcessBlock(o,l);r=o.splice(0,c),n.sigBytes-=u}return new f.init(r,u)},clone:function(){var t=u.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),v=(c.Hasher=y.extend({cfg:u.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new v.HMAC.init(t,r).finalize(e)}}}),a.algo={});return a}(Math),n)}).call(this,r(15))},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(6),e),o(r(11),e)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PROTOCOL=e.SDK_NAME=void 0,e.SDK_NAME="@cloudbase/js-sdk",e.PROTOCOL="https:"},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,u=[],f=!1,l=-1;function h(){f&&c&&(f=!1,c.length?u=c.concat(u):l=-1,u.length&&p())}function p(){if(!f){var t=a(h);f=!0;for(var e=u.length;e;){for(c=u,u=[];++l<e;)c&&c[l].run();l=-1,e=u.length}c=null,f=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new d(t,e)),1!==u.length||f||a(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,r){r(9),t.exports=r(10)},function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function a(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),s=new O(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return A()}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var a=m(s,r);if(a){if(a===u)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var f=c(t,e,r);if("normal"===f.type){if(n=r.done?"completed":"suspendedYield",f.arg===u)continue;return{value:f.arg,done:r.done}}"throw"===f.type&&(n="completed",r.method="throw",r.arg=f.arg)}}}(t,r,s),i}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var u={};function f(){}function l(){}function h(){}var p={};p[o]=function(){return this};var d=Object.getPrototypeOf,y=d&&d(d(S([])));y&&y!==e&&r.call(y,o)&&(p=y);var v=h.prototype=f.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function _(t,e){var n;this._invoke=function(o,i){function s(){return new e((function(n,s){!function n(o,i,s,a){var u=c(t[o],t,i);if("throw"!==u.type){var f=u.arg,l=f.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(l).then((function(t){f.value=t,s(f)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}(o,i,n,s)}))}return n=n?n.then(s,s):s()}}function m(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,m(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,u;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return l.prototype=v.constructor=h,h.constructor=l,h[s]=l.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===l||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(v),t},t.awrap=function(t){return{__await:t}},g(_.prototype),_.prototype[i]=function(){return this},t.AsyncIterator=_,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var s=new _(a(e,r,n,o),i);return t.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},g(v),v[s]="Generator",v[o]=function(){return this},v.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var a=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,u):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),u},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),b(r),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;b(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},s=(this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}})(r(24)),a=i(r(23)).version;s.default.registerVersion(a);try{window.cloudbase=s.default}catch(t){}e.default=s.default,t.exports=s.default},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ERRORS=void 0,e.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.useDefaultAdapter=e.useAdapters=e.RUNTIME=void 0;var s,a=i(r(13)),c=r(2);!function(t){t.WEB="web",t.WX_MP="wx_mp"}(s=e.RUNTIME||(e.RUNTIME={})),e.useAdapters=function(t){for(var e=0,r=c.isArray(t)?t:[t];e<r.length;e++){var n=r[e],o=n.isMatch,i=n.genAdapter,s=n.runtime;if(o())return{adapter:i(),runtime:s}}},e.useDefaultAdapter=function(){return{adapter:a.genAdapter(),runtime:s.WEB}}},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},s=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.WebRequest=e.genAdapter=void 0;var c=r(3),u=r(2),f=r(6),l=function(t){function e(e){var r=t.call(this)||this,n=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=o||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return o(e,t),e.prototype.get=function(t){return this._request(i(i({},t),{method:"get"}),this._restrictedMethods.includes("get"))},e.prototype.post=function(t){return this._request(i(i({},t),{method:"post"}),this._restrictedMethods.includes("post"))},e.prototype.put=function(t){return this._request(i(i({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,r=t.file,n=t.name,o=new FormData;for(var s in e)o.append(s,e[s]);return o.append("key",n),o.append("file",r),this._request(i(i({},t),{data:o,method:"post"}),this._restrictedMethods.includes("upload"))},e.prototype.download=function(t){return s(this,void 0,void 0,(function(){var e,r;return a(this,(function(n){return e=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(r=document.createElement("a")).href=t.url,r.setAttribute("download",e),r.setAttribute("target","_blank"),document.body.appendChild(r),r.click(),[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}))}))},e.prototype._request=function(t,e){var r=this;void 0===e&&(e=!1);var n=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=t.url,c=t.headers,l=void 0===c?{}:c,h=t.data,p=t.responseType,d=t.withCredentials,y=t.body,v=t.onUploadProgress,g=u.formatUrl(f.PROTOCOL,a,"get"===n?h:{}),_=new XMLHttpRequest;for(var m in _.open(n,g),p&&(_.responseType=p),l)_.setRequestHeader(m,l[m]);v&&_.addEventListener("progress",v),_.onreadystatechange=function(){var t={};if(4===_.readyState){var e=_.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};e.forEach((function(t){var e=t.split(": "),n=e.shift().toLowerCase(),o=e.join(": ");r[n]=o})),t.header=r,t.statusCode=_.status;try{t.data=JSON.parse(_.responseText)}catch(e){t.data=_.responseText}clearTimeout(i),o(t)}},e&&r._timeout&&(i=setTimeout((function(){console.warn(r._timeoutMsg),_.abort()}),r._timeout)),s=u.isFormData(h)?h:"application/x-www-form-urlencoded"===l["content-type"]?u.toQueryString(h):y||(h?JSON.stringify(h):void 0),d&&(_.withCredentials=!0),_.send(s)}))},e}(c.AbstractSDKRequest);e.WebRequest=l,e.genAdapter=function(){return{root:window,reqClass:l,wsClass:WebSocket,localStorage:localStorage,sessionStorage:sessionStorage}}},function(t,e,r){var n;t.exports=(n=r(4),r(17),r(18),n.HmacSHA256)},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(e,r){if(void 0===t){var n=new Error("Cannot find module 'crypto'");throw n.code="MODULE_NOT_FOUND",n}e.exports=t},function(t,e,r){var n;t.exports=(n=r(4),function(t){var e=n,r=e.lib,o=r.WordArray,i=r.Hasher,s=e.algo,a=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var n=2,o=0;o<64;)e(n)&&(o<8&&(a[o]=r(t.pow(n,.5))),c[o]=r(t.pow(n,1/3)),o++),n++}();var u=[],f=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],f=r[5],l=r[6],h=r[7],p=0;p<64;p++){if(p<16)u[p]=0|t[e+p];else{var d=u[p-15],y=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,v=u[p-2],g=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;u[p]=y+u[p-7]+g+u[p-16]}var _=n&o^n&i^o&i,m=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&f^~a&l)+c[p]+u[p];h=l,l=f,f=a,a=s+w|0,s=i,i=o,o=n,n=w+(m+_)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+f|0,r[6]=r[6]+l|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=t.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(f),e.HmacSHA256=i._createHmacHelper(f)}(Math),n.SHA256)},function(t,e,r){var n,o,i,s;t.exports=(n=r(4),i=(o=n).lib.Base,s=o.enc.Utf8,void(o.algo.HMAC=i.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=s.parse(e));var r=t.blockSize,n=4*r;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),i=this._iKey=e.clone(),a=o.words,c=i.words,u=0;u<r;u++)a[u]^=1549556828,c[u]^=909522486;o.sigBytes=i.sigBytes=n,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,r=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(r))}})))},function(t,e,r){var n,o,i;t.exports=(i=r(4),o=(n=i).lib.WordArray,n.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var o=[],i=0;i<r;i+=3)for(var s=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<r;a++)o.push(n.charAt(s>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(t){var e=t.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<r.length;i++)n[r.charCodeAt(i)]=i}var s=r.charAt(64);if(s){var a=t.indexOf(s);-1!==a&&(e=a)}return function(t,e,r){for(var n=[],i=0,s=0;s<e;s++)if(s%4){var a=r[t.charCodeAt(s-1)]<<s%4*2,c=r[t.charCodeAt(s)]>>>6-s%4*2,u=a|c;n[i>>>2]|=u<<24-i%4*8,i++}return o.create(n,i)}(t,e,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},function(t,e,r){var n;t.exports=(n=r(4),n.enc.Utf8)},function(t,e,r){"use strict";(function(t){var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.CloudbaseCache=void 0;var a=r(3),c=r(2),u=r(5),f=function(t){function e(e){var r=t.call(this)||this;return r._root=e,e.tcbCacheObject||(e.tcbCacheObject={}),r}return o(e,t),e.prototype.setItem=function(t,e){this._root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this._root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this._root.tcbCacheObject[t]},e.prototype.clear=function(){delete this._root.tcbCacheObject},e}(a.AbstractStorage);function l(t,e){switch(t){case"local":return e.localStorage?e.localStorage:(c.printWarn(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new f(e.root));case"none":return new f(e.root);default:return e.sessionStorage?e.sessionStorage:(c.printWarn(u.ERRORS.INVALID_PARAMS,"sessionStorage is not supported on current platform"),new f(e.root))}}var h=function(){function e(t){this.keys={};var e=t.persistence,r=t.platformInfo,n=void 0===r?{}:r,o=t.keys,i=void 0===o?{}:o,s=t.alwaysLocalKeys,a=void 0===s?[]:s;this._platformInfo=n,this._alwaysLocalKeys=a,this._storage||(this._persistence=n.adapter.primaryStorage||e,this._storage=l(this._persistence,n.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this._storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this._persistence},enumerable:!1,configurable:!0}),e.prototype.updatePersistence=function(t){if("async"!==this.mode){if(t!==this._persistence){var e="local"===this._persistence;this._persistence=t;var r=l(t,this._platformInfo.adapter);for(var n in this.keys){var o=this.keys[n];if(!e||!this._alwaysLocalKeys.includes(n)){var i=this._storage.getItem(o);c.isUndefined(i)||c.isNull(i)||(r.setItem(o,i),this._storage.removeItem(o))}}this._storage=r}}else c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use updatePersistenceAsync insteed")},e.prototype.updatePersistenceAsync=function(t){return i(this,void 0,void 0,(function(){var e,r,n,o,i,a,u,f;return s(this,(function(s){switch(s.label){case 0:if(t===this._persistence)return[2];for(o in e="local"===this._persistence,this._persistence=t,r=l(t,this._platformInfo.adapter),n=[],this.keys)n.push(o);i=0,s.label=1;case 1:return i<n.length?(a=n[i],u=this.keys[a],e&&this._alwaysLocalKeys.includes(a)?[3,4]:[4,this._storage.getItem(u)]):[3,5];case 2:return f=s.sent(),c.isUndefined(f)||c.isNull(f)?[3,4]:(r.setItem(u,f),[4,this._storage.removeItem(u)]);case 3:s.sent(),s.label=4;case 4:return i++,[3,1];case 5:return this._storage=r,[2]}}))}))},e.prototype.setStore=function(t,e,r){if("async"!==this.mode){if(this._storage)try{var n={version:r||"localCachev1",content:e};this._storage.setItem(t,JSON.stringify(n))}catch(t){return}}else c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(t,e,r){return i(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:if(!this._storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:e},[4,this._storage.setItem(t,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,r){var n;if("async"!==this.mode){try{if(void 0!==t&&(null===(n=t.env)||void 0===n?void 0:n.tcb_token))return t.env.tcb_token;if(!this._storage)return""}catch(t){return""}r=r||"localCachev1";var o=this._storage.getItem(e);return o&&o.indexOf(r)>=0?JSON.parse(o).content:""}c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,r){var n;return i(this,void 0,void 0,(function(){var o;return s(this,(function(i){switch(i.label){case 0:try{if(void 0!==t&&(null===(n=t.env)||void 0===n?void 0:n.tcb_token))return[2,t.env.tcb_token];if(!this._storage)return[2,""]}catch(t){return[2,""]}return r=r||"localCachev1",[4,this._storage.getItem(e)];case 1:return(o=i.sent())&&o.indexOf(r)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},e.prototype.removeStore=function(t){"async"!==this.mode?this._storage.removeItem(t):c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this._storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},e}();e.CloudbaseCache=h}).call(this,r(7))},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n};Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.activateEvent=e.addEventListener=e.CloudbaseEventEmitter=e.IErrorEvent=e.CloudbaseEvent=void 0;var s=r(2);var a=function(t,e){this.data=e||null,this.name=t};e.CloudbaseEvent=a;var c=function(t){function e(e,r){var n=t.call(this,"error",{error:e,data:r})||this;return n.error=e,n}return o(e,t),e}(a);e.IErrorEvent=c;var u=function(){function t(){this._listeners={}}return t.prototype.on=function(t,e){return function(t,e,r){r[t]=r[t]||[],r[t].push(e)}(t,e,this._listeners),this},t.prototype.off=function(t,e){return function(t,e,r){if(null==r?void 0:r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}(t,e,this._listeners),this},t.prototype.fire=function(t,e){if(s.isInstanceOf(t,c))return console.error(t.error),this;var r=s.isString(t)?new a(t,e||{}):t,n=r.name;if(this._listens(n)){r.target=this;for(var o=0,u=this._listeners[n]?i(this._listeners[n]):[];o<u.length;o++){u[o].call(this,r)}}return this},t.prototype._listens=function(t){return this._listeners[t]&&this._listeners[t].length>0},t}();e.CloudbaseEventEmitter=u;var f=new u;e.addEventListener=function(t,e){f.on(t,e)},e.activateEvent=function(t,e){void 0===e&&(e={}),f.fire(t,e)},e.removeEventListener=function(t,e){f.off(t,e)}},function(t){t.exports=JSON.parse('{"version":"1.0.0"}')},function(t,e,r){"use strict";r.r(e),r.d(e,"cloudbase",(function(){return Z}));var n,o=r(1),i=r(3),s=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(){return(a=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)},c=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))},u=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};var f=function(t){function e(e){void 0===e&&(e={});var r=t.call(this)||this,n=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=o||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return s(e,t),e.prototype.post=function(t){var e=this;return new Promise((function(r,n){var o=null,s=t.url,a=t.data,c=t.headers,u=wx.request({url:Object(i.formatUrl)("https:",s),data:a,method:"POST",header:c,success:function(t){e._clearTimeout(o),r(t)},fail:function(t){e._clearTimeout(o),n(t)}});o=e._setTimeout("post",u)}))},e.prototype.upload=function(t){var e=this,r=this;return new Promise((function(n){return c(e,void 0,void 0,(function(){var e,o,s,c,f,l;return u(this,(function(u){return e=null,o=t.url,s=t.file,c=t.data,f=t.headers,l=wx.uploadFile({url:Object(i.formatUrl)("https:",o),filePath:s,name:"file",formData:a(a({},c),{file:s}),header:f,success:function(t){r._clearTimeout(e);var o={statusCode:t.statusCode,data:t.data||{}};200===t.statusCode&&c.success_action_status&&(o.statusCode=parseInt(c.success_action_status,10)),n(o)},fail:function(t){r._clearTimeout(e),n(t)}}),e=r._setTimeout("upload",l),[2]}))}))}))},e.prototype.download=function(t){var e=this,r=this;return new Promise((function(n,o){var s=null,a=t.url,c=t.headers,u=wx.downloadFile({url:Object(i.formatUrl)("https:",a),header:c,success:function(t){r._clearTimeout(s),200===t.statusCode&&t.tempFilePath?n({statusCode:200,tempFilePath:t.tempFilePath}):n(t)},fail:function(t){r._clearTimeout(s),o(t)}});s=e._setTimeout("download",u)}))},e.prototype._clearTimeout=function(t){t&&(clearTimeout(t),t=null)},e.prototype._setTimeout=function(t,e){var r=this;return this._timeout&&-1!==this._restrictedMethods.indexOf(t)?setTimeout((function(){console.warn(r._timeoutMsg),e.abort()}),this._timeout):null},e}(i.AbstractSDKRequest),l={setItem:function(t,e){wx.setStorageSync(t,e)},getItem:function(t){return wx.getStorageSync(t)},removeItem:function(t){wx.removeStorageSync(t)},clear:function(){wx.clearStorageSync()}},h=function(t,e){void 0===e&&(e={});var r=wx.connectSocket(a({url:t},e));return{set onopen(t){r.onOpen(t)},set onmessage(t){r.onMessage(t)},set onclose(t){r.onClose(t)},set onerror(t){r.onError(t)},send:function(t){return r.send({data:t})},close:function(t,e){return r.close({code:t,reason:e})},get readyState(){return r.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}};var p={genAdapter:function(){return{root:{},reqClass:f,wsClass:h,localStorage:l,primaryStorage:i.StorageType.local,getAppSign:function(){var t=wx.getAccountInfoSync();return t&&t.miniProgram?t.miniProgram.appId:""}}},isMatch:function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof App)return!1;if("undefined"==typeof Page)return!1;if("function"!=typeof getApp)return!1;if(!wx.onAppHide)return!1;if(!wx.offAppHide)return!1;if(!wx.onAppShow)return!1;if(!wx.offAppShow)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(t){return!1}return!0},runtime:"wx_mp"},d=r(0),y=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n},v=o.constants.ERRORS,g={};function _(t,e){var r=e.name,n=e.namespace,o=e.entity,i=e.injectEvents;if(g[r]||n&&t[n])throw new Error("["+d.e+"]["+v.INVALID_OPERATION+"]There were multiple attempts to register component "+r+".");if(g[r]=e,n?t.prototype[n]=o:function t(e,r){if(!(r instanceof Object))return r;switch(r.constructor){case Date:return new Date(r.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return r}for(var n in r)r.hasOwnProperty(n)&&(e[n]=t(e[n],r[n]));return e}(t.prototype,o),i){var s=i.bus,a=i.events;if(!s||!a||0===a.length)return;var c=t.prototype.fire||function(){};t.prototype.events||(t.prototype.events={}),(t.prototype.events||{})[r]?t.prototype.events[r].events=y(t.prototype.events[r].events,a):t.prototype.events[r]={bus:s,events:a},t.prototype.fire=function(t,e){for(var r in c(t,e),this.events){var n=this.events[r],o=n.bus;if(n.events.includes(t)){o.fire(t,e);break}}}}}var m={},w=function(){return(w=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)},b=o.cache.CloudbaseCache,O={},S={};function A(t){var e=t.env,r=t.persistence,n=t.platformInfo,o={accessTokenKey:"access_token_"+e,accessTokenExpireKey:"access_token_expire_"+e,refreshTokenKey:"refresh_token_"+e,anonymousUuidKey:"anonymous_uuid_"+e,loginTypeKey:"login_type_"+e,userInfoKey:"user_info_"+e};O[e]?O[e].updatePersistence(r):O[e]=new b(w(w({},t),{keys:o,platformInfo:n,alwaysLocalKeys:["anonymousUuidKey"]})),S[e]=S[e]||new b(w(w({},t),{keys:o,platformInfo:n,persistence:"local"}))}function E(t){return O[t]}function x(t){return S[t]}var T="loginStateExpire",I="refreshAccessToken",P=r(2),k=function(){return(k=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)},R=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))},j=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},N=o.constants.ERRORS,C=o.utils.genSeqId,L=o.utils.isFormData,M=o.utils.formatUrl,D=o.utils.createSign,U=o.adapters.RUNTIME,K=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function q(t,e,r){var n=t[e];t[e]=function(e){var o={},i={};r.forEach((function(r){var n=r.call(t,e),s=n.data,a=n.headers;Object.assign(o,s),Object.assign(i,a)}));var s=e.data;return s&&function(){if(L(s))for(var t in o)s.append(t,o[t]);else e.data=k(k({},s),o)}(),e.headers=k(k({},e.headers||{}),i),n.call(t,e)}}function B(){var t=C();return{data:{seqId:t},headers:{"X-SDK-Version":Object(d.f)(),"x-seqid":t}}}var F=function(){function t(t){this._throwWhenRequestFail=!1,this.config=t,this._reqClass=new m.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:"[tcb-js-sdk] 请求在"+this.config.timeout/1e3+"s内未完成,已中断",restrictedMethods:["post"]}),this._throwWhenRequestFail=t.throw||!1,this._cache=E(this.config.env),this._localCache=x(this.config.env),q(this._reqClass,"post",[B]),q(this._reqClass,"upload",[B]),q(this._reqClass,"download",[B])}return t.prototype.post=function(t){return R(this,void 0,void 0,(function(){return j(this,(function(e){switch(e.label){case 0:return[4,this._reqClass.post(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.upload=function(t){return R(this,void 0,void 0,(function(){return j(this,(function(e){switch(e.label){case 0:return[4,this._reqClass.upload(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.download=function(t){return R(this,void 0,void 0,(function(){return j(this,(function(e){switch(e.label){case 0:return[4,this._reqClass.download(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.refreshAccessToken=function(){return R(this,void 0,void 0,(function(){var t,e,r;return j(this,(function(n){switch(n.label){case 0:this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._refreshAccessTokenPromise];case 2:return t=n.sent(),[3,4];case 3:return r=n.sent(),e=r,[3,4];case 4:if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,e)throw e;return[2,t]}}))}))},t.prototype.getAccessToken=function(){return R(this,void 0,void 0,(function(){var t,e,r,n,o,i,s,a,c;return j(this,(function(u){switch(u.label){case 0:return t=this._cache.keys,e=t.accessTokenKey,r=t.accessTokenExpireKey,n=t.refreshTokenKey,[4,this._cache.getStoreAsync(n)];case 1:return u.sent()||Object(P.throwError)(N.INVALID_PARAMS,"refresh token is not exist"),[4,this._cache.getStoreAsync(e)];case 2:return o=u.sent(),s=Number,[4,this._cache.getStoreAsync(r)];case 3:return i=s.apply(void 0,[u.sent()]),a=!0,(c=this._shouldRefreshAccessTokenHook)?[4,this._shouldRefreshAccessTokenHook(o,i)]:[3,5];case 4:c=!u.sent(),u.label=5;case 5:return c&&(a=!1),o&&i&&!(i<Date.now())||!a?[3,7]:[4,this.refreshAccessToken()];case 6:return[2,u.sent()];case 7:return[2,{accessToken:o,accessTokenExpire:i}]}}))}))},t.prototype.request=function(t,e,r){return R(this,void 0,void 0,(function(){var n,o,i,s,a,c,u,f,l,h,p,y,v,g,_,w,b,O,S,A,E,x,T;return j(this,(function(I){switch(I.label){case 0:return n="x-tcb-trace_"+this.config.env,o="application/x-www-form-urlencoded",i=k({action:t,dataVersion:d.b,env:this.config.env},e),-1!==K.indexOf(t)?[3,3]:(s=this._cache.keys.refreshTokenKey,[4,this._cache.getStoreAsync(s)]);case 1:return I.sent()?(a=i,[4,this.getAccessToken()]):[3,3];case 2:a.access_token=I.sent().accessToken,I.label=3;case 3:if("storage.uploadFile"===t){for(u in c=new FormData)c.hasOwnProperty(u)&&void 0!==c[u]&&c.append(u,i[u]);o="multipart/form-data"}else for(u in o="application/json;charset=UTF-8",c={},i)void 0!==i[u]&&(c[u]=i[u]);return f={headers:{"content-type":o}},(null==r?void 0:r.onUploadProgress)&&(f.onUploadProgress=r.onUploadProgress),(l=this._localCache.getStore(n))&&(f.headers["X-TCB-Trace"]=l),m.runtime!==U.WEB&&(h=this.config,p=h.appSign,y=h.appSecret,v=Date.now(),g=y.appAccessKey,_=y.appAccessKeyId,w=D({data:c,timestamp:v,appAccessKeyId:_,appSign:p},g),f.headers["X-TCB-App-Source"]="timestamp="+v+";appAccessKeyId="+_+";appSign="+p+";sign="+w),b=e.parse,O=e.inQuery,S=e.search,A={env:this.config.env},b&&(A.parse=!0),O&&(A=k(k({},O),A)),E=M(d.d,d.a,A),S&&(E+=S),[4,this.post(k({url:E,data:c},f))];case 4:if(x=I.sent(),(T=x.header&&x.header["x-tcb-trace"])&&this._localCache.setStore(n,T),200!==Number(x.status)&&200!==Number(x.statusCode)||!x.data)throw new Error("network request error");return[2,x]}}))}))},t.prototype.send=function(t,e){return void 0===e&&(e={}),R(this,void 0,void 0,(function(){var r,n;return j(this,(function(o){switch(o.label){case 0:return[4,this.request(t,e,{onUploadProgress:e.onUploadProgress})];case 1:return"ACCESS_TOKEN_EXPIRED"!==(r=o.sent()).data.code||-1!==K.indexOf(t)?[3,4]:[4,this.refreshAccessToken()];case 2:return o.sent(),[4,this.request(t,e,{onUploadProgress:e.onUploadProgress})];case 3:return(n=o.sent()).data.code&&this._throwWhenRequestFail&&Object(P.throwError)(N.OPERATION_FAIL,"["+n.data.code+"] "+n.data.message),[2,n.data];case 4:return r.data.code&&this._throwWhenRequestFail&&Object(P.throwError)(N.OPERATION_FAIL,"["+r.data.code+"] "+r.data.message),[2,r.data]}}))}))},t.prototype._refreshAccessToken=function(){return R(this,void 0,void 0,(function(){var t,e,r,n,o,i,s,a,c,u,f,l,h;return j(this,(function(p){switch(p.label){case 0:return t=this._cache.keys,e=t.accessTokenKey,r=t.accessTokenExpireKey,n=t.refreshTokenKey,o=t.loginTypeKey,i=t.anonymousUuidKey,[4,this._cache.removeStoreAsync(e)];case 1:return p.sent(),[4,this._cache.removeStoreAsync(r)];case 2:return p.sent(),[4,this._cache.getStoreAsync(n)];case 3:if(!(s=p.sent()))throw new Error("["+d.e+"]["+N.INVALID_OPERATION+"] not login");return a={refresh_token:s},[4,this.request("auth.fetchAccessTokenWithRefreshToken",a)];case 4:return(c=p.sent()).data.code?"SIGN_PARAM_INVALID"!==(u=c.data.code)&&"REFRESH_TOKEN_EXPIRED"!==u&&"INVALID_REFRESH_TOKEN"!==u?[3,11]:[4,this._cache.getStoreAsync(o)]:[3,12];case 5:return p.sent()===d.c.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===u?[4,this._cache.getStoreAsync(i)]:[3,9];case 6:return f=p.sent(),[4,this._cache.getStoreAsync(n)];case 7:return l=p.sent(),[4,this.send("auth.signInAnonymously",{anonymous_uuid:f,refresh_token:l})];case 8:return h=p.sent(),this._setRefreshToken(h.refresh_token),[2,this._refreshAccessToken()];case 9:return Z.fire(T),[4,this._cache.removeStoreAsync(n)];case 10:p.sent(),p.label=11;case 11:throw new Error("["+d.e+"]["+N.NETWORK_ERROR+"] refresh access_token failed:"+c.data.code);case 12:return c.data.access_token?(Z.fire(I),[4,this._cache.setStoreAsync(e,c.data.access_token)]):[3,15];case 13:return p.sent(),[4,this._cache.setStoreAsync(r,c.data.access_token_expire+Date.now())];case 14:return p.sent(),[2,{accessToken:c.data.access_token,accessTokenExpire:c.data.access_token_expire}];case 15:return c.data.refresh_token?[4,this._cache.removeStoreAsync(n)]:[3,19];case 16:return p.sent(),[4,this._cache.setStoreAsync(n,c.data.refresh_token)];case 17:return p.sent(),[4,this._refreshAccessToken()];case 18:p.sent(),p.label=19;case 19:return[2]}}))}))},t.prototype._setRefreshToken=function(t){return R(this,void 0,void 0,(function(){var e,r,n,o;return j(this,(function(i){switch(i.label){case 0:return e=this._cache.keys,r=e.accessTokenKey,n=e.accessTokenExpireKey,o=e.refreshTokenKey,[4,this._cache.removeStoreAsync(r)];case 1:return i.sent(),[4,this._cache.removeStoreAsync(n)];case 2:return i.sent(),[4,this._cache.setStoreAsync(o,t)];case 3:return i.sent(),[2]}}))}))},t}(),W={};var H=function(){return(H=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)},V=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))},G=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},z=o.adapters.useAdapters,J=o.adapters.useDefaultAdapter,X=o.adapters.RUNTIME,Y=o.constants.ERRORS,Q={timeout:15e3,persistence:"session"},$={},Z=new(function(){function t(t){this._config=t||this._config,this.authInstance=null}return Object.defineProperty(t.prototype,"config",{get:function(){return this._config},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"platform",{get:function(){return m},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cache",{get:function(){return E(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localCache",{get:function(){return x(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){return t=this._config.env,W[t];var t},enumerable:!1,configurable:!0}),t.prototype.init=function(e){if(m.adapter||this._useDefaultAdapter(),this.requestClient=new m.adapter.reqClass({timeout:e.timeout||5e3,timeoutMsg:"["+d.e+"][REQUEST TIMEOUT] request had been abort since didn't finished within"+e.timeout/1e3+"s"}),m.runtime!==X.WEB){if(!e.appSecret)throw new Error("["+d.e+"]["+Y.INVALID_PARAMS+"]invalid appSecret");var r=m.adapter.getAppSign?m.adapter.getAppSign():"";if(e.appSign&&r&&e.appSign!==r)throw new Error("["+d.e+"]["+Y.INVALID_PARAMS+"]invalid appSign");if(r&&(e.appSign=r),!e.appSign)throw new Error("["+d.e+"]["+Y.INVALID_PARAMS+"]invalid appSign")}this._config=H(H({},Q),e),this._config.timeout=this._formatTimeout(this._config.timeout);var n=this._config,o=n.env,i=n.persistence,s=n.debug,a=n.timeout,c=n.appSecret,u=n.appSign;return A({env:o,persistence:i,debug:s,platformInfo:this.platform}),function(t){W[t.env]=new F(k(k({},t),{throw:!0}))}({env:o,timeout:a,appSecret:c,appSign:u}),new t(this._config)},t.prototype.updateConfig=function(t){var e=t.persistence,r=t.debug;this._config.persistence=e,this._config.debug=r,A({env:this._config.env,persistence:e,debug:r,platformInfo:this.platform})},t.prototype.registerExtension=function(t){$[t.name]=t},t.prototype.invokeExtension=function(t,e){return V(this,void 0,void 0,(function(){var r;return G(this,(function(n){switch(n.label){case 0:if(!(r=$[t]))throw Error("["+d.e+"]["+Y.INVALID_PARAMS+"]extension:"+t+" must be registered before invoke");return[4,r.invoke(e,this)];case 1:return[2,n.sent()]}}))}))},t.prototype.useAdapters=function(t){var e=z(t)||{},r=e.adapter,n=e.runtime;r&&(m.adapter=r),n&&(m.runtime=n)},t.prototype.registerComponent=function(e){_(t,e)},t.prototype.registerVersion=function(t){Object(d.g)(t)},t.prototype._useDefaultAdapter=function(){var t=J(),e=t.adapter,r=t.runtime;m.adapter=e,m.runtime=r},t.prototype._formatTimeout=function(t){switch(!0){case t>6e5:return console.warn("["+d.e+"]["+Y.INVALID_PARAMS+"]timeout is greater than maximum value[10min]"),6e5;case t<100:return console.warn("["+d.e+"]["+Y.INVALID_PARAMS+"]timeout is less than maximum value[100ms]"),100;default:return t}},t}());Z.useAdapters(p);e.default=Z}])}));
@@ -0,0 +1 @@
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(function(){try{return require("null")}catch(t){}}()):"function"==typeof define&&define.amd?define("cloudbase_storage",["null"],e):"object"==typeof exports?exports.cloudbase_storage=e(function(){try{return require("null")}catch(t){}}()):t.cloudbase_storage=e(t.null)}("undefined"!=typeof window?window:this,(function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=6)}([function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.events=e.cache=e.adapters=e.constants=void 0;var s=i(r(3));e.constants=s;var a=i(r(9));e.adapters=a;var u=i(r(18));e.cache=u;var c=i(r(20));e.events=c;var l=i(r(1));e.utils=l},function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.throwError=e.printInfo=e.printError=e.printWarn=e.execCallback=e.createPromiseCallback=e.removeParam=e.getHash=e.getQuery=e.toQueryString=e.createSign=e.formatUrl=e.genSeqId=e.isFormData=e.isInstanceOf=e.isNull=e.isPalinObject=e.isUndefined=e.isString=e.isArray=void 0;var o=n(r(11)),i=n(r(16)),s=n(r(17)),a=r(3);function u(t){var e=i.default.stringify(t);return e=(e=(e=e.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}e.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},e.isString=function(t){return"string"==typeof t},e.isUndefined=function(t){return void 0===t},e.isPalinObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},e.isNull=function(t){return"[object Null]"===Object.prototype.toString.call(t)},e.isInstanceOf=function(t,e){return t instanceof e},e.isFormData=function(t){return"[object FormData]"===Object.prototype.toString.call(t)},e.genSeqId=function(){return Math.random().toString(16).slice(2)},e.formatUrl=function(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";for(var i in r)""===o?!n&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e},e.createSign=function(t,e){var r=u(s.default.parse(JSON.stringify({alg:"HS256",typ:"JWT"})))+"."+u(s.default.parse(JSON.stringify(t)));return r+"."+u(o.default(r,e))},e.toQueryString=function(t){void 0===t&&(t={});var e=[];for(var r in t)e.push(r+"="+encodeURIComponent(t[r]));return e.join("&")},e.getQuery=function(t,e){if("undefined"==typeof window)return!1;var r=e||window.location.search,n=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""},e.getHash=function(t){if("undefined"==typeof window)return"";var e=window.location.hash.match(new RegExp("[#?&/]"+t+"=([^&#]*)"));return e?e[1]:""},e.removeParam=function(t,e){var r=e.split("?")[0],n=[],o=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==o){for(var i=(n=o.split("&")).length-1;i>=0;i-=1)n[i].split("=")[0]===t&&n.splice(i,1);r=r+"?"+n.join("&")}return r},e.createPromiseCallback=function(){var t;if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var r=new Promise((function(e,r){t=function(t,n){return t?r(t):e(n)}}));return t.promise=r,t},e.execCallback=function(t,e,r){if(void 0===r&&(r=null),t&&"function"==typeof t)return t(e,r);if(e)throw e;return r},e.printWarn=function(t,e){console.warn("["+a.SDK_NAME+"]["+t+"]:"+e)},e.printError=function(t,e){console.error({code:t,msg:"["+a.SDK_NAME+"]["+t+"]:"+e})},e.printInfo=function(t,e){console.log("["+a.SDK_NAME+"]["+t+"]:"+e)},e.throwError=function(t,e){throw new Error(JSON.stringify({code:t,msg:"["+a.SDK_NAME+"]["+t+"]:"+e}))}},function(t,e,r){(function(e){var n;t.exports=(n=n||function(t,n){var o;if("undefined"!=typeof window&&window.crypto&&(o=window.crypto),!o&&"undefined"!=typeof window&&window.msCrypto&&(o=window.msCrypto),!o&&void 0!==e&&e.crypto&&(o=e.crypto),!o)try{o=r(13)}catch(t){}var i=function(){if(o){if("function"==typeof o.getRandomValues)try{return o.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof o.randomBytes)try{return o.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),a={},u=a.lib={},c=u.Base={extend:function(t){var e=s(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},l=u.WordArray=c.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||p).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,o=t.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var s=r[i>>>2]>>>24-i%4*8&255;e[n+i>>>2]|=s<<24-(n+i)%4*8}else for(i=0;i<o;i+=4)e[n+i>>>2]=r[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(i());return new l.init(e,t)}}),f=a.enc={},p=f.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],o=0;o<r;o++){var i=e[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new l.init(r,e/2)}},d=f.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],o=0;o<r;o++){var i=e[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new l.init(r,e)}},h=f.Utf8={stringify:function(t){try{return decodeURIComponent(escape(d.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return d.parse(unescape(encodeURIComponent(t)))}},v=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=h.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,n=this._data,o=n.words,i=n.sigBytes,s=this.blockSize,a=i/(4*s),u=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,c=t.min(4*u,i);if(u){for(var f=0;f<u;f+=s)this._doProcessBlock(o,f);r=o.splice(0,u),n.sigBytes-=c}return new l.init(r,c)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),y=(u.Hasher=v.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new y.HMAC.init(t,r).finalize(e)}}}),a.algo={});return a}(Math),n)}).call(this,r(12))},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(4),e),o(r(8),e)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PROTOCOL=e.SDK_NAME=void 0,e.SDK_NAME="@cloudbase/js-sdk",e.PROTOCOL="https:"},function(t,e,r){"use strict";var n;r.r(e),r.d(e,"StorageType",(function(){return n})),r.d(e,"AbstractSDKRequest",(function(){return o})),r.d(e,"AbstractStorage",(function(){return i})),r.d(e,"formatUrl",(function(){return s})),function(t){t.local="local",t.none="none",t.session="session"}(n||(n={}));var o=function(){},i=function(){};function s(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";for(var i in r)""===o?!n&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.registerStorage=void 0;var n=r(7);Object.defineProperty(e,"registerStorage",{enumerable:!0,get:function(){return n.registerStorage}})},function(t,e,r){"use strict";r.r(e),r.d(e,"registerStorage",(function(){return h}));var n=r(0),o=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},i=function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},s=n.constants.SDK_NAME,a=n.constants.ERRORS,u=n.utils.isArray,c=n.utils.isString,l=n.utils.isPalinObject,f=n.utils.execCallback,p=function(t,e){return o(this,void 0,void 0,(function(){var r,n,o,p,d,h,v;return i(this,(function(i){switch(i.label){case 0:if(!(r=t.fileList)||!u(r)||0===r.length)return h=new Error("["+s+"]["+a.INVALID_PARAMS+"][storage.getTempFileURL] fileList must not be empty"),[2,f(e,h)];for(n=[],o=0,p=r;o<p.length;o++)if(d=p[o],l(d)){if(!d.hasOwnProperty("fileID")||!d.hasOwnProperty("maxAge"))return h=new Error("["+s+"]["+a.INVALID_PARAMS+"][storage.getTempFileURL] file info must include fileID and maxAge "),[2,f(e,h)];n.push({fileid:d.fileID,max_age:d.maxAge})}else{if(!c(d))return h=new Error("["+s+"]["+a.INVALID_PARAMS+"][storage.getTempFileURL] invalid fileList"),[2,f(e,h)];n.push({fileid:d})}return"storage.batchGetDownloadUrl",[4,this.request.send("storage.batchGetDownloadUrl",{file_list:n})];case 1:return(v=i.sent()).code?[2,f(e,null,v)]:[2,f(e,null,{fileList:v.data.download_list,requestId:v.requestId})]}}))}))},d={name:"storage",entity:{uploadFile:function(t,e){return o(this,void 0,void 0,(function(){var r,n,o,u,c,l,p,d,h,v,y,g,_,m;return i(this,(function(i){switch(i.label){case 0:return r=t.cloudPath,n=t.filePath,o=t.onUploadProgress,"storage.getUploadMetadata",[4,(u=this.request).send("storage.getUploadMetadata",{path:r})];case 1:return c=i.sent(),l=c.data,p=l.url,d=l.authorization,h=l.token,v=l.fileId,y=l.cosFileId,g=c.requestId,_={key:r,signature:d,"x-cos-meta-fileid":y,success_action_status:"201","x-cos-security-token":h},[4,u.upload({url:p,data:_,file:n,name:r,onUploadProgress:o})];case 2:return 201===(m=i.sent()).statusCode?[2,f(e,null,{fileID:v,requestId:g})]:[2,f(e,new Error("["+s+"]["+a.OPERATION_FAIL+"][storage]:"+m.data))]}}))}))},deleteFile:function(t,e){return o(this,void 0,void 0,(function(){var r,n,o,l,p,d;return i(this,(function(i){switch(i.label){case 0:if(!(r=t.fileList)||!u(r)||0===r.length)throw new Error("["+s+"]["+a.INVALID_PARAMS+"][storage.deleteFile] fileList must not be empty");for(n=0,o=r;n<o.length;n++)if(!(l=o[n])||!c(l))throw new Error("["+s+"]["+a.INVALID_PARAMS+"][storage.deleteFile] fileID must be string");return"storage.batchDeleteFile",[4,this.request.send("storage.batchDeleteFile",{fileid_list:r})];case 1:return(p=i.sent()).code?[2,f(e,null,p)]:(d={fileList:p.data.delete_list,requestId:p.requestId},[2,f(e,null,d)])}}))}))},getTempFileURL:p,downloadFile:function(t,e){return o(this,void 0,void 0,(function(){var r,n,o,s,a,u;return i(this,(function(i){switch(i.label){case 0:return r=t.fileID,[4,p.call(this,{fileList:[{fileID:r,maxAge:600}]})];case 1:return n=i.sent(),"SUCCESS"!==(o=n.fileList[0]).code?[2,f(e,o)]:(s=this.request,a=encodeURI(o.download_url),[4,s.download({url:a})]);case 2:return u=i.sent(),[2,f(e,null,u)]}}))}))},getUploadMetadata:function(t,e){return o(this,void 0,void 0,(function(){var r,n,o,s,a;return i(this,(function(i){switch(i.label){case 0:r=t.cloudPath,n=this.request,o="storage.getUploadMetadata",i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n.send(o,{path:r})];case 2:return s=i.sent(),[2,f(e,null,s)];case 3:return a=i.sent(),[2,f(e,a)];case 4:return[2]}}))}))}}};try{cloudbase.registerComponent(d)}catch(t){}function h(t){t.registerComponent(d)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ERRORS=void 0,e.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.useDefaultAdapter=e.useAdapters=e.RUNTIME=void 0;var s,a=i(r(10)),u=r(1);!function(t){t.WEB="web",t.WX_MP="wx_mp"}(s=e.RUNTIME||(e.RUNTIME={})),e.useAdapters=function(t){for(var e=0,r=u.isArray(t)?t:[t];e<r.length;e++){var n=r[e],o=n.isMatch,i=n.genAdapter,s=n.runtime;if(o())return{adapter:i(),runtime:s}}},e.useDefaultAdapter=function(){return{adapter:a.genAdapter(),runtime:s.WEB}}},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},s=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.WebRequest=e.genAdapter=void 0;var u=r(5),c=r(1),l=r(4),f=function(t){function e(e){var r=t.call(this)||this,n=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=o||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return o(e,t),e.prototype.get=function(t){return this._request(i(i({},t),{method:"get"}),this._restrictedMethods.includes("get"))},e.prototype.post=function(t){return this._request(i(i({},t),{method:"post"}),this._restrictedMethods.includes("post"))},e.prototype.put=function(t){return this._request(i(i({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,r=t.file,n=t.name,o=new FormData;for(var s in e)o.append(s,e[s]);return o.append("key",n),o.append("file",r),this._request(i(i({},t),{data:o,method:"post"}),this._restrictedMethods.includes("upload"))},e.prototype.download=function(t){return s(this,void 0,void 0,(function(){var e,r;return a(this,(function(n){return e=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(r=document.createElement("a")).href=t.url,r.setAttribute("download",e),r.setAttribute("target","_blank"),document.body.appendChild(r),r.click(),[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}))}))},e.prototype._request=function(t,e){var r=this;void 0===e&&(e=!1);var n=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=t.url,u=t.headers,f=void 0===u?{}:u,p=t.data,d=t.responseType,h=t.withCredentials,v=t.body,y=t.onUploadProgress,g=c.formatUrl(l.PROTOCOL,a,"get"===n?p:{}),_=new XMLHttpRequest;for(var m in _.open(n,g),d&&(_.responseType=d),f)_.setRequestHeader(m,f[m]);y&&_.addEventListener("progress",y),_.onreadystatechange=function(){var t={};if(4===_.readyState){var e=_.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};e.forEach((function(t){var e=t.split(": "),n=e.shift().toLowerCase(),o=e.join(": ");r[n]=o})),t.header=r,t.statusCode=_.status;try{t.data=JSON.parse(_.responseText)}catch(e){t.data=_.responseText}clearTimeout(i),o(t)}},e&&r._timeout&&(i=setTimeout((function(){console.warn(r._timeoutMsg),_.abort()}),r._timeout)),s=c.isFormData(p)?p:"application/x-www-form-urlencoded"===f["content-type"]?c.toQueryString(p):v||(p?JSON.stringify(p):void 0),h&&(_.withCredentials=!0),_.send(s)}))},e}(u.AbstractSDKRequest);e.WebRequest=f,e.genAdapter=function(){return{root:window,reqClass:f,wsClass:WebSocket,localStorage:localStorage,sessionStorage:sessionStorage}}},function(t,e,r){var n;t.exports=(n=r(2),r(14),r(15),n.HmacSHA256)},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(e,r){if(void 0===t){var n=new Error("Cannot find module 'null'");throw n.code="MODULE_NOT_FOUND",n}e.exports=t},function(t,e,r){var n;t.exports=(n=r(2),function(t){var e=n,r=e.lib,o=r.WordArray,i=r.Hasher,s=e.algo,a=[],u=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var n=2,o=0;o<64;)e(n)&&(o<8&&(a[o]=r(t.pow(n,.5))),u[o]=r(t.pow(n,1/3)),o++),n++}();var c=[],l=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],l=r[5],f=r[6],p=r[7],d=0;d<64;d++){if(d<16)c[d]=0|t[e+d];else{var h=c[d-15],v=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,y=c[d-2],g=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[d]=v+c[d-7]+g+c[d-16]}var _=n&o^n&i^o&i,m=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),b=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+u[d]+c[d];p=f,f=l,l=a,a=s+b|0,s=i,i=o,o=n,n=b+(m+_)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+p|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=t.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(l),e.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)},function(t,e,r){var n,o,i,s;t.exports=(n=r(2),i=(o=n).lib.Base,s=o.enc.Utf8,void(o.algo.HMAC=i.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=s.parse(e));var r=t.blockSize,n=4*r;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),i=this._iKey=e.clone(),a=o.words,u=i.words,c=0;c<r;c++)a[c]^=1549556828,u[c]^=909522486;o.sigBytes=i.sigBytes=n,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,r=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(r))}})))},function(t,e,r){var n,o,i;t.exports=(i=r(2),o=(n=i).lib.WordArray,n.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var o=[],i=0;i<r;i+=3)for(var s=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<r;a++)o.push(n.charAt(s>>>6*(3-a)&63));var u=n.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(t){var e=t.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<r.length;i++)n[r.charCodeAt(i)]=i}var s=r.charAt(64);if(s){var a=t.indexOf(s);-1!==a&&(e=a)}return function(t,e,r){for(var n=[],i=0,s=0;s<e;s++)if(s%4){var a=r[t.charCodeAt(s-1)]<<s%4*2,u=r[t.charCodeAt(s)]>>>6-s%4*2,c=a|u;n[i>>>2]|=c<<24-i%4*8,i++}return o.create(n,i)}(t,e,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},function(t,e,r){var n;t.exports=(n=r(2),n.enc.Utf8)},function(t,e,r){"use strict";(function(t){var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.CloudbaseCache=void 0;var a=r(5),u=r(1),c=r(3),l=function(t){function e(e){var r=t.call(this)||this;return r._root=e,e.tcbCacheObject||(e.tcbCacheObject={}),r}return o(e,t),e.prototype.setItem=function(t,e){this._root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this._root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this._root.tcbCacheObject[t]},e.prototype.clear=function(){delete this._root.tcbCacheObject},e}(a.AbstractStorage);function f(t,e){switch(t){case"local":return e.localStorage?e.localStorage:(u.printWarn(c.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(e.root));case"none":return new l(e.root);default:return e.sessionStorage?e.sessionStorage:(u.printWarn(c.ERRORS.INVALID_PARAMS,"sessionStorage is not supported on current platform"),new l(e.root))}}var p=function(){function e(t){this.keys={};var e=t.persistence,r=t.platformInfo,n=void 0===r?{}:r,o=t.keys,i=void 0===o?{}:o,s=t.alwaysLocalKeys,a=void 0===s?[]:s;this._platformInfo=n,this._alwaysLocalKeys=a,this._storage||(this._persistence=n.adapter.primaryStorage||e,this._storage=f(this._persistence,n.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this._storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this._persistence},enumerable:!1,configurable:!0}),e.prototype.updatePersistence=function(t){if("async"!==this.mode){if(t!==this._persistence){var e="local"===this._persistence;this._persistence=t;var r=f(t,this._platformInfo.adapter);for(var n in this.keys){var o=this.keys[n];if(!e||!this._alwaysLocalKeys.includes(n)){var i=this._storage.getItem(o);u.isUndefined(i)||u.isNull(i)||(r.setItem(o,i),this._storage.removeItem(o))}}this._storage=r}}else u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use updatePersistenceAsync insteed")},e.prototype.updatePersistenceAsync=function(t){return i(this,void 0,void 0,(function(){var e,r,n,o,i,a,c,l;return s(this,(function(s){switch(s.label){case 0:if(t===this._persistence)return[2];for(o in e="local"===this._persistence,this._persistence=t,r=f(t,this._platformInfo.adapter),n=[],this.keys)n.push(o);i=0,s.label=1;case 1:return i<n.length?(a=n[i],c=this.keys[a],e&&this._alwaysLocalKeys.includes(a)?[3,4]:[4,this._storage.getItem(c)]):[3,5];case 2:return l=s.sent(),u.isUndefined(l)||u.isNull(l)?[3,4]:(r.setItem(c,l),[4,this._storage.removeItem(c)]);case 3:s.sent(),s.label=4;case 4:return i++,[3,1];case 5:return this._storage=r,[2]}}))}))},e.prototype.setStore=function(t,e,r){if("async"!==this.mode){if(this._storage)try{var n={version:r||"localCachev1",content:e};this._storage.setItem(t,JSON.stringify(n))}catch(t){return}}else u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(t,e,r){return i(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:if(!this._storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:e},[4,this._storage.setItem(t,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,r){var n;if("async"!==this.mode){try{if(void 0!==t&&(null===(n=t.env)||void 0===n?void 0:n.tcb_token))return t.env.tcb_token;if(!this._storage)return""}catch(t){return""}r=r||"localCachev1";var o=this._storage.getItem(e);return o&&o.indexOf(r)>=0?JSON.parse(o).content:""}u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,r){var n;return i(this,void 0,void 0,(function(){var o;return s(this,(function(i){switch(i.label){case 0:try{if(void 0!==t&&(null===(n=t.env)||void 0===n?void 0:n.tcb_token))return[2,t.env.tcb_token];if(!this._storage)return[2,""]}catch(t){return[2,""]}return r=r||"localCachev1",[4,this._storage.getItem(e)];case 1:return(o=i.sent())&&o.indexOf(r)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},e.prototype.removeStore=function(t){"async"!==this.mode?this._storage.removeItem(t):u.printWarn(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(t){return i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this._storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},e}();e.CloudbaseCache=p}).call(this,r(19))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var u,c=[],l=!1,f=-1;function p(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!l){var t=a(p);l=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new h(t,e)),1!==c.length||l||a(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n};Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.activateEvent=e.addEventListener=e.CloudbaseEventEmitter=e.IErrorEvent=e.CloudbaseEvent=void 0;var s=r(1);var a=function(t,e){this.data=e||null,this.name=t};e.CloudbaseEvent=a;var u=function(t){function e(e,r){var n=t.call(this,"error",{error:e,data:r})||this;return n.error=e,n}return o(e,t),e}(a);e.IErrorEvent=u;var c=function(){function t(){this._listeners={}}return t.prototype.on=function(t,e){return function(t,e,r){r[t]=r[t]||[],r[t].push(e)}(t,e,this._listeners),this},t.prototype.off=function(t,e){return function(t,e,r){if(null==r?void 0:r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}(t,e,this._listeners),this},t.prototype.fire=function(t,e){if(s.isInstanceOf(t,u))return console.error(t.error),this;var r=s.isString(t)?new a(t,e||{}):t,n=r.name;if(this._listens(n)){r.target=this;for(var o=0,c=this._listeners[n]?i(this._listeners[n]):[];o<c.length;o++){c[o].call(this,r)}}return this},t.prototype._listens=function(t){return this._listeners[t]&&this._listeners[t].length>0},t}();e.CloudbaseEventEmitter=c;var l=new c;e.addEventListener=function(t,e){l.on(t,e)},e.activateEvent=function(t,e){void 0===e&&(e={}),l.fire(t,e)},e.removeEventListener=function(t,e){l.off(t,e)}}])}));
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(function(){try{return require("null")}catch(e){}}()):"function"==typeof define&&define.amd?define("cloudbase_auth",["null"],t):"object"==typeof exports?exports.cloudbase_auth=t(function(){try{return require("null")}catch(e){}}()):e.cloudbase_auth=t(e.null)}("undefined"!=typeof window?window:this,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.events=t.cache=t.adapters=t.constants=void 0;var s=i(n(3));t.constants=s;var c=i(n(8));t.adapters=c;var a=i(n(17));t.cache=a;var u=i(n(19));t.events=u;var h=i(n(1));t.utils=h},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.createSign=t.formatUrl=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var o=r(n(10)),i=r(n(15)),s=r(n(16)),c=n(3);function a(e){var t=i.default.stringify(e);return t=(t=(t=t.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},t.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.formatUrl=function(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";for(var i in n)""===o?!r&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(n[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t},t.createSign=function(e,t){var n=a(s.default.parse(JSON.stringify({alg:"HS256",typ:"JWT"})))+"."+a(s.default.parse(JSON.stringify(e)));return n+"."+a(o.default(n,t))},t.toQueryString=function(e){void 0===e&&(e={});var t=[];for(var n in e)t.push(n+"="+encodeURIComponent(e[n]));return t.join("&")},t.getQuery=function(e,t){if("undefined"==typeof window)return!1;var n=t||window.location.search,r=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),o=n.substr(n.indexOf("?")+1).match(r);return null!=o?o[2]:""},t.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]"+e+"=([^&#]*)"));return t?t[1]:""},t.removeParam=function(e,t){var n=t.split("?")[0],r=[],o=-1!==t.indexOf("?")?t.split("?")[1]:"";if(""!==o){for(var i=(r=o.split("&")).length-1;i>=0;i-=1)r[i].split("=")[0]===e&&r.splice(i,1);n=n+"?"+r.join("&")}return n},t.createPromiseCallback=function(){var e;if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var n=new Promise((function(t,n){e=function(e,r){return e?n(e):t(r)}}));return e.promise=n,e},t.execCallback=function(e,t,n){if(void 0===n&&(n=null),e&&"function"==typeof e)return e(t,n);if(t)throw t;return n},t.printWarn=function(e,t){console.warn("["+c.SDK_NAME+"]["+e+"]:"+t)},t.printError=function(e,t){console.error({code:e,msg:"["+c.SDK_NAME+"]["+e+"]:"+t})},t.printInfo=function(e,t){console.log("["+c.SDK_NAME+"]["+e+"]:"+t)},t.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"["+c.SDK_NAME+"]["+e+"]:"+t}))}},function(e,t,n){(function(t){var r;e.exports=(r=r||function(e,r){var o;if("undefined"!=typeof window&&window.crypto&&(o=window.crypto),!o&&"undefined"!=typeof window&&window.msCrypto&&(o=window.msCrypto),!o&&void 0!==t&&t.crypto&&(o=t.crypto),!o)try{o=n(12)}catch(e){}var i=function(){if(o){if("function"==typeof o.getRandomValues)try{return o.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof o.randomBytes)try{return o.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),c={},a=c.lib={},u=a.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},h=a.WordArray=u.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var s=n[i>>>2]>>>24-i%4*8&255;t[r+i>>>2]|=s<<24-(r+i)%4*8}else for(i=0;i<o;i+=4)t[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=u.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(i());return new h.init(t,e)}}),f=c.enc={},l=f.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new h.init(n,t/2)}},p=f.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o<n;o++){var i=t[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new h.init(n,t)}},d=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(p.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return p.parse(unescape(encodeURIComponent(e)))}},y=a.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,i=r.sigBytes,s=this.blockSize,c=i/(4*s),a=(c=t?e.ceil(c):e.max((0|c)-this._minBufferSize,0))*s,u=e.min(4*a,i);if(a){for(var f=0;f<a;f+=s)this._doProcessBlock(o,f);n=o.splice(0,a),r.sigBytes-=u}return new h.init(n,u)},clone:function(){var e=u.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),_=(a.Hasher=y.extend({cfg:u.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new _.HMAC.init(e,n).finalize(t)}}}),c.algo={});return c}(Math),r)}).call(this,n(11))},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(4),t),o(n(7),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PROTOCOL=t.SDK_NAME=void 0,t.SDK_NAME="@cloudbase/js-sdk",t.PROTOCOL="https:"},function(e,t,n){"use strict";var r;n.r(t),n.d(t,"StorageType",(function(){return r})),n.d(t,"AbstractSDKRequest",(function(){return o})),n.d(t,"AbstractStorage",(function(){return i})),n.d(t,"formatUrl",(function(){return s})),function(e){e.local="local",e.none="none",e.session="session"}(r||(r={}));var o=function(){},i=function(){};function s(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";for(var i in n)""===o?!r&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(n[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerAuth=void 0;var r=n(20);Object.defineProperty(t,"registerAuth",{enumerable:!0,get:function(){return r.registerAuth}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERRORS=void 0,t.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.useDefaultAdapter=t.useAdapters=t.RUNTIME=void 0;var s,c=i(n(9)),a=n(1);!function(e){e.WEB="web",e.WX_MP="wx_mp"}(s=t.RUNTIME||(t.RUNTIME={})),t.useAdapters=function(e){for(var t=0,n=a.isArray(e)?e:[e];t<n.length;t++){var r=n[t],o=r.isMatch,i=r.genAdapter,s=r.runtime;if(o())return{adapter:i(),runtime:s}}},t.useDefaultAdapter=function(){return{adapter:c.genAdapter(),runtime:s.WEB}}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))},c=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRequest=t.genAdapter=void 0;var a=n(5),u=n(1),h=n(4),f=function(e){function t(t){var n=e.call(this)||this,r=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return n._timeout=r||0,n._timeoutMsg=o||"请求超时",n._restrictedMethods=i||["get","post","upload","download"],n}return o(t,e),t.prototype.get=function(e){return this._request(i(i({},e),{method:"get"}),this._restrictedMethods.includes("get"))},t.prototype.post=function(e){return this._request(i(i({},e),{method:"post"}),this._restrictedMethods.includes("post"))},t.prototype.put=function(e){return this._request(i(i({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,o=new FormData;for(var s in t)o.append(s,t[s]);return o.append("key",r),o.append("file",n),this._request(i(i({},e),{data:o,method:"post"}),this._restrictedMethods.includes("upload"))},t.prototype.download=function(e){return s(this,void 0,void 0,(function(){var t,n,r,o;return c(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.get(i(i({},e),{headers:{},responseType:"blob"}))];case 1:return t=s.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[3,3];case 2:return s.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype._request=function(e,t){var n=this;void 0===t&&(t=!1);var r=String(e.method).toLowerCase()||"get";return new Promise((function(o){var i,s,c=e.url,a=e.headers,f=void 0===a?{}:a,l=e.data,p=e.responseType,d=e.withCredentials,y=e.body,_=e.onUploadProgress,v=u.formatUrl(h.PROTOCOL,c,"get"===r?l:{}),g=new XMLHttpRequest;for(var b in g.open(r,v),p&&(g.responseType=p),f)g.setRequestHeader(b,f[b]);_&&g.addEventListener("progress",_),g.onreadystatechange=function(){var e={};if(4===g.readyState){var t=g.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach((function(e){var t=e.split(": "),r=t.shift().toLowerCase(),o=t.join(": ");n[r]=o})),e.header=n,e.statusCode=g.status;try{e.data="blob"===p?g.response:JSON.parse(g.responseText)}catch(t){e.data="blob"===p?g.response:g.responseText}clearTimeout(i),o(e)}},t&&n._timeout&&(i=setTimeout((function(){console.warn(n._timeoutMsg),g.abort()}),n._timeout)),s=u.isFormData(l)?l:"application/x-www-form-urlencoded"===f["content-type"]?u.toQueryString(l):y||(l?JSON.stringify(l):void 0),d&&(g.withCredentials=!0),g.send(s)}))},t}(a.AbstractSDKRequest);t.WebRequest=f,t.genAdapter=function(){return{root:window,reqClass:f,wsClass:WebSocket,localStorage:localStorage,sessionStorage:sessionStorage}}},function(e,t,n){var r;e.exports=(r=n(2),n(13),n(14),r.HmacSHA256)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(t,n){if(void 0===e){var r=new Error("Cannot find module 'null'");throw r.code="MODULE_NOT_FOUND",r}t.exports=e},function(e,t,n){var r;e.exports=(r=n(2),function(e){var t=r,n=t.lib,o=n.WordArray,i=n.Hasher,s=t.algo,c=[],a=[];!function(){function t(t){for(var n=e.sqrt(t),r=2;r<=n;r++)if(!(t%r))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var r=2,o=0;o<64;)t(r)&&(o<8&&(c[o]=n(e.pow(r,.5))),a[o]=n(e.pow(r,1/3)),o++),r++}();var u=[],h=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(c.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],s=n[3],c=n[4],h=n[5],f=n[6],l=n[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var d=u[p-15],y=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,_=u[p-2],v=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;u[p]=y+u[p-7]+v+u[p-16]}var g=r&o^r&i^o&i,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=l+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&h^~c&f)+a[p]+u[p];l=f,f=h,h=c,c=s+w|0,s=i,i=o,o=r,r=w+(b+g)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+s|0,n[4]=n[4]+c|0,n[5]=n[5]+h|0,n[6]=n[6]+f|0,n[7]=n[7]+l|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(h),t.HmacSHA256=i._createHmacHelper(h)}(Math),r.SHA256)},function(e,t,n){var r,o,i,s;e.exports=(r=n(2),i=(o=r).lib.Base,s=o.enc.Utf8,void(o.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),i=this._iKey=t.clone(),c=o.words,a=i.words,u=0;u<n;u++)c[u]^=1549556828,a[u]^=909522486;o.sigBytes=i.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))},function(e,t,n){var r,o,i;e.exports=(i=n(2),o=(r=i).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var o=[],i=0;i<n;i+=3)for(var s=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,c=0;c<4&&i+.75*c<n;c++)o.push(r.charAt(s>>>6*(3-c)&63));var a=r.charAt(64);if(a)for(;o.length%4;)o.push(a);return o.join("")},parse:function(e){var t=e.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var i=0;i<n.length;i++)r[n.charCodeAt(i)]=i}var s=n.charAt(64);if(s){var c=e.indexOf(s);-1!==c&&(t=c)}return function(e,t,n){for(var r=[],i=0,s=0;s<t;s++)if(s%4){var c=n[e.charCodeAt(s-1)]<<s%4*2,a=n[e.charCodeAt(s)]>>>6-s%4*2,u=c|a;r[i>>>2]|=u<<24-i%4*8,i++}return o.create(r,i)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},function(e,t,n){var r;e.exports=(r=n(2),r.enc.Utf8)},function(e,t,n){"use strict";(function(e){var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var c=n(5),a=n(1),u=n(3),h=function(e){function t(t){var n=e.call(this)||this;return n._root=t,t.tcbCacheObject||(t.tcbCacheObject={}),n}return o(t,e),t.prototype.setItem=function(e,t){this._root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this._root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this._root.tcbCacheObject[e]},t.prototype.clear=function(){delete this._root.tcbCacheObject},t}(c.AbstractStorage);function f(e,t){switch(e){case"local":return t.localStorage?t.localStorage:(a.printWarn(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new h(t.root));case"none":return new h(t.root);default:return t.sessionStorage?t.sessionStorage:(a.printWarn(u.ERRORS.INVALID_PARAMS,"sessionStorage is not supported on current platform"),new h(t.root))}}var l=function(){function t(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=void 0===n?{}:n,o=e.keys,i=void 0===o?{}:o,s=e.alwaysLocalKeys,c=void 0===s?[]:s;this._platformInfo=r,this._alwaysLocalKeys=c,this._storage||(this._persistence=r.adapter.primaryStorage||t,this._storage=f(this._persistence,r.adapter),this.keys=i)}return Object.defineProperty(t.prototype,"mode",{get:function(){return this._storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this._persistence},enumerable:!1,configurable:!0}),t.prototype.updatePersistence=function(e){if("async"!==this.mode){if(e!==this._persistence){var t="local"===this._persistence;this._persistence=e;var n=f(e,this._platformInfo.adapter);for(var r in this.keys){var o=this.keys[r];if(!t||!this._alwaysLocalKeys.includes(r)){var i=this._storage.getItem(o);a.isUndefined(i)||a.isNull(i)||(n.setItem(o,i),this._storage.removeItem(o))}}this._storage=n}}else a.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use updatePersistenceAsync insteed")},t.prototype.updatePersistenceAsync=function(e){return i(this,void 0,void 0,(function(){var t,n,r,o,i,c,u,h;return s(this,(function(s){switch(s.label){case 0:if(e===this._persistence)return[2];for(o in t="local"===this._persistence,this._persistence=e,n=f(e,this._platformInfo.adapter),r=[],this.keys)r.push(o);i=0,s.label=1;case 1:return i<r.length?(c=r[i],u=this.keys[c],t&&this._alwaysLocalKeys.includes(c)?[3,4]:[4,this._storage.getItem(u)]):[3,5];case 2:return h=s.sent(),a.isUndefined(h)||a.isNull(h)?[3,4]:(n.setItem(u,h),[4,this._storage.removeItem(u)]);case 3:s.sent(),s.label=4;case 4:return i++,[3,1];case 5:return this._storage=n,[2]}}))}))},t.prototype.setStore=function(e,t,n){if("async"!==this.mode){if(this._storage)try{var r={version:n||"localCachev1",content:t};this._storage.setItem(e,JSON.stringify(r))}catch(e){return}}else a.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(e,t,n){return i(this,void 0,void 0,(function(){var r;return s(this,(function(o){switch(o.label){case 0:if(!this._storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),r={version:n||"localCachev1",content:t},[4,this._storage.setItem(e,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,n){var r;if("async"!==this.mode){try{if(void 0!==e&&(null===(r=e.env)||void 0===r?void 0:r.tcb_token))return e.env.tcb_token;if(!this._storage)return""}catch(e){return""}n=n||"localCachev1";var o=this._storage.getItem(t);return o&&o.indexOf(n)>=0?JSON.parse(o).content:""}a.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,n){var r;return i(this,void 0,void 0,(function(){var o;return s(this,(function(i){switch(i.label){case 0:try{if(void 0!==e&&(null===(r=e.env)||void 0===r?void 0:r.tcb_token))return[2,e.env.tcb_token];if(!this._storage)return[2,""]}catch(e){return[2,""]}return n=n||"localCachev1",[4,this._storage.getItem(t)];case 1:return(o=i.sent())&&o.indexOf(n)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},t.prototype.removeStore=function(e){"async"!==this.mode?this._storage.removeItem(e):a.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(e){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this._storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},t}();t.CloudbaseCache=l}).call(this,n(18))},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var a,u=[],h=!1,f=-1;function l(){h&&a&&(h=!1,a.length?u=a.concat(u):f=-1,u.length&&p())}function p(){if(!h){var e=c(l);h=!0;for(var t=u.length;t;){for(a=u,u=[];++f<t;)a&&a[f].run();f=-1,t=u.length}a=null,h=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function y(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new d(e,t)),1!==u.length||h||c(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],s=0,c=i.length;s<c;s++,o++)r[o]=i[s];return r};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var s=n(1);var c=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=c;var a=function(e){function t(t,n){var r=e.call(this,"error",{error:t,data:n})||this;return r.error=t,r}return o(t,e),t}(c);t.IErrorEvent=a;var u=function(){function e(){this._listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this._listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(null==n?void 0:n[e]){var r=n[e].indexOf(t);-1!==r&&n[e].splice(r,1)}}(e,t,this._listeners),this},e.prototype.fire=function(e,t){if(s.isInstanceOf(e,a))return console.error(e.error),this;var n=s.isString(e)?new c(e,t||{}):e,r=n.name;if(this._listens(r)){n.target=this;for(var o=0,u=this._listeners[r]?i(this._listeners[r]):[];o<u.length;o++){u[o].call(this,n)}}return this},e.prototype._listens=function(e){return this._listeners[e]&&this._listeners[e].length>0},e}();t.CloudbaseEventEmitter=u;var h=new u;t.addEventListener=function(e,t){h.on(e,t)},t.activateEvent=function(e,t){void 0===t&&(t={}),h.fire(e,t)},t.removeEventListener=function(e,t){h.off(e,t)}},function(e,t,n){"use strict";n.r(t),n.d(t,"LoginState",(function(){return ie})),n.d(t,"Auth",(function(){return se})),n.d(t,"AuthProvider",(function(){return c})),n.d(t,"EVENTS",(function(){return ce})),n.d(t,"eventBus",(function(){return re})),n.d(t,"registerAuth",(function(){return ue})),n.d(t,"registerProvider",(function(){return he}));var r,o=n(0),i=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))},s=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},c=function(){function e(e){this._config=e,this._cache=e.cache,this._request=e.request}return e.prototype.checkLocalLoginState=function(){return i(this,void 0,void 0,(function(){var e,t,n,r,o,i;return s(this,(function(s){switch(s.label){case 0:return e=this._cache.keys,t=e.accessTokenKey,n=e.accessTokenExpireKey,[4,this._cache.getStoreAsync(t)];case 1:return r=s.sent(),[4,this._cache.getStoreAsync(n)];case 2:return o=s.sent(),r?o&&o>Date.now()?[4,(i=new ie({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()]:[3,4]:[3,7];case 3:return s.sent(),[2,i];case 4:return[4,this._cache.removeStoreAsync(t)];case 5:return s.sent(),[4,this._cache.removeStoreAsync(n)];case 6:s.sent(),s.label=7;case 7:return[2]}}))}))},e.prototype.setRefreshToken=function(e){return i(this,void 0,void 0,(function(){var t,n,r,o;return s(this,(function(i){switch(i.label){case 0:return t=this._cache.keys,n=t.accessTokenKey,r=t.accessTokenExpireKey,o=t.refreshTokenKey,[4,this._cache.removeStoreAsync(n)];case 1:return i.sent(),[4,this._cache.removeStoreAsync(r)];case 2:return i.sent(),[4,this._cache.setStoreAsync(o,e)];case 3:return i.sent(),[2]}}))}))},e.prototype.setAccessToken=function(e,t){return i(this,void 0,void 0,(function(){var n,r,o;return s(this,(function(i){switch(i.label){case 0:return n=this._cache.keys,r=n.accessTokenKey,o=n.accessTokenExpireKey,[4,this._cache.setStoreAsync(r,e)];case 1:return i.sent(),[4,this._cache.setStoreAsync(o,t)];case 2:return i.sent(),[2]}}))}))},e.prototype.refreshUserInfo=function(){return i(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return"auth.getUserInfo",[4,this._request.send("auth.getUserInfo",{})];case 1:return e=t.sent().data,[4,this.setLocalUserInfo(e)];case 2:return t.sent(),[2,e]}}))}))},e.prototype.setLocalUserInfo=function(e){return i(this,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:return t=this._cache.keys.userInfoKey,[4,this._cache.setStoreAsync(t,e)];case 1:return n.sent(),[2]}}))}))},e}();!function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.NULL="NULL"}(r||(r={}));var a,u=(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),h=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))},f=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},l=o.constants.SDK_NAME,p=o.constants.ERRORS,d=o.adapters.RUNTIME,y=o.utils.getQuery,_=o.utils.getHash,v=o.utils.removeParam,g=o.utils.printWarn,b=function(e){function t(t,n,r,o){var i=e.call(this,t)||this;return i._runtime=t.runtime,i._appid=n,i._scope=r,i._state=o||"weixin",i}return u(t,e),t.prototype.signIn=function(){return h(this,void 0,void 0,(function(){return f(this,(function(e){return[2,g(p.OPERATION_FAIL,"API signIn has been deprecated, please use signInWithRedirect insteed")]}))}))},t.prototype.signInWithRedirect=function(){return h(this,void 0,void 0,(function(){return f(this,(function(e){return[2,this._redirect()]}))}))},t.prototype.getRedirectResult=function(e){return h(this,void 0,void 0,(function(){var t;return f(this,(function(n){return(t=w())?[2,this._signInWithCode(t,e)]:[2,null]}))}))},t.prototype.getLinkRedirectResult=function(e){return void 0===e&&(e={}),h(this,void 0,void 0,(function(){var t,n,r,o,i,s;return f(this,(function(c){return t=e.withUnionId,n=void 0!==t&&t,(r=w())?(o=this._appid,i=function(e){switch(e){case"snsapi_login":return"WECHAT-OPEN";default:return"WECHAT-PUBLIC"}}(this._scope),s=this._runtime===d.WX_MP?"1":"0",[2,this._request.send("auth.linkWithWeixinCode",{payload:{appid:o,loginType:i,code:r,hybridMiniapp:s,withUnionId:n}})]):[2,null]}))}))},t.prototype._redirect=function(){var e=v("code",location.href);e=v("state",e),e=encodeURIComponent(e);var t="//open.weixin.qq.com/connect/oauth2/authorize";"snsapi_login"===this._scope&&(t="//open.weixin.qq.com/connect/qrconnect");try{location.href=t+"?appid="+this._appid+"&redirect_uri="+e+"&response_type=code&scope="+this._scope+"&state="+this._state+"#wechat_redirect"}catch(e){throw new Error("["+l+"]["+p.UNKOWN_ERROR+"]"+e)}},t.prototype._signInWithCode=function(e,t){return h(this,void 0,void 0,(function(){var n,o,i,s,c,a,u,h;return f(this,(function(f){switch(f.label){case 0:return n=this._cache.keys,o=n.accessTokenKey,i=n.accessTokenExpireKey,s=n.refreshTokenKey,c=function(e){switch(e){case"snsapi_login":return"WECHAT-OPEN";default:return"WECHAT-PUBLIC"}}(this._scope),[4,this._getRefreshTokenByWXCode(this._appid,c,e,t)];case 1:return a=f.sent(),u=a.refreshToken,[4,this._cache.setStoreAsync(s,u)];case 2:return f.sent(),a.accessToken?[4,this._cache.setStoreAsync(o,a.accessToken)]:[3,4];case 3:f.sent(),f.label=4;case 4:return a.accessTokenExpire?[4,this._cache.setStoreAsync(i,String(a.accessTokenExpire+Date.now()))]:[3,6];case 5:f.sent(),f.label=6;case 6:return re.fire(ce.LOGIN_STATE_CHANGED),re.fire(ce.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:r.WECHAT,persistence:this._config.persistence}),[4,this.refreshUserInfo()];case 7:return f.sent(),[4,(h=new ie({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()];case 8:return f.sent(),[2,h]}}))}))},t.prototype._getRefreshTokenByWXCode=function(e,t,n,r){return void 0===r&&(r={}),h(this,void 0,void 0,(function(){var o,i,s,c,a,u;return f(this,(function(h){return o=r.withUnionId,i=void 0!==o&&o,s=r.createUser,c=void 0===s||s,a="snsapi_base"!==this._scope&&(r.syncUserInfo||!1),"auth.getJwt",u=this._runtime===d.WX_MP?"1":"0",[2,this._request.send("auth.getJwt",{appid:e,loginType:t,hybridMiniapp:u,syncUserInfo:a,loginCredential:n,withUnionId:i,createUser:c}).then((function(e){if(e.code)throw new Error("["+l+"]["+p.OPERATION_FAIL+"] failed login via wechat: "+e.code);if(e.refresh_token)return{refreshToken:e.refresh_token,accessToken:e.access_token,accessTokenExpire:e.access_token_expire};throw new Error("["+l+"]["+p.OPERATION_FAIL+"] action:getJwt not return refreshToken")}))]}))}))},t}(c);function w(){return y("code")||_("code")}var A=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),m=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))},I=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},O=o.constants.ERRORS,S=o.utils.throwError,T=o.utils.isString,E=function(e){function t(t){var n=e.call(this,t)||this;return n._onConverted=n._onConverted.bind(n),addEventListener(ce.ANONYMOUS_CONVERTED,n._onConverted),n}return A(t,e),t.prototype.signIn=function(){return m(this,void 0,void 0,(function(){var e,t,n,o,i,s,c;return I(this,(function(a){switch(a.label){case 0:return[4,this._cache.updatePersistenceAsync("local")];case 1:return a.sent(),e=this._cache.keys,t=e.anonymousUuidKey,n=e.refreshTokenKey,[4,this._cache.getStoreAsync(t)];case 2:return o=a.sent(),[4,this._cache.getStoreAsync(n)];case 3:return i=a.sent(),[4,this._request.send("auth.signInAnonymously",{anonymous_uuid:o,refresh_token:i})];case 4:return(s=a.sent()).uuid&&s.refresh_token?[4,this._setAnonymousUUID(s.uuid)]:[3,10];case 5:return a.sent(),[4,this.setRefreshToken(s.refresh_token)];case 6:return a.sent(),[4,this._request.refreshAccessToken()];case 7:return a.sent(),re.fire(ce.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:r.ANONYMOUS,persistence:"local"}),re.fire(ce.LOGIN_STATE_CHANGED),[4,(c=new ie({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()];case 8:return a.sent(),[4,c.user.refresh()];case 9:return a.sent(),[2,c];case 10:S(O.OPERATION_FAIL,JSON.stringify(s)||"anonymous signIn failed"),a.label=11;case 11:return[2]}}))}))},t.prototype.linkAndRetrieveDataWithTicket=function(e){return m(this,void 0,void 0,(function(){var t,n,o,i,s,c,a;return I(this,(function(u){switch(u.label){case 0:return T(e)||S(O.INVALID_PARAMS,"ticket must be a string"),t=this._cache.keys,n=t.anonymousUuidKey,o=t.refreshTokenKey,[4,this._cache.getStoreAsync(n)];case 1:return i=u.sent(),[4,this._cache.getStoreAsync(o)];case 2:return s=u.sent(),[4,this._request.send("auth.linkAndRetrieveDataWithTicket",{anonymous_uuid:i,refresh_token:s,ticket:e})];case 3:return(c=u.sent()).refresh_token?[4,this._clearAnonymousUUID()]:[3,8];case 4:return u.sent(),[4,this.setRefreshToken(c.refresh_token)];case 5:return u.sent(),[4,this._request.refreshAccessToken()];case 6:return u.sent(),re.fire(ce.ANONYMOUS_CONVERTED,{env:this._config.env}),re.fire(ce.LOGIN_TYPE_CHANGED,{loginType:r.CUSTOM,persistence:"local"}),[4,(a=new ie({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()];case 7:return u.sent(),[2,a];case 8:S(O.OPERATION_FAIL,JSON.stringify(c)||"linkAndRetrieveDataWithTicket failed"),u.label=9;case 9:return[2]}}))}))},t.prototype._setAnonymousUUID=function(e){return m(this,void 0,void 0,(function(){var t,n,o;return I(this,(function(i){switch(i.label){case 0:return t=this._cache.keys,n=t.anonymousUuidKey,o=t.loginTypeKey,[4,this._cache.removeStoreAsync(n)];case 1:return i.sent(),[4,this._cache.setStoreAsync(n,e)];case 2:return i.sent(),[4,this._cache.setStoreAsync(o,r.ANONYMOUS)];case 3:return i.sent(),[2]}}))}))},t.prototype._clearAnonymousUUID=function(){return m(this,void 0,void 0,(function(){return I(this,(function(e){switch(e.label){case 0:return[4,this._cache.removeStoreAsync(this._cache.keys.anonymousUuidKey)];case 1:return e.sent(),[2]}}))}))},t.prototype._onConverted=function(e){return m(this,void 0,void 0,(function(){return I(this,(function(t){switch(t.label){case 0:return e.data.env!==this._config.env?[2]:[4,this._cache.updatePersistenceAsync(this._config.persistence)];case 1:return t.sent(),[2]}}))}))},t}(c),k=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),P=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))},N=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},L=o.constants.ERRORS,R=o.utils.throwError,U=o.utils.isString,x=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return k(t,e),t.prototype.signIn=function(e){return P(this,void 0,void 0,(function(){var t,n,o,i,s,c,a;return N(this,(function(u){switch(u.label){case 0:return U(e)||R(L.INVALID_PARAMS,"ticket must be a string"),t=this._cache.keys.refreshTokenKey,i=(o=this._request).send,s=["auth.signInWithTicket"],c={ticket:e},[4,this._cache.getStoreAsync(t)];case 1:return[4,i.apply(o,s.concat([(c.refresh_token=u.sent()||"",c)]))];case 2:return(n=u.sent()).refresh_token?[4,this.setRefreshToken(n.refresh_token)]:[3,7];case 3:return u.sent(),[4,this._request.refreshAccessToken()];case 4:return u.sent(),re.fire(ce.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:r.CUSTOM,persistence:this._config.persistence}),re.fire(ce.LOGIN_STATE_CHANGED),[4,this.refreshUserInfo()];case 5:return u.sent(),[4,(a=new ie({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()];case 6:return u.sent(),[2,a];case 7:R(L.OPERATION_FAIL,"custom signIn failed"),u.label=8;case 8:return[2]}}))}))},t}(c),C=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),q=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))},M=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},j=o.utils.throwError,D=o.utils.isString,K=o.constants.ERRORS,H=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return C(t,e),t.prototype.signIn=function(e,t){return q(this,void 0,void 0,(function(){var n,o,i,s,c;return M(this,(function(a){switch(a.label){case 0:return D(e)||j(K.INVALID_PARAMS,"email must be a string"),n=this._cache.keys.refreshTokenKey,[4,this._request.send("auth.signIn",{loginType:"EMAIL",email:e,password:t,refresh_token:this._cache.getStore(n)||""})];case 1:return o=a.sent(),i=o.refresh_token,s=o.access_token,c=o.access_token_expire,i?[4,this.setRefreshToken(i)]:[3,8];case 2:return a.sent(),s&&c?[4,this.setAccessToken(s,c)]:[3,4];case 3:return a.sent(),[3,6];case 4:return[4,this._request.refreshAccessToken()];case 5:a.sent(),a.label=6;case 6:return[4,this.refreshUserInfo()];case 7:return a.sent(),re.fire(ce.LOGIN_STATE_CHANGED),re.fire(ce.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:r.EMAIL,persistence:this._config.persistence}),[2,new ie({envId:this._config.env,cache:this._cache,request:this._request})];case 8:o.code?j(K.OPERATION_FAIL,"Email login fail["+o.code+"] "+o.message):j(K.OPERATION_FAIL,"Email login fail"),a.label=9;case 9:return[2]}}))}))},t.prototype.signUp=function(e,t){return q(this,void 0,void 0,(function(){return M(this,(function(n){return[2,this._request.send("auth.signUpWithEmailAndPassword",{email:e,password:t})]}))}))},t.prototype.resetPassword=function(e){return q(this,void 0,void 0,(function(){return M(this,(function(t){return[2,this._request.send("auth.sendPasswordResetEmail",{email:e})]}))}))},t.prototype.resetPasswordWithToken=function(e,t){return q(this,void 0,void 0,(function(){return M(this,(function(n){return[2,this._request.send("auth.resetPasswordWithToken",{token:e,newPassword:t})]}))}))},t.prototype.activate=function(e){return q(this,void 0,void 0,(function(){return M(this,(function(t){return[2,this._request.send("auth.activateEndUserMail",{token:e})]}))}))},t}(c),W=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),G=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))},B=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},V=o.utils.throwError,F=o.utils.printWarn,Y=o.constants.ERRORS,z=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return W(t,e),t.prototype.signIn=function(e,t){return G(this,void 0,void 0,(function(){var n,o,i,s,c,a,u,h,f;return B(this,(function(l){switch(l.label){case 0:return"string"!=typeof e&&V(Y.INVALID_PARAMS,"username must be a string"),"string"!=typeof t&&(t="",F(Y.INVALID_PARAMS,"password is empty")),n=this._cache.keys.refreshTokenKey,s=(i=this._request).send,c=["auth.signIn"],a={loginType:r.USERNAME,username:e,password:t},[4,this._cache.getStoreAsync(n)];case 1:return[4,s.apply(i,c.concat([(a.refresh_token=l.sent()||"",a)]))];case 2:return o=l.sent(),u=o.refresh_token,h=o.access_token_expire,f=o.access_token,u?[4,this.setRefreshToken(u)]:[3,9];case 3:return l.sent(),f&&h?[4,this.setAccessToken(f,h)]:[3,5];case 4:return l.sent(),[3,7];case 5:return[4,this._request.refreshAccessToken()];case 6:l.sent(),l.label=7;case 7:return[4,this.refreshUserInfo()];case 8:return l.sent(),re.fire(ce.LOGIN_STATE_CHANGED),re.fire(ce.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:r.USERNAME,persistence:this._config.persistence}),[2,new ie({envId:this._config.env,cache:this._cache,request:this._request})];case 9:o.code?V(Y.OPERATION_FAIL,"login failed:["+o.code+"] "+o.message):V(Y.OPERATION_FAIL,"login failed"),l.label=10;case 10:return[2]}}))}))},t}(c),J=function(){return(J=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},X=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))},Q=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}},$=o.events.CloudbaseEventEmitter,Z=o.adapters.RUNTIME,ee=o.utils.printWarn,te=o.utils.throwError,ne=o.constants.ERRORS,re=new $,oe=function(){function e(e){var t=e.cache,n=e.request;this._cache=t,this._request=n,this._setUserInfo()}return e.prototype.checkLocalInfo=function(){return X(this,void 0,void 0,(function(){return Q(this,(function(e){return this.uid=this._getLocalUserInfo("uid"),this.loginType=this._getLocalUserInfo("loginType"),this.openid=this._getLocalUserInfo("wxOpenId"),this.wxOpenId=this._getLocalUserInfo("wxOpenId"),this.wxPublicId=this._getLocalUserInfo("wxPublicId"),this.unionId=this._getLocalUserInfo("wxUnionId"),this.qqMiniOpenId=this._getLocalUserInfo("qqMiniOpenId"),this.customUserId=this._getLocalUserInfo("customUserId"),this.nickName=this._getLocalUserInfo("nickName"),this.gender=this._getLocalUserInfo("gender"),this.avatarUrl=this._getLocalUserInfo("avatarUrl"),this.email=this._getLocalUserInfo("email"),this.hasPassword=Boolean(this._getLocalUserInfo("hasPassword")),this.location={country:this._getLocalUserInfo("country"),province:this._getLocalUserInfo("province"),city:this._getLocalUserInfo("city")},[2]}))}))},e.prototype.checkLocalInfoAsync=function(){return X(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,c,a,u,h,f,l,p,d,y;return Q(this,(function(_){switch(_.label){case 0:return e=this,[4,this._getLocalUserInfoAsync("uid")];case 1:return e.uid=_.sent(),t=this,[4,this._getLocalUserInfoAsync("loginType")];case 2:return t.loginType=_.sent(),n=this,[4,this._getLocalUserInfoAsync("wxOpenId")];case 3:return n.openid=_.sent(),r=this,[4,this._getLocalUserInfoAsync("wxOpenId")];case 4:return r.wxOpenId=_.sent(),o=this,[4,this._getLocalUserInfoAsync("wxPublicId")];case 5:return o.wxPublicId=_.sent(),i=this,[4,this._getLocalUserInfoAsync("wxUnionId")];case 6:return i.unionId=_.sent(),s=this,[4,this._getLocalUserInfoAsync("qqMiniOpenId")];case 7:return s.qqMiniOpenId=_.sent(),c=this,[4,this._getLocalUserInfoAsync("customUserId")];case 8:return c.customUserId=_.sent(),a=this,[4,this._getLocalUserInfoAsync("nickName")];case 9:return a.nickName=_.sent(),u=this,[4,this._getLocalUserInfoAsync("gender")];case 10:return u.gender=_.sent(),h=this,[4,this._getLocalUserInfoAsync("avatarUrl")];case 11:return h.avatarUrl=_.sent(),f=this,[4,this._getLocalUserInfoAsync("email")];case 12:return f.email=_.sent(),l=this,p=Boolean,[4,this._getLocalUserInfoAsync("hasPassword")];case 13:return l.hasPassword=p.apply(void 0,[_.sent()]),d=this,y={},[4,this._getLocalUserInfoAsync("country")];case 14:return y.country=_.sent(),[4,this._getLocalUserInfoAsync("province")];case 15:return y.province=_.sent(),[4,this._getLocalUserInfoAsync("city")];case 16:return d.location=(y.city=_.sent(),y),[2]}}))}))},e.prototype.linkWithTicket=function(e){if("string"!=typeof e)throw new Error("ticket must be string");return this._request.send("auth.linkWithTicket",{ticket:e})},e.prototype.linkWithRedirect=function(e){e.signInWithRedirect()},e.prototype.getLinkedUidList=function(){return X(this,void 0,void 0,(function(){var e,t,n,r,o,i;return Q(this,(function(s){switch(s.label){case 0:return[4,this._request.send("auth.getLinkedUidList",{})];case 1:for(e=s.sent().data,t=!1,n=e.users,r=0,o=n;r<o.length;r++)if((i=o[r]).wxOpenId&&i.wxPublicId){t=!0;break}return[2,{users:n,hasPrimaryUid:t}]}}))}))},e.prototype.setPrimaryUid=function(e){return this._request.send("auth.setPrimaryUid",{uid:e})},e.prototype.unlink=function(e){return this._request.send("auth.unlink",{platform:e})},e.prototype.update=function(e){return X(this,void 0,void 0,(function(){var t,n,r,o,i,s,c;return Q(this,(function(a){switch(a.label){case 0:return t=e.nickName,n=e.gender,r=e.avatarUrl,o=e.province,i=e.country,s=e.city,[4,this._request.send("auth.updateUserInfo",{nickName:t,gender:n,avatarUrl:r,province:o,country:i,city:s})];case 1:return c=a.sent().data,this._setLocalUserInfo(c),[2]}}))}))},e.prototype.updatePassword=function(e,t){return this._request.send("auth.updatePassword",{oldPassword:t,newPassword:e})},e.prototype.updateEmail=function(e){return this._request.send("auth.updateEmail",{newEmail:e})},e.prototype.updateUsername=function(e){return"string"!=typeof e&&te(ne.INVALID_PARAMS,"username must be a string"),this._request.send("auth.updateUsername",{username:e})},e.prototype.refresh=function(){return X(this,void 0,void 0,(function(){var e;return Q(this,(function(t){switch(t.label){case 0:return"auth.getUserInfo",[4,this._request.send("auth.getUserInfo",{})];case 1:return e=t.sent().data,this._setLocalUserInfo(e),[2,e]}}))}))},e.prototype._getLocalUserInfo=function(e){var t=this._cache.keys.userInfoKey;return this._cache.getStore(t)[e]},e.prototype._getLocalUserInfoAsync=function(e){return X(this,void 0,void 0,(function(){var t;return Q(this,(function(n){switch(n.label){case 0:return t=this._cache.keys.userInfoKey,[4,this._cache.getStoreAsync(t)];case 1:return[2,n.sent()[e]]}}))}))},e.prototype._setUserInfo=function(){var e=this,t=this._cache.keys.userInfoKey,n=this._cache.getStore(t);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl"].forEach((function(t){e[t]=n[t]})),this.location={country:n.country,province:n.province,city:n.city}},e.prototype._setLocalUserInfo=function(e){var t=this._cache.keys.userInfoKey;this._cache.setStore(t,e),this._setUserInfo()},e}(),ie=function(){function e(e){var t=e.envId,n=e.cache,r=e.request;t||te(ne.INVALID_PARAMS,"envId is not defined"),this._cache=n,this.user=new oe({cache:n,request:r})}return e.prototype.checkLocalState=function(){return X(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return Q(this,(function(c){return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=e.accessTokenExpireKey,o=this._cache.getStore(t),i=this._cache.getStore(n),s=this._cache.getStore(r),this.credential={refreshToken:o,accessToken:i,accessTokenExpire:s},this._loginType=this._cache.getStore(this._cache.keys.loginTypeKey),this.user.checkLocalInfo(),[2]}))}))},e.prototype.checkLocalStateAsync=function(){return X(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,c;return Q(this,(function(a){switch(a.label){case 0:return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=e.accessTokenExpireKey,[4,this._cache.getStoreAsync(t)];case 1:return o=a.sent(),[4,this._cache.getStoreAsync(n)];case 2:return i=a.sent(),[4,this._cache.getStoreAsync(r)];case 3:return s=a.sent(),this.credential={refreshToken:o,accessToken:i,accessTokenExpire:s},c=this,[4,this._cache.getStoreAsync(this._cache.keys.loginTypeKey)];case 4:return c._loginType=a.sent(),[4,this.user.checkLocalInfoAsync()];case 5:return a.sent(),[2]}}))}))},Object.defineProperty(e.prototype,"isAnonymousAuth",{get:function(){return this.loginType===r.ANONYMOUS},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCustomAuth",{get:function(){return this.loginType===r.CUSTOM},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isWeixinAuth",{get:function(){return this.loginType===r.WECHAT||this.loginType===r.WECHAT_OPEN||this.loginType===r.WECHAT_PUBLIC},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUsernameAuth",{get:function(){return this.loginType===r.USERNAME},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loginType",{get:function(){return this._loginType},enumerable:!1,configurable:!0}),e}(),se=function(){function e(e){this._config=e,this._cache=e.cache,this._request=e.request,this._runtime=e.runtime||Z.WEB,re.on(ce.LOGIN_TYPE_CHANGED,this._onLoginTypeChanged.bind(this))}return Object.defineProperty(e.prototype,"currentUser",{get:function(){if("async"!==this._cache.mode){var e=this.hasLoginState();return e&&e.user||null}ee(ne.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrenUser insteed")},enumerable:!1,configurable:!0}),e.prototype.getCurrenUser=function(){return X(this,void 0,void 0,(function(){var e;return Q(this,(function(t){switch(t.label){case 0:return[4,this.getLoginState()];case 1:return(e=t.sent())?[4,e.user.checkLocalInfoAsync()]:[3,3];case 2:return t.sent(),[2,e.user||null];case 3:return[2,null]}}))}))},Object.defineProperty(e.prototype,"loginType",{get:function(){return this._cache.getStore(this._cache.keys.loginTypeKey)},enumerable:!1,configurable:!0}),e.prototype.getLoginType=function(){return X(this,void 0,void 0,(function(){return Q(this,(function(e){switch(e.label){case 0:return[4,this._cache.getStoreAsync(this._cache.keys.loginTypeKey)];case 1:return[2,e.sent()]}}))}))},e.prototype.getAccessToken=function(){return X(this,void 0,void 0,(function(){var e;return Q(this,(function(t){switch(t.label){case 0:return e={},[4,this._request.getAccessToken()];case 1:return[2,(e.accessToken=t.sent().accessToken,e.env=this._config.env,e)]}}))}))},e.prototype.weixinAuthProvider=function(e){var t=e.appid,n=e.scope,r=e.state;return this._weixinAuthProvider||(this._weixinAuthProvider=new b(J(J({},this._config),{cache:this._cache,request:this._request,runtime:this._runtime}),t,n,r)),this._weixinAuthProvider},e.prototype.anonymousAuthProvider=function(){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new E(J(J({},this._config),{cache:this._cache,request:this._request}))),this._anonymousAuthProvider},e.prototype.customAuthProvider=function(){return this._customAuthProvider||(this._customAuthProvider=new x(J(J({},this._config),{cache:this._cache,request:this._request}))),this._customAuthProvider},e.prototype.emailAuthProvider=function(){return this._emailAuthProvider||(this._emailAuthProvider=new H(J(J({},this._config),{cache:this._cache,request:this._request}))),this._emailAuthProvider},e.prototype.usernameAuthProvider=function(){return this._usernameAuthProvider||(this._usernameAuthProvider=new z(J(J({},this._config),{cache:this._cache,request:this._request}))),this._usernameAuthProvider},e.prototype.signInWithUsernameAndPassword=function(e,t){return X(this,void 0,void 0,(function(){return Q(this,(function(n){return[2,this._usernameAuthProvider.signIn(e,t)]}))}))},e.prototype.isUsernameRegistered=function(e){return X(this,void 0,void 0,(function(){var t;return Q(this,(function(n){switch(n.label){case 0:return"string"!=typeof e&&te(ne.INVALID_PARAMS,"username must be a string"),[4,this._request.send("auth.isUsernameRegistered",{username:e})];case 1:return[2,null==(t=n.sent().data)?void 0:t.isRegistered]}}))}))},e.prototype.signInWithEmailAndPassword=function(e,t){return X(this,void 0,void 0,(function(){return Q(this,(function(n){return[2,this.emailAuthProvider().signIn(e,t)]}))}))},e.prototype.signUpWithEmailAndPassword=function(e,t){return X(this,void 0,void 0,(function(){return Q(this,(function(n){return[2,this.emailAuthProvider().signUp(e,t)]}))}))},e.prototype.sendPasswordResetEmail=function(e){return X(this,void 0,void 0,(function(){return Q(this,(function(t){return[2,this.emailAuthProvider().resetPassword(e)]}))}))},e.prototype.signOut=function(){return X(this,void 0,void 0,(function(){var e,t,n,o,i,s,c;return Q(this,(function(a){switch(a.label){case 0:return[4,this.getLoginType()];case 1:return a.sent()===r.ANONYMOUS&&te(ne.INVALID_OPERATION,"anonymous user doesn't support signOut action"),e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,o=e.accessTokenExpireKey,i="auth.logout",[4,this._cache.getStoreAsync(t)];case 2:return(s=a.sent())?[4,this._request.send(i,{refresh_token:s})]:[2];case 3:return c=a.sent(),this._cache.removeStoreAsync(t),this._cache.removeStoreAsync(n),this._cache.removeStoreAsync(o),re.fire(ce.LOGIN_STATE_CHANGED),re.fire(ce.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:r.NULL,persistence:this._config.persistence}),[2,c]}}))}))},e.prototype.onLoginStateChanged=function(e){return X(this,void 0,void 0,(function(){var t,n=this;return Q(this,(function(r){switch(r.label){case 0:return re.on(ce.LOGIN_STATE_CHANGED,(function(){return X(n,void 0,void 0,(function(){var t;return Q(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return t=n.sent(),e.call(this,t),[2]}}))}))})),[4,this.getLoginState()];case 1:return t=r.sent(),e.call(this,t),[2]}}))}))},e.prototype.onLoginStateExpired=function(e){re.on(ce.LOGIN_STATE_EXPIRED,e.bind(this))},e.prototype.onAccessTokenRefreshed=function(e){re.on(ce.ACCESS_TOKEN_REFRESHD,e.bind(this))},e.prototype.onAnonymousConverted=function(e){re.on(ce.ANONYMOUS_CONVERTED,e.bind(this))},e.prototype.onLoginTypeChanged=function(e){var t=this;re.on(ce.LOGIN_TYPE_CHANGED,(function(){return X(t,void 0,void 0,(function(){var t;return Q(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return t=n.sent(),e.call(this,t),[2]}}))}))}))},e.prototype.hasLoginState=function(){if("async"!==this._cache.mode){var e=this._cache.keys.refreshTokenKey;if(this._cache.getStore(e)){var t=new ie({envId:this._config.env,cache:this._cache,request:this._request});return t.checkLocalState(),t}return null}ee(ne.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},e.prototype.getLoginState=function(){return X(this,void 0,void 0,(function(){var e,t;return Q(this,(function(n){switch(n.label){case 0:return e=this._cache.keys.refreshTokenKey,[4,this._cache.getStoreAsync(e)];case 1:return n.sent()?[4,(t=new ie({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()]:[3,3];case 2:return n.sent(),[2,t];case 3:return[2,null]}}))}))},e.prototype.shouldRefreshAccessToken=function(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)},e.prototype.getUserInfo=function(){return X(this,void 0,void 0,(function(){var e;return Q(this,(function(t){switch(t.label){case 0:return"auth.getUserInfo",[4,this._request.send("auth.getUserInfo",{})];case 1:return(e=t.sent()).code?[2,e]:[2,J(J({},e.data),{requestId:e.seqId})]}}))}))},e.prototype.getAuthHeader=function(){if("async"!==this._cache.mode){var e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=this._cache.getStore(t);return{"x-cloudbase-credentials":this._cache.getStore(n)+"/@@/"+r}}ee(ne.INVALID_OPERATION,"current platform's storage is asynchronous, please use getAuthHeaderAsync insteed")},e.prototype.getAuthHeaderAsync=function(){return X(this,void 0,void 0,(function(){var e,t,n,r;return Q(this,(function(o){switch(o.label){case 0:return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,[4,this._cache.getStoreAsync(t)];case 1:return r=o.sent(),[4,this._cache.getStoreAsync(n)];case 2:return[2,{"x-cloudbase-credentials":o.sent()+"/@@/"+r}]}}))}))},e.prototype._onLoginTypeChanged=function(e){return X(this,void 0,void 0,(function(){var t,n,r;return Q(this,(function(o){switch(o.label){case 0:return t=e.data,n=t.loginType,r=t.persistence,t.env!==this._config.env?[2]:[4,this._cache.updatePersistenceAsync(r)];case 1:return o.sent(),[4,this._cache.setStoreAsync(this._cache.keys.loginTypeKey,n)];case 2:return o.sent(),[2]}}))}))},e}(),ce={LOGIN_STATE_CHANGED:"loginStateChanged",LOGIN_STATE_EXPIRED:"loginStateExpire",LOGIN_TYPE_CHANGED:"loginTypeChanged",ANONYMOUS_CONVERTED:"anonymousConverted",ACCESS_TOKEN_REFRESHD:"refreshAccessToken"},ae={name:"auth",namespace:"auth",injectEvents:{bus:re,events:[ce.LOGIN_TYPE_CHANGED,ce.LOGIN_STATE_EXPIRED,ce.LOGIN_STATE_CHANGED,ce.ACCESS_TOKEN_REFRESHD,ce.ANONYMOUS_CONVERTED]},entity:function(e){if(void 0===e&&(e={persistence:"session"}),this.authInstance)return ee(ne.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var t=this.platform,n=t.adapter,r=t.runtime,o=e.persistence||n.primaryStorage;o&&o!==this.config.persistence&&this.updateConfig({persistence:o});var i=this.config,s=i.env,c=i.persistence,a=i.debug;return this.authInstance=new se({env:s,persistence:c,debug:a,cache:this.cache,request:this.request,runtime:r}),this.authInstance}};try{cloudbase.registerComponent(ae)}catch(e){}function ue(e){e.registerComponent(ae)}function he(e,t){se.prototype[e]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o="_"+e;return this[o]||(this[o]=new t(J(J({},n),{cache:this._cache,request:this._request,runtime:this._runtime}))),this[o]}}}])}));