@ardennguyen/zalo-agent-cli 1.0.7 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1275) hide show
  1. package/DISCLAIMER.md +2 -2
  2. package/LICENSE +456 -21
  3. package/NOTICE +127 -0
  4. package/README.md +169 -70
  5. package/node_modules/asynckit/LICENSE +21 -0
  6. package/node_modules/asynckit/README.md +233 -0
  7. package/node_modules/asynckit/bench.js +76 -0
  8. package/node_modules/asynckit/index.js +6 -0
  9. package/node_modules/asynckit/lib/abort.js +29 -0
  10. package/node_modules/asynckit/lib/async.js +34 -0
  11. package/node_modules/asynckit/lib/defer.js +26 -0
  12. package/node_modules/asynckit/lib/iterate.js +75 -0
  13. package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  14. package/node_modules/asynckit/lib/readable_parallel.js +25 -0
  15. package/node_modules/asynckit/lib/readable_serial.js +25 -0
  16. package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  17. package/node_modules/asynckit/lib/state.js +37 -0
  18. package/node_modules/asynckit/lib/streamify.js +141 -0
  19. package/node_modules/asynckit/lib/terminator.js +29 -0
  20. package/node_modules/asynckit/package.json +63 -0
  21. package/node_modules/asynckit/parallel.js +43 -0
  22. package/node_modules/asynckit/serial.js +17 -0
  23. package/node_modules/asynckit/serialOrdered.js +75 -0
  24. package/node_modules/asynckit/stream.js +21 -0
  25. package/node_modules/bignumber.js/CHANGELOG.md +381 -0
  26. package/node_modules/bignumber.js/LICENCE.md +26 -0
  27. package/node_modules/bignumber.js/README.md +289 -0
  28. package/node_modules/bignumber.js/bignumber.d.mts +6 -0
  29. package/node_modules/bignumber.js/bignumber.d.ts +5 -0
  30. package/node_modules/bignumber.js/bignumber.js +2922 -0
  31. package/node_modules/bignumber.js/bignumber.mjs +2907 -0
  32. package/node_modules/bignumber.js/doc/API.html +2249 -0
  33. package/node_modules/bignumber.js/package.json +60 -0
  34. package/node_modules/bignumber.js/types.d.ts +1821 -0
  35. package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  36. package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  37. package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  38. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  39. package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
  40. package/node_modules/call-bind-apply-helpers/README.md +62 -0
  41. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  42. package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  43. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  44. package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  45. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  46. package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  47. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  48. package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  49. package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  50. package/node_modules/call-bind-apply-helpers/index.js +15 -0
  51. package/node_modules/call-bind-apply-helpers/package.json +85 -0
  52. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  53. package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  54. package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  55. package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  56. package/node_modules/combined-stream/License +19 -0
  57. package/node_modules/combined-stream/Readme.md +138 -0
  58. package/node_modules/combined-stream/lib/combined_stream.js +208 -0
  59. package/node_modules/combined-stream/package.json +25 -0
  60. package/node_modules/crypto-js/CONTRIBUTING.md +28 -0
  61. package/node_modules/crypto-js/LICENSE +24 -0
  62. package/node_modules/crypto-js/README.md +275 -0
  63. package/node_modules/crypto-js/aes.js +234 -0
  64. package/node_modules/crypto-js/blowfish.js +471 -0
  65. package/node_modules/crypto-js/bower.json +39 -0
  66. package/node_modules/crypto-js/cipher-core.js +895 -0
  67. package/node_modules/crypto-js/core.js +807 -0
  68. package/node_modules/crypto-js/crypto-js.js +6657 -0
  69. package/node_modules/crypto-js/docs/QuickStartGuide.wiki +470 -0
  70. package/node_modules/crypto-js/enc-base64.js +136 -0
  71. package/node_modules/crypto-js/enc-base64url.js +148 -0
  72. package/node_modules/crypto-js/enc-hex.js +18 -0
  73. package/node_modules/crypto-js/enc-latin1.js +18 -0
  74. package/node_modules/crypto-js/enc-utf16.js +149 -0
  75. package/node_modules/crypto-js/enc-utf8.js +18 -0
  76. package/node_modules/crypto-js/evpkdf.js +134 -0
  77. package/node_modules/crypto-js/format-hex.js +66 -0
  78. package/node_modules/crypto-js/format-openssl.js +18 -0
  79. package/node_modules/crypto-js/hmac-md5.js +18 -0
  80. package/node_modules/crypto-js/hmac-ripemd160.js +18 -0
  81. package/node_modules/crypto-js/hmac-sha1.js +18 -0
  82. package/node_modules/crypto-js/hmac-sha224.js +18 -0
  83. package/node_modules/crypto-js/hmac-sha256.js +18 -0
  84. package/node_modules/crypto-js/hmac-sha3.js +18 -0
  85. package/node_modules/crypto-js/hmac-sha384.js +18 -0
  86. package/node_modules/crypto-js/hmac-sha512.js +18 -0
  87. package/node_modules/crypto-js/hmac.js +143 -0
  88. package/node_modules/crypto-js/index.js +18 -0
  89. package/node_modules/crypto-js/lib-typedarrays.js +76 -0
  90. package/node_modules/crypto-js/md5.js +268 -0
  91. package/node_modules/crypto-js/mode-cfb.js +80 -0
  92. package/node_modules/crypto-js/mode-ctr-gladman.js +116 -0
  93. package/node_modules/crypto-js/mode-ctr.js +58 -0
  94. package/node_modules/crypto-js/mode-ecb.js +40 -0
  95. package/node_modules/crypto-js/mode-ofb.js +54 -0
  96. package/node_modules/crypto-js/package.json +42 -0
  97. package/node_modules/crypto-js/pad-ansix923.js +49 -0
  98. package/node_modules/crypto-js/pad-iso10126.js +44 -0
  99. package/node_modules/crypto-js/pad-iso97971.js +40 -0
  100. package/node_modules/crypto-js/pad-nopadding.js +30 -0
  101. package/node_modules/crypto-js/pad-pkcs7.js +18 -0
  102. package/node_modules/crypto-js/pad-zeropadding.js +47 -0
  103. package/node_modules/crypto-js/pbkdf2.js +145 -0
  104. package/node_modules/crypto-js/rabbit-legacy.js +190 -0
  105. package/node_modules/crypto-js/rabbit.js +192 -0
  106. package/node_modules/crypto-js/rc4.js +139 -0
  107. package/node_modules/crypto-js/ripemd160.js +267 -0
  108. package/node_modules/crypto-js/sha1.js +150 -0
  109. package/node_modules/crypto-js/sha224.js +80 -0
  110. package/node_modules/crypto-js/sha256.js +199 -0
  111. package/node_modules/crypto-js/sha3.js +326 -0
  112. package/node_modules/crypto-js/sha384.js +83 -0
  113. package/node_modules/crypto-js/sha512.js +326 -0
  114. package/node_modules/crypto-js/tripledes.js +779 -0
  115. package/node_modules/crypto-js/x64-core.js +304 -0
  116. package/node_modules/delayed-stream/.npmignore +1 -0
  117. package/node_modules/delayed-stream/License +19 -0
  118. package/node_modules/delayed-stream/Makefile +7 -0
  119. package/node_modules/delayed-stream/Readme.md +141 -0
  120. package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  121. package/node_modules/delayed-stream/package.json +27 -0
  122. package/node_modules/dunder-proto/.eslintrc +5 -0
  123. package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  124. package/node_modules/dunder-proto/.nycrc +13 -0
  125. package/node_modules/dunder-proto/CHANGELOG.md +24 -0
  126. package/node_modules/dunder-proto/LICENSE +21 -0
  127. package/node_modules/dunder-proto/README.md +54 -0
  128. package/node_modules/dunder-proto/get.d.ts +5 -0
  129. package/node_modules/dunder-proto/get.js +30 -0
  130. package/node_modules/dunder-proto/package.json +76 -0
  131. package/node_modules/dunder-proto/set.d.ts +5 -0
  132. package/node_modules/dunder-proto/set.js +35 -0
  133. package/node_modules/dunder-proto/test/get.js +34 -0
  134. package/node_modules/dunder-proto/test/index.js +4 -0
  135. package/node_modules/dunder-proto/test/set.js +50 -0
  136. package/node_modules/dunder-proto/tsconfig.json +9 -0
  137. package/node_modules/es-define-property/.eslintrc +13 -0
  138. package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  139. package/node_modules/es-define-property/.nycrc +9 -0
  140. package/node_modules/es-define-property/CHANGELOG.md +29 -0
  141. package/node_modules/es-define-property/LICENSE +21 -0
  142. package/node_modules/es-define-property/README.md +49 -0
  143. package/node_modules/es-define-property/index.d.ts +3 -0
  144. package/node_modules/es-define-property/index.js +14 -0
  145. package/node_modules/es-define-property/package.json +81 -0
  146. package/node_modules/es-define-property/test/index.js +56 -0
  147. package/node_modules/es-define-property/tsconfig.json +10 -0
  148. package/node_modules/es-errors/.eslintrc +5 -0
  149. package/node_modules/es-errors/.github/FUNDING.yml +12 -0
  150. package/node_modules/es-errors/CHANGELOG.md +40 -0
  151. package/node_modules/es-errors/LICENSE +21 -0
  152. package/node_modules/es-errors/README.md +55 -0
  153. package/node_modules/es-errors/eval.d.ts +3 -0
  154. package/node_modules/es-errors/eval.js +4 -0
  155. package/node_modules/es-errors/index.d.ts +3 -0
  156. package/node_modules/es-errors/index.js +4 -0
  157. package/node_modules/es-errors/package.json +80 -0
  158. package/node_modules/es-errors/range.d.ts +3 -0
  159. package/node_modules/es-errors/range.js +4 -0
  160. package/node_modules/es-errors/ref.d.ts +3 -0
  161. package/node_modules/es-errors/ref.js +4 -0
  162. package/node_modules/es-errors/syntax.d.ts +3 -0
  163. package/node_modules/es-errors/syntax.js +4 -0
  164. package/node_modules/es-errors/test/index.js +19 -0
  165. package/node_modules/es-errors/tsconfig.json +49 -0
  166. package/node_modules/es-errors/type.d.ts +3 -0
  167. package/node_modules/es-errors/type.js +4 -0
  168. package/node_modules/es-errors/uri.d.ts +3 -0
  169. package/node_modules/es-errors/uri.js +4 -0
  170. package/node_modules/es-object-atoms/.eslintrc +16 -0
  171. package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  172. package/node_modules/es-object-atoms/CHANGELOG.md +44 -0
  173. package/node_modules/es-object-atoms/LICENSE +21 -0
  174. package/node_modules/es-object-atoms/README.md +63 -0
  175. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  176. package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  177. package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  178. package/node_modules/es-object-atoms/ToObject.js +10 -0
  179. package/node_modules/es-object-atoms/index.d.ts +3 -0
  180. package/node_modules/es-object-atoms/index.js +4 -0
  181. package/node_modules/es-object-atoms/isObject.d.ts +3 -0
  182. package/node_modules/es-object-atoms/isObject.js +6 -0
  183. package/node_modules/es-object-atoms/package.json +79 -0
  184. package/node_modules/es-object-atoms/test/index.js +38 -0
  185. package/node_modules/es-object-atoms/tsconfig.json +7 -0
  186. package/node_modules/es-set-tostringtag/.eslintrc +13 -0
  187. package/node_modules/es-set-tostringtag/.nycrc +9 -0
  188. package/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
  189. package/node_modules/es-set-tostringtag/LICENSE +21 -0
  190. package/node_modules/es-set-tostringtag/README.md +53 -0
  191. package/node_modules/es-set-tostringtag/index.d.ts +10 -0
  192. package/node_modules/es-set-tostringtag/index.js +35 -0
  193. package/node_modules/es-set-tostringtag/package.json +78 -0
  194. package/node_modules/es-set-tostringtag/test/index.js +85 -0
  195. package/node_modules/es-set-tostringtag/tsconfig.json +9 -0
  196. package/node_modules/form-data/CHANGELOG.md +686 -0
  197. package/node_modules/form-data/License +19 -0
  198. package/node_modules/form-data/README.md +355 -0
  199. package/node_modules/form-data/index.d.ts +62 -0
  200. package/node_modules/form-data/lib/browser.js +4 -0
  201. package/node_modules/form-data/lib/form_data.js +506 -0
  202. package/node_modules/form-data/lib/populate.js +10 -0
  203. package/node_modules/form-data/node_modules/mime-db/HISTORY.md +507 -0
  204. package/node_modules/form-data/node_modules/mime-db/LICENSE +23 -0
  205. package/node_modules/form-data/node_modules/mime-db/README.md +100 -0
  206. package/node_modules/form-data/node_modules/mime-db/db.json +8519 -0
  207. package/node_modules/form-data/node_modules/mime-db/index.js +12 -0
  208. package/node_modules/form-data/node_modules/mime-db/package.json +60 -0
  209. package/node_modules/form-data/node_modules/mime-types/HISTORY.md +397 -0
  210. package/node_modules/form-data/node_modules/mime-types/LICENSE +23 -0
  211. package/node_modules/form-data/node_modules/mime-types/README.md +113 -0
  212. package/node_modules/form-data/node_modules/mime-types/index.js +188 -0
  213. package/node_modules/form-data/node_modules/mime-types/package.json +44 -0
  214. package/node_modules/form-data/package.json +82 -0
  215. package/node_modules/function-bind/.eslintrc +21 -0
  216. package/node_modules/function-bind/.github/FUNDING.yml +12 -0
  217. package/node_modules/function-bind/.github/SECURITY.md +3 -0
  218. package/node_modules/function-bind/.nycrc +13 -0
  219. package/node_modules/function-bind/CHANGELOG.md +136 -0
  220. package/node_modules/function-bind/LICENSE +20 -0
  221. package/node_modules/function-bind/README.md +46 -0
  222. package/node_modules/function-bind/implementation.js +84 -0
  223. package/node_modules/function-bind/index.js +5 -0
  224. package/node_modules/function-bind/package.json +87 -0
  225. package/node_modules/function-bind/test/.eslintrc +9 -0
  226. package/node_modules/function-bind/test/index.js +252 -0
  227. package/node_modules/get-intrinsic/.eslintrc +42 -0
  228. package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  229. package/node_modules/get-intrinsic/.nycrc +9 -0
  230. package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
  231. package/node_modules/get-intrinsic/LICENSE +21 -0
  232. package/node_modules/get-intrinsic/README.md +71 -0
  233. package/node_modules/get-intrinsic/index.js +378 -0
  234. package/node_modules/get-intrinsic/package.json +97 -0
  235. package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  236. package/node_modules/get-proto/.eslintrc +10 -0
  237. package/node_modules/get-proto/.github/FUNDING.yml +12 -0
  238. package/node_modules/get-proto/.nycrc +9 -0
  239. package/node_modules/get-proto/CHANGELOG.md +21 -0
  240. package/node_modules/get-proto/LICENSE +21 -0
  241. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  242. package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  243. package/node_modules/get-proto/README.md +50 -0
  244. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  245. package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  246. package/node_modules/get-proto/index.d.ts +5 -0
  247. package/node_modules/get-proto/index.js +27 -0
  248. package/node_modules/get-proto/package.json +81 -0
  249. package/node_modules/get-proto/test/index.js +68 -0
  250. package/node_modules/get-proto/tsconfig.json +9 -0
  251. package/node_modules/gopd/.eslintrc +16 -0
  252. package/node_modules/gopd/.github/FUNDING.yml +12 -0
  253. package/node_modules/gopd/CHANGELOG.md +45 -0
  254. package/node_modules/gopd/LICENSE +21 -0
  255. package/node_modules/gopd/README.md +40 -0
  256. package/node_modules/gopd/gOPD.d.ts +1 -0
  257. package/node_modules/gopd/gOPD.js +4 -0
  258. package/node_modules/gopd/index.d.ts +5 -0
  259. package/node_modules/gopd/index.js +15 -0
  260. package/node_modules/gopd/package.json +77 -0
  261. package/node_modules/gopd/test/index.js +36 -0
  262. package/node_modules/gopd/tsconfig.json +9 -0
  263. package/node_modules/has-symbols/.eslintrc +11 -0
  264. package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  265. package/node_modules/has-symbols/.nycrc +9 -0
  266. package/node_modules/has-symbols/CHANGELOG.md +91 -0
  267. package/node_modules/has-symbols/LICENSE +21 -0
  268. package/node_modules/has-symbols/README.md +46 -0
  269. package/node_modules/has-symbols/index.d.ts +3 -0
  270. package/node_modules/has-symbols/index.js +14 -0
  271. package/node_modules/has-symbols/package.json +111 -0
  272. package/node_modules/has-symbols/shams.d.ts +3 -0
  273. package/node_modules/has-symbols/shams.js +45 -0
  274. package/node_modules/has-symbols/test/index.js +22 -0
  275. package/node_modules/has-symbols/test/shams/core-js.js +29 -0
  276. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  277. package/node_modules/has-symbols/test/tests.js +58 -0
  278. package/node_modules/has-symbols/tsconfig.json +10 -0
  279. package/node_modules/has-tostringtag/.eslintrc +5 -0
  280. package/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
  281. package/node_modules/has-tostringtag/.nycrc +13 -0
  282. package/node_modules/has-tostringtag/CHANGELOG.md +42 -0
  283. package/node_modules/has-tostringtag/LICENSE +21 -0
  284. package/node_modules/has-tostringtag/README.md +46 -0
  285. package/node_modules/has-tostringtag/index.d.ts +3 -0
  286. package/node_modules/has-tostringtag/index.js +8 -0
  287. package/node_modules/has-tostringtag/package.json +108 -0
  288. package/node_modules/has-tostringtag/shams.d.ts +3 -0
  289. package/node_modules/has-tostringtag/shams.js +8 -0
  290. package/node_modules/has-tostringtag/test/index.js +21 -0
  291. package/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
  292. package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
  293. package/node_modules/has-tostringtag/test/tests.js +15 -0
  294. package/node_modules/has-tostringtag/tsconfig.json +49 -0
  295. package/node_modules/hasown/.github/FUNDING.yml +12 -0
  296. package/node_modules/hasown/.nycrc +13 -0
  297. package/node_modules/hasown/CHANGELOG.md +58 -0
  298. package/node_modules/hasown/LICENSE +21 -0
  299. package/node_modules/hasown/README.md +40 -0
  300. package/node_modules/hasown/eslint.config.mjs +6 -0
  301. package/node_modules/hasown/index.d.ts +3 -0
  302. package/node_modules/hasown/index.js +8 -0
  303. package/node_modules/hasown/package.json +91 -0
  304. package/node_modules/hasown/tsconfig.json +6 -0
  305. package/node_modules/json-bigint/LICENSE +20 -0
  306. package/node_modules/json-bigint/README.md +240 -0
  307. package/node_modules/json-bigint/index.js +12 -0
  308. package/node_modules/json-bigint/lib/parse.js +443 -0
  309. package/node_modules/json-bigint/lib/stringify.js +384 -0
  310. package/node_modules/json-bigint/package.json +34 -0
  311. package/node_modules/math-intrinsics/.eslintrc +16 -0
  312. package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  313. package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  314. package/node_modules/math-intrinsics/LICENSE +21 -0
  315. package/node_modules/math-intrinsics/README.md +50 -0
  316. package/node_modules/math-intrinsics/abs.d.ts +1 -0
  317. package/node_modules/math-intrinsics/abs.js +4 -0
  318. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  319. package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  320. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  321. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  322. package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  323. package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  324. package/node_modules/math-intrinsics/floor.d.ts +1 -0
  325. package/node_modules/math-intrinsics/floor.js +4 -0
  326. package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  327. package/node_modules/math-intrinsics/isFinite.js +12 -0
  328. package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  329. package/node_modules/math-intrinsics/isInteger.js +16 -0
  330. package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  331. package/node_modules/math-intrinsics/isNaN.js +6 -0
  332. package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  333. package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  334. package/node_modules/math-intrinsics/max.d.ts +1 -0
  335. package/node_modules/math-intrinsics/max.js +4 -0
  336. package/node_modules/math-intrinsics/min.d.ts +1 -0
  337. package/node_modules/math-intrinsics/min.js +4 -0
  338. package/node_modules/math-intrinsics/mod.d.ts +3 -0
  339. package/node_modules/math-intrinsics/mod.js +9 -0
  340. package/node_modules/math-intrinsics/package.json +86 -0
  341. package/node_modules/math-intrinsics/pow.d.ts +1 -0
  342. package/node_modules/math-intrinsics/pow.js +4 -0
  343. package/node_modules/math-intrinsics/round.d.ts +1 -0
  344. package/node_modules/math-intrinsics/round.js +4 -0
  345. package/node_modules/math-intrinsics/sign.d.ts +3 -0
  346. package/node_modules/math-intrinsics/sign.js +11 -0
  347. package/node_modules/math-intrinsics/test/index.js +192 -0
  348. package/node_modules/math-intrinsics/tsconfig.json +3 -0
  349. package/node_modules/pako/LICENSE +21 -0
  350. package/node_modules/pako/README.md +155 -0
  351. package/node_modules/pako/dist/pako.es5.js +6760 -0
  352. package/node_modules/pako/dist/pako.es5.min.js +2 -0
  353. package/node_modules/pako/dist/pako.esm.mjs +6945 -0
  354. package/node_modules/pako/dist/pako.js +6964 -0
  355. package/node_modules/pako/dist/pako.min.js +2 -0
  356. package/node_modules/pako/dist/pako_deflate.es5.js +3953 -0
  357. package/node_modules/pako/dist/pako_deflate.es5.min.js +2 -0
  358. package/node_modules/pako/dist/pako_deflate.js +4154 -0
  359. package/node_modules/pako/dist/pako_deflate.min.js +2 -0
  360. package/node_modules/pako/dist/pako_inflate.es5.js +3272 -0
  361. package/node_modules/pako/dist/pako_inflate.es5.min.js +2 -0
  362. package/node_modules/pako/dist/pako_inflate.js +3279 -0
  363. package/node_modules/pako/dist/pako_inflate.min.js +2 -0
  364. package/node_modules/pako/index.js +18 -0
  365. package/node_modules/pako/lib/deflate.js +387 -0
  366. package/node_modules/pako/lib/inflate.js +456 -0
  367. package/node_modules/pako/lib/utils/common.js +48 -0
  368. package/node_modules/pako/lib/utils/strings.js +174 -0
  369. package/node_modules/pako/lib/zlib/README +59 -0
  370. package/node_modules/pako/lib/zlib/adler32.js +51 -0
  371. package/node_modules/pako/lib/zlib/constants.js +68 -0
  372. package/node_modules/pako/lib/zlib/crc32.js +59 -0
  373. package/node_modules/pako/lib/zlib/deflate.js +2069 -0
  374. package/node_modules/pako/lib/zlib/gzheader.js +58 -0
  375. package/node_modules/pako/lib/zlib/inffast.js +344 -0
  376. package/node_modules/pako/lib/zlib/inflate.js +1575 -0
  377. package/node_modules/pako/lib/zlib/inftrees.js +340 -0
  378. package/node_modules/pako/lib/zlib/messages.js +32 -0
  379. package/node_modules/pako/lib/zlib/trees.js +1179 -0
  380. package/node_modules/pako/lib/zlib/zstream.js +47 -0
  381. package/node_modules/pako/package.json +73 -0
  382. package/node_modules/semver/LICENSE +15 -0
  383. package/node_modules/semver/README.md +680 -0
  384. package/node_modules/semver/bin/semver.js +195 -0
  385. package/node_modules/semver/classes/comparator.js +143 -0
  386. package/node_modules/semver/classes/index.js +7 -0
  387. package/node_modules/semver/classes/range.js +577 -0
  388. package/node_modules/semver/classes/semver.js +350 -0
  389. package/node_modules/semver/functions/clean.js +8 -0
  390. package/node_modules/semver/functions/cmp.js +54 -0
  391. package/node_modules/semver/functions/coerce.js +62 -0
  392. package/node_modules/semver/functions/compare-build.js +9 -0
  393. package/node_modules/semver/functions/compare-loose.js +5 -0
  394. package/node_modules/semver/functions/compare.js +7 -0
  395. package/node_modules/semver/functions/diff.js +60 -0
  396. package/node_modules/semver/functions/eq.js +5 -0
  397. package/node_modules/semver/functions/gt.js +5 -0
  398. package/node_modules/semver/functions/gte.js +5 -0
  399. package/node_modules/semver/functions/inc.js +21 -0
  400. package/node_modules/semver/functions/lt.js +5 -0
  401. package/node_modules/semver/functions/lte.js +5 -0
  402. package/node_modules/semver/functions/major.js +5 -0
  403. package/node_modules/semver/functions/minor.js +5 -0
  404. package/node_modules/semver/functions/neq.js +5 -0
  405. package/node_modules/semver/functions/parse.js +18 -0
  406. package/node_modules/semver/functions/patch.js +5 -0
  407. package/node_modules/semver/functions/prerelease.js +8 -0
  408. package/node_modules/semver/functions/rcompare.js +5 -0
  409. package/node_modules/semver/functions/rsort.js +5 -0
  410. package/node_modules/semver/functions/satisfies.js +12 -0
  411. package/node_modules/semver/functions/sort.js +5 -0
  412. package/node_modules/semver/functions/truncate.js +48 -0
  413. package/node_modules/semver/functions/valid.js +8 -0
  414. package/node_modules/semver/index.js +93 -0
  415. package/node_modules/semver/internal/constants.js +37 -0
  416. package/node_modules/semver/internal/debug.js +11 -0
  417. package/node_modules/semver/internal/identifiers.js +29 -0
  418. package/node_modules/semver/internal/lrucache.js +42 -0
  419. package/node_modules/semver/internal/parse-options.js +17 -0
  420. package/node_modules/semver/internal/re.js +223 -0
  421. package/node_modules/semver/package.json +78 -0
  422. package/node_modules/semver/preload.js +4 -0
  423. package/node_modules/semver/range.bnf +17 -0
  424. package/node_modules/semver/ranges/gtr.js +6 -0
  425. package/node_modules/semver/ranges/intersects.js +9 -0
  426. package/node_modules/semver/ranges/ltr.js +6 -0
  427. package/node_modules/semver/ranges/max-satisfying.js +27 -0
  428. package/node_modules/semver/ranges/min-satisfying.js +26 -0
  429. package/node_modules/semver/ranges/min-version.js +63 -0
  430. package/node_modules/semver/ranges/outside.js +82 -0
  431. package/node_modules/semver/ranges/simplify.js +49 -0
  432. package/node_modules/semver/ranges/subset.js +249 -0
  433. package/node_modules/semver/ranges/to-comparators.js +10 -0
  434. package/node_modules/semver/ranges/valid.js +13 -0
  435. package/node_modules/spark-md5/LICENSE +13 -0
  436. package/node_modules/spark-md5/README.md +191 -0
  437. package/node_modules/spark-md5/package.json +35 -0
  438. package/node_modules/spark-md5/spark-md5.js +751 -0
  439. package/node_modules/spark-md5/spark-md5.min.js +1 -0
  440. package/node_modules/tldts/LICENSE +13 -0
  441. package/node_modules/tldts/README.md +327 -0
  442. package/node_modules/tldts/bin/cli.js +21 -0
  443. package/node_modules/tldts/dist/cjs/index.js +666 -0
  444. package/node_modules/tldts/dist/cjs/index.js.map +1 -0
  445. package/node_modules/tldts/dist/cjs/src/data/trie.js +14 -0
  446. package/node_modules/tldts/dist/cjs/src/data/trie.js.map +1 -0
  447. package/node_modules/tldts/dist/cjs/src/suffix-trie.js +67 -0
  448. package/node_modules/tldts/dist/cjs/src/suffix-trie.js.map +1 -0
  449. package/node_modules/tldts/dist/cjs/tsconfig.tsbuildinfo +1 -0
  450. package/node_modules/tldts/dist/es6/index.js +33 -0
  451. package/node_modules/tldts/dist/es6/index.js.map +1 -0
  452. package/node_modules/tldts/dist/es6/src/data/trie.js +11 -0
  453. package/node_modules/tldts/dist/es6/src/data/trie.js.map +1 -0
  454. package/node_modules/tldts/dist/es6/src/suffix-trie.js +64 -0
  455. package/node_modules/tldts/dist/es6/src/suffix-trie.js.map +1 -0
  456. package/node_modules/tldts/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
  457. package/node_modules/tldts/dist/index.cjs.min.js +2 -0
  458. package/node_modules/tldts/dist/index.cjs.min.js.map +1 -0
  459. package/node_modules/tldts/dist/index.esm.min.js +2 -0
  460. package/node_modules/tldts/dist/index.esm.min.js.map +1 -0
  461. package/node_modules/tldts/dist/index.umd.min.js +2 -0
  462. package/node_modules/tldts/dist/index.umd.min.js.map +1 -0
  463. package/node_modules/tldts/dist/types/index.d.ts +7 -0
  464. package/node_modules/tldts/dist/types/src/data/trie.d.ts +5 -0
  465. package/node_modules/tldts/dist/types/src/suffix-trie.d.ts +5 -0
  466. package/node_modules/tldts/index.ts +62 -0
  467. package/node_modules/tldts/package.json +91 -0
  468. package/node_modules/tldts/src/data/trie.ts +14 -0
  469. package/node_modules/tldts/src/suffix-trie.ts +110 -0
  470. package/node_modules/tldts-core/LICENSE +13 -0
  471. package/node_modules/tldts-core/README.md +3 -0
  472. package/node_modules/tldts-core/dist/cjs/index.js +561 -0
  473. package/node_modules/tldts-core/dist/cjs/index.js.map +1 -0
  474. package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js +15 -0
  475. package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js.map +1 -0
  476. package/node_modules/tldts-core/dist/cjs/src/domain.js +83 -0
  477. package/node_modules/tldts-core/dist/cjs/src/domain.js.map +1 -0
  478. package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js +149 -0
  479. package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map +1 -0
  480. package/node_modules/tldts-core/dist/cjs/src/factory.js +104 -0
  481. package/node_modules/tldts-core/dist/cjs/src/factory.js.map +1 -0
  482. package/node_modules/tldts-core/dist/cjs/src/is-ip.js +72 -0
  483. package/node_modules/tldts-core/dist/cjs/src/is-ip.js.map +1 -0
  484. package/node_modules/tldts-core/dist/cjs/src/is-valid.js +69 -0
  485. package/node_modules/tldts-core/dist/cjs/src/is-valid.js.map +1 -0
  486. package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js +69 -0
  487. package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map +1 -0
  488. package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js +3 -0
  489. package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js.map +1 -0
  490. package/node_modules/tldts-core/dist/cjs/src/options.js +22 -0
  491. package/node_modules/tldts-core/dist/cjs/src/options.js.map +1 -0
  492. package/node_modules/tldts-core/dist/cjs/src/subdomain.js +14 -0
  493. package/node_modules/tldts-core/dist/cjs/src/subdomain.js.map +1 -0
  494. package/node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo +1 -0
  495. package/node_modules/tldts-core/dist/es6/index.js +4 -0
  496. package/node_modules/tldts-core/dist/es6/index.js.map +1 -0
  497. package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js +12 -0
  498. package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js.map +1 -0
  499. package/node_modules/tldts-core/dist/es6/src/domain.js +80 -0
  500. package/node_modules/tldts-core/dist/es6/src/domain.js.map +1 -0
  501. package/node_modules/tldts-core/dist/es6/src/extract-hostname.js +146 -0
  502. package/node_modules/tldts-core/dist/es6/src/extract-hostname.js.map +1 -0
  503. package/node_modules/tldts-core/dist/es6/src/factory.js +99 -0
  504. package/node_modules/tldts-core/dist/es6/src/factory.js.map +1 -0
  505. package/node_modules/tldts-core/dist/es6/src/is-ip.js +69 -0
  506. package/node_modules/tldts-core/dist/es6/src/is-ip.js.map +1 -0
  507. package/node_modules/tldts-core/dist/es6/src/is-valid.js +66 -0
  508. package/node_modules/tldts-core/dist/es6/src/is-valid.js.map +1 -0
  509. package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js +66 -0
  510. package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map +1 -0
  511. package/node_modules/tldts-core/dist/es6/src/lookup/interface.js +2 -0
  512. package/node_modules/tldts-core/dist/es6/src/lookup/interface.js.map +1 -0
  513. package/node_modules/tldts-core/dist/es6/src/options.js +19 -0
  514. package/node_modules/tldts-core/dist/es6/src/options.js.map +1 -0
  515. package/node_modules/tldts-core/dist/es6/src/subdomain.js +11 -0
  516. package/node_modules/tldts-core/dist/es6/src/subdomain.js.map +1 -0
  517. package/node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
  518. package/node_modules/tldts-core/dist/types/index.d.ts +4 -0
  519. package/node_modules/tldts-core/dist/types/src/domain-without-suffix.d.ts +6 -0
  520. package/node_modules/tldts-core/dist/types/src/domain.d.ts +5 -0
  521. package/node_modules/tldts-core/dist/types/src/extract-hostname.d.ts +5 -0
  522. package/node_modules/tldts-core/dist/types/src/factory.d.ts +28 -0
  523. package/node_modules/tldts-core/dist/types/src/is-ip.d.ts +6 -0
  524. package/node_modules/tldts-core/dist/types/src/is-valid.d.ts +15 -0
  525. package/node_modules/tldts-core/dist/types/src/lookup/fast-path.d.ts +2 -0
  526. package/node_modules/tldts-core/dist/types/src/lookup/interface.d.ts +9 -0
  527. package/node_modules/tldts-core/dist/types/src/options.d.ts +10 -0
  528. package/node_modules/tldts-core/dist/types/src/subdomain.d.ts +4 -0
  529. package/node_modules/tldts-core/index.ts +10 -0
  530. package/node_modules/tldts-core/package.json +68 -0
  531. package/node_modules/tldts-core/src/domain-without-suffix.ts +14 -0
  532. package/node_modules/tldts-core/src/domain.ts +100 -0
  533. package/node_modules/tldts-core/src/extract-hostname.ts +170 -0
  534. package/node_modules/tldts-core/src/factory.ts +160 -0
  535. package/node_modules/tldts-core/src/is-ip.ts +87 -0
  536. package/node_modules/tldts-core/src/is-valid.ts +79 -0
  537. package/node_modules/tldts-core/src/lookup/fast-path.ts +80 -0
  538. package/node_modules/tldts-core/src/lookup/interface.ts +10 -0
  539. package/node_modules/tldts-core/src/options.ts +39 -0
  540. package/node_modules/tldts-core/src/subdomain.ts +11 -0
  541. package/node_modules/tough-cookie/LICENSE +12 -0
  542. package/node_modules/tough-cookie/README.md +154 -0
  543. package/node_modules/tough-cookie/dist/cookie/canonicalDomain.d.ts +33 -0
  544. package/node_modules/tough-cookie/dist/cookie/canonicalDomain.js +65 -0
  545. package/node_modules/tough-cookie/dist/cookie/constants.d.ts +54 -0
  546. package/node_modules/tough-cookie/dist/cookie/constants.js +38 -0
  547. package/node_modules/tough-cookie/dist/cookie/cookie.d.ts +326 -0
  548. package/node_modules/tough-cookie/dist/cookie/cookie.js +831 -0
  549. package/node_modules/tough-cookie/dist/cookie/cookieCompare.d.ts +58 -0
  550. package/node_modules/tough-cookie/dist/cookie/cookieCompare.js +84 -0
  551. package/node_modules/tough-cookie/dist/cookie/cookieJar.d.ts +621 -0
  552. package/node_modules/tough-cookie/dist/cookie/cookieJar.js +1000 -0
  553. package/node_modules/tough-cookie/dist/cookie/defaultPath.d.ts +40 -0
  554. package/node_modules/tough-cookie/dist/cookie/defaultPath.js +60 -0
  555. package/node_modules/tough-cookie/dist/cookie/domainMatch.d.ts +38 -0
  556. package/node_modules/tough-cookie/dist/cookie/domainMatch.js +94 -0
  557. package/node_modules/tough-cookie/dist/cookie/formatDate.d.ts +15 -0
  558. package/node_modules/tough-cookie/dist/cookie/formatDate.js +20 -0
  559. package/node_modules/tough-cookie/dist/cookie/index.d.ts +29 -0
  560. package/node_modules/tough-cookie/dist/cookie/index.js +54 -0
  561. package/node_modules/tough-cookie/dist/cookie/parseDate.d.ts +103 -0
  562. package/node_modules/tough-cookie/dist/cookie/parseDate.js +323 -0
  563. package/node_modules/tough-cookie/dist/cookie/permutePath.d.ts +14 -0
  564. package/node_modules/tough-cookie/dist/cookie/permutePath.js +32 -0
  565. package/node_modules/tough-cookie/dist/getPublicSuffix.d.ts +55 -0
  566. package/node_modules/tough-cookie/dist/getPublicSuffix.js +71 -0
  567. package/node_modules/tough-cookie/dist/memstore.d.ts +220 -0
  568. package/node_modules/tough-cookie/dist/memstore.js +187 -0
  569. package/node_modules/tough-cookie/dist/pathMatch.d.ts +17 -0
  570. package/node_modules/tough-cookie/dist/pathMatch.js +40 -0
  571. package/node_modules/tough-cookie/dist/permuteDomain.d.ts +15 -0
  572. package/node_modules/tough-cookie/dist/permuteDomain.js +44 -0
  573. package/node_modules/tough-cookie/dist/store.d.ts +211 -0
  574. package/node_modules/tough-cookie/dist/store.js +76 -0
  575. package/node_modules/tough-cookie/dist/utils.d.ts +34 -0
  576. package/node_modules/tough-cookie/dist/utils.js +99 -0
  577. package/node_modules/tough-cookie/dist/validators.d.ts +24 -0
  578. package/node_modules/tough-cookie/dist/validators.js +90 -0
  579. package/node_modules/tough-cookie/dist/version.d.ts +5 -0
  580. package/node_modules/tough-cookie/dist/version.js +8 -0
  581. package/node_modules/tough-cookie/package.json +144 -0
  582. package/node_modules/ws/LICENSE +20 -0
  583. package/node_modules/ws/README.md +548 -0
  584. package/node_modules/ws/browser.js +8 -0
  585. package/node_modules/ws/index.js +22 -0
  586. package/node_modules/ws/lib/buffer-util.js +131 -0
  587. package/node_modules/ws/lib/constants.js +19 -0
  588. package/node_modules/ws/lib/event-target.js +292 -0
  589. package/node_modules/ws/lib/extension.js +203 -0
  590. package/node_modules/ws/lib/limiter.js +55 -0
  591. package/node_modules/ws/lib/permessage-deflate.js +530 -0
  592. package/node_modules/ws/lib/receiver.js +743 -0
  593. package/node_modules/ws/lib/sender.js +607 -0
  594. package/node_modules/ws/lib/stream.js +161 -0
  595. package/node_modules/ws/lib/subprotocol.js +62 -0
  596. package/node_modules/ws/lib/validation.js +152 -0
  597. package/node_modules/ws/lib/websocket-server.js +562 -0
  598. package/node_modules/ws/lib/websocket.js +1407 -0
  599. package/node_modules/ws/package.json +74 -0
  600. package/node_modules/ws/wrapper.mjs +21 -0
  601. package/node_modules/zca-js/.prettierrc +5 -0
  602. package/node_modules/zca-js/CODE_OF_CONDUCT.md +163 -0
  603. package/node_modules/zca-js/CONTRIBUTING.md +470 -0
  604. package/node_modules/zca-js/LICENSE +21 -0
  605. package/node_modules/zca-js/README.md +225 -0
  606. package/node_modules/zca-js/SECURITY.md +83 -0
  607. package/node_modules/zca-js/dist/Errors/ZaloApiError.d.ts +4 -0
  608. package/node_modules/zca-js/dist/Errors/ZaloApiError.js +7 -0
  609. package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.d.ts +4 -0
  610. package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRAborted.js +7 -0
  611. package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.d.ts +4 -0
  612. package/node_modules/zca-js/dist/Errors/ZaloApiLoginQRDeclined.js +7 -0
  613. package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.d.ts +4 -0
  614. package/node_modules/zca-js/dist/Errors/ZaloApiMissingImageMetadataGetter.js +7 -0
  615. package/node_modules/zca-js/dist/Errors/index.d.ts +4 -0
  616. package/node_modules/zca-js/dist/Errors/index.js +4 -0
  617. package/node_modules/zca-js/dist/apis/acceptFriendRequest.d.ts +2 -0
  618. package/node_modules/zca-js/dist/apis/acceptFriendRequest.js +28 -0
  619. package/node_modules/zca-js/dist/apis/addGroupBlockedMember.d.ts +2 -0
  620. package/node_modules/zca-js/dist/apis/addGroupBlockedMember.js +28 -0
  621. package/node_modules/zca-js/dist/apis/addGroupDeputy.d.ts +2 -0
  622. package/node_modules/zca-js/dist/apis/addGroupDeputy.js +30 -0
  623. package/node_modules/zca-js/dist/apis/addPollOptions.d.ts +14 -0
  624. package/node_modules/zca-js/dist/apis/addPollOptions.js +26 -0
  625. package/node_modules/zca-js/dist/apis/addQuickMessage.d.ts +11 -0
  626. package/node_modules/zca-js/dist/apis/addQuickMessage.js +60 -0
  627. package/node_modules/zca-js/dist/apis/addReaction.d.ts +18 -0
  628. package/node_modules/zca-js/dist/apis/addReaction.js +294 -0
  629. package/node_modules/zca-js/dist/apis/addUnreadMark.d.ts +8 -0
  630. package/node_modules/zca-js/dist/apis/addUnreadMark.js +52 -0
  631. package/node_modules/zca-js/dist/apis/addUserToGroup.d.ts +5 -0
  632. package/node_modules/zca-js/dist/apis/addUserToGroup.js +34 -0
  633. package/node_modules/zca-js/dist/apis/blockUser.d.ts +2 -0
  634. package/node_modules/zca-js/dist/apis/blockUser.js +28 -0
  635. package/node_modules/zca-js/dist/apis/blockViewFeed.d.ts +2 -0
  636. package/node_modules/zca-js/dist/apis/blockViewFeed.js +30 -0
  637. package/node_modules/zca-js/dist/apis/changeAccountAvatar.d.ts +3 -0
  638. package/node_modules/zca-js/dist/apis/changeAccountAvatar.js +52 -0
  639. package/node_modules/zca-js/dist/apis/changeFriendAlias.d.ts +2 -0
  640. package/node_modules/zca-js/dist/apis/changeFriendAlias.js +27 -0
  641. package/node_modules/zca-js/dist/apis/changeGroupAvatar.d.ts +3 -0
  642. package/node_modules/zca-js/dist/apis/changeGroupAvatar.js +44 -0
  643. package/node_modules/zca-js/dist/apis/changeGroupName.d.ts +4 -0
  644. package/node_modules/zca-js/dist/apis/changeGroupName.js +32 -0
  645. package/node_modules/zca-js/dist/apis/changeGroupOwner.d.ts +4 -0
  646. package/node_modules/zca-js/dist/apis/changeGroupOwner.js +30 -0
  647. package/node_modules/zca-js/dist/apis/createAutoReply.d.ts +14 -0
  648. package/node_modules/zca-js/dist/apis/createAutoReply.js +37 -0
  649. package/node_modules/zca-js/dist/apis/createBankAccount.d.ts +8 -0
  650. package/node_modules/zca-js/dist/apis/createBankAccount.js +32 -0
  651. package/node_modules/zca-js/dist/apis/createCatalog.d.ts +7 -0
  652. package/node_modules/zca-js/dist/apis/createCatalog.js +29 -0
  653. package/node_modules/zca-js/dist/apis/createGroup.d.ts +28 -0
  654. package/node_modules/zca-js/dist/apis/createGroup.js +43 -0
  655. package/node_modules/zca-js/dist/apis/createNote.d.ts +7 -0
  656. package/node_modules/zca-js/dist/apis/createNote.js +47 -0
  657. package/node_modules/zca-js/dist/apis/createPoll.d.ts +36 -0
  658. package/node_modules/zca-js/dist/apis/createPoll.js +40 -0
  659. package/node_modules/zca-js/dist/apis/createProductCatalog.d.ts +23 -0
  660. package/node_modules/zca-js/dist/apis/createProductCatalog.js +50 -0
  661. package/node_modules/zca-js/dist/apis/createReminder.d.ts +12 -0
  662. package/node_modules/zca-js/dist/apis/createReminder.js +63 -0
  663. package/node_modules/zca-js/dist/apis/custom.d.ts +9 -0
  664. package/node_modules/zca-js/dist/apis/custom.js +15 -0
  665. package/node_modules/zca-js/dist/apis/deleteAutoReply.d.ts +5 -0
  666. package/node_modules/zca-js/dist/apis/deleteAutoReply.js +29 -0
  667. package/node_modules/zca-js/dist/apis/deleteAvatar.d.ts +9 -0
  668. package/node_modules/zca-js/dist/apis/deleteAvatar.js +27 -0
  669. package/node_modules/zca-js/dist/apis/deleteBankAccount.d.ts +11 -0
  670. package/node_modules/zca-js/dist/apis/deleteBankAccount.js +32 -0
  671. package/node_modules/zca-js/dist/apis/deleteCatalog.d.ts +2 -0
  672. package/node_modules/zca-js/dist/apis/deleteCatalog.js +28 -0
  673. package/node_modules/zca-js/dist/apis/deleteChat.d.ts +19 -0
  674. package/node_modules/zca-js/dist/apis/deleteChat.js +50 -0
  675. package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.d.ts +9 -0
  676. package/node_modules/zca-js/dist/apis/deleteGroupInviteBox.js +27 -0
  677. package/node_modules/zca-js/dist/apis/deleteMessage.d.ts +14 -0
  678. package/node_modules/zca-js/dist/apis/deleteMessage.js +52 -0
  679. package/node_modules/zca-js/dist/apis/deleteProductCatalog.d.ts +10 -0
  680. package/node_modules/zca-js/dist/apis/deleteProductCatalog.js +31 -0
  681. package/node_modules/zca-js/dist/apis/deleteSnapshotMobileMsg.js +18 -0
  682. package/node_modules/zca-js/dist/apis/disableGroupLink.d.ts +2 -0
  683. package/node_modules/zca-js/dist/apis/disableGroupLink.js +24 -0
  684. package/node_modules/zca-js/dist/apis/disperseGroup.d.ts +2 -0
  685. package/node_modules/zca-js/dist/apis/disperseGroup.js +28 -0
  686. package/node_modules/zca-js/dist/apis/editNote.d.ts +17 -0
  687. package/node_modules/zca-js/dist/apis/editNote.js +46 -0
  688. package/node_modules/zca-js/dist/apis/editReminder.d.ts +13 -0
  689. package/node_modules/zca-js/dist/apis/editReminder.js +61 -0
  690. package/node_modules/zca-js/dist/apis/enableGroupLink.d.ts +6 -0
  691. package/node_modules/zca-js/dist/apis/enableGroupLink.js +25 -0
  692. package/node_modules/zca-js/dist/apis/fetchAccountInfo.d.ts +5 -0
  693. package/node_modules/zca-js/dist/apis/fetchAccountInfo.js +10 -0
  694. package/node_modules/zca-js/dist/apis/findUser.d.ts +3 -0
  695. package/node_modules/zca-js/dist/apis/findUser.js +42 -0
  696. package/node_modules/zca-js/dist/apis/findUserByUsername.d.ts +3 -0
  697. package/node_modules/zca-js/dist/apis/findUserByUsername.js +27 -0
  698. package/node_modules/zca-js/dist/apis/forwardMessage.d.ts +24 -0
  699. package/node_modules/zca-js/dist/apis/forwardMessage.js +114 -0
  700. package/node_modules/zca-js/dist/apis/getAliasList.d.ts +8 -0
  701. package/node_modules/zca-js/dist/apis/getAliasList.js +27 -0
  702. package/node_modules/zca-js/dist/apis/getAllFriends.d.ts +3 -0
  703. package/node_modules/zca-js/dist/apis/getAllFriends.js +34 -0
  704. package/node_modules/zca-js/dist/apis/getAllGroups.d.ts +7 -0
  705. package/node_modules/zca-js/dist/apis/getAllGroups.js +10 -0
  706. package/node_modules/zca-js/dist/apis/getArchivedChatList.d.ts +5 -0
  707. package/node_modules/zca-js/dist/apis/getArchivedChatList.js +23 -0
  708. package/node_modules/zca-js/dist/apis/getAutoDeleteChat.d.ts +9 -0
  709. package/node_modules/zca-js/dist/apis/getAutoDeleteChat.js +21 -0
  710. package/node_modules/zca-js/dist/apis/getAutoReplyList.d.ts +6 -0
  711. package/node_modules/zca-js/dist/apis/getAutoReplyList.js +24 -0
  712. package/node_modules/zca-js/dist/apis/getAvatarList.d.ts +12 -0
  713. package/node_modules/zca-js/dist/apis/getAvatarList.js +28 -0
  714. package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.d.ts +7 -0
  715. package/node_modules/zca-js/dist/apis/getAvatarUrlProfile.js +30 -0
  716. package/node_modules/zca-js/dist/apis/getBizAccount.d.ts +24 -0
  717. package/node_modules/zca-js/dist/apis/getBizAccount.js +27 -0
  718. package/node_modules/zca-js/dist/apis/getCatalogList.d.ts +18 -0
  719. package/node_modules/zca-js/dist/apis/getCatalogList.js +32 -0
  720. package/node_modules/zca-js/dist/apis/getCloseFriends.d.ts +3 -0
  721. package/node_modules/zca-js/dist/apis/getCloseFriends.js +20 -0
  722. package/node_modules/zca-js/dist/apis/getContext.d.ts +1 -0
  723. package/node_modules/zca-js/dist/apis/getContext.js +4 -0
  724. package/node_modules/zca-js/dist/apis/getCookie.d.ts +1 -0
  725. package/node_modules/zca-js/dist/apis/getCookie.js +9 -0
  726. package/node_modules/zca-js/dist/apis/getCrossDB.js +18 -0
  727. package/node_modules/zca-js/dist/apis/getFriendBoardList.d.ts +5 -0
  728. package/node_modules/zca-js/dist/apis/getFriendBoardList.js +26 -0
  729. package/node_modules/zca-js/dist/apis/getFriendOnlines.d.ts +10 -0
  730. package/node_modules/zca-js/dist/apis/getFriendOnlines.js +35 -0
  731. package/node_modules/zca-js/dist/apis/getFriendRecommendations.d.ts +42 -0
  732. package/node_modules/zca-js/dist/apis/getFriendRecommendations.js +27 -0
  733. package/node_modules/zca-js/dist/apis/getFriendRequestStatus.d.ts +8 -0
  734. package/node_modules/zca-js/dist/apis/getFriendRequestStatus.js +25 -0
  735. package/node_modules/zca-js/dist/apis/getFullAvatar.d.ts +5 -0
  736. package/node_modules/zca-js/dist/apis/getFullAvatar.js +25 -0
  737. package/node_modules/zca-js/dist/apis/getGroupBlockedMember.d.ts +23 -0
  738. package/node_modules/zca-js/dist/apis/getGroupBlockedMember.js +29 -0
  739. package/node_modules/zca-js/dist/apis/getGroupChatHistory.d.ts +8 -0
  740. package/node_modules/zca-js/dist/apis/getGroupChatHistory.js +36 -0
  741. package/node_modules/zca-js/dist/apis/getGroupInfo.d.ts +16 -0
  742. package/node_modules/zca-js/dist/apis/getGroupInfo.js +32 -0
  743. package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.d.ts +32 -0
  744. package/node_modules/zca-js/dist/apis/getGroupInviteBoxInfo.js +38 -0
  745. package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.d.ts +38 -0
  746. package/node_modules/zca-js/dist/apis/getGroupInviteBoxList.js +31 -0
  747. package/node_modules/zca-js/dist/apis/getGroupLinkDetail.d.ts +9 -0
  748. package/node_modules/zca-js/dist/apis/getGroupLinkDetail.js +25 -0
  749. package/node_modules/zca-js/dist/apis/getGroupLinkInfo.d.ts +34 -0
  750. package/node_modules/zca-js/dist/apis/getGroupLinkInfo.js +28 -0
  751. package/node_modules/zca-js/dist/apis/getGroupMembersInfo.d.ts +17 -0
  752. package/node_modules/zca-js/dist/apis/getGroupMembersInfo.js +24 -0
  753. package/node_modules/zca-js/dist/apis/getHiddenConversations.d.ts +11 -0
  754. package/node_modules/zca-js/dist/apis/getHiddenConversations.js +23 -0
  755. package/node_modules/zca-js/dist/apis/getLabels.d.ts +7 -0
  756. package/node_modules/zca-js/dist/apis/getLabels.js +28 -0
  757. package/node_modules/zca-js/dist/apis/getListBank.d.ts +5 -0
  758. package/node_modules/zca-js/dist/apis/getListBank.js +20 -0
  759. package/node_modules/zca-js/dist/apis/getListBankAccount.d.ts +7 -0
  760. package/node_modules/zca-js/dist/apis/getListBankAccount.js +27 -0
  761. package/node_modules/zca-js/dist/apis/getListBoard.d.ts +21 -0
  762. package/node_modules/zca-js/dist/apis/getListBoard.js +45 -0
  763. package/node_modules/zca-js/dist/apis/getListDevice.d.ts +10 -0
  764. package/node_modules/zca-js/dist/apis/getListDevice.js +22 -0
  765. package/node_modules/zca-js/dist/apis/getListReminder.d.ts +28 -0
  766. package/node_modules/zca-js/dist/apis/getListReminder.js +47 -0
  767. package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.d.ts +5 -0
  768. package/node_modules/zca-js/dist/apis/getMultiUsersByPhones.js +39 -0
  769. package/node_modules/zca-js/dist/apis/getMute.d.ts +13 -0
  770. package/node_modules/zca-js/dist/apis/getMute.js +22 -0
  771. package/node_modules/zca-js/dist/apis/getOwnId.d.ts +1 -0
  772. package/node_modules/zca-js/dist/apis/getOwnId.js +4 -0
  773. package/node_modules/zca-js/dist/apis/getPendingGroupMembers.d.ts +11 -0
  774. package/node_modules/zca-js/dist/apis/getPendingGroupMembers.js +27 -0
  775. package/node_modules/zca-js/dist/apis/getPinConversations.d.ts +5 -0
  776. package/node_modules/zca-js/dist/apis/getPinConversations.js +22 -0
  777. package/node_modules/zca-js/dist/apis/getPollDetail.d.ts +3 -0
  778. package/node_modules/zca-js/dist/apis/getPollDetail.js +30 -0
  779. package/node_modules/zca-js/dist/apis/getProductCatalogList.d.ts +20 -0
  780. package/node_modules/zca-js/dist/apis/getProductCatalogList.js +33 -0
  781. package/node_modules/zca-js/dist/apis/getQR.d.ts +4 -0
  782. package/node_modules/zca-js/dist/apis/getQR.js +29 -0
  783. package/node_modules/zca-js/dist/apis/getQuickMessageList.d.ts +7 -0
  784. package/node_modules/zca-js/dist/apis/getQuickMessageList.js +24 -0
  785. package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.d.ts +6 -0
  786. package/node_modules/zca-js/dist/apis/getRelatedFriendGroup.js +30 -0
  787. package/node_modules/zca-js/dist/apis/getReminder.d.ts +3 -0
  788. package/node_modules/zca-js/dist/apis/getReminder.js +25 -0
  789. package/node_modules/zca-js/dist/apis/getReminderResponses.d.ts +5 -0
  790. package/node_modules/zca-js/dist/apis/getReminderResponses.js +24 -0
  791. package/node_modules/zca-js/dist/apis/getSentFriendRequest.d.ts +18 -0
  792. package/node_modules/zca-js/dist/apis/getSentFriendRequest.js +24 -0
  793. package/node_modules/zca-js/dist/apis/getSettings.d.ts +3 -0
  794. package/node_modules/zca-js/dist/apis/getSettings.js +20 -0
  795. package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.d.ts +3 -0
  796. package/node_modules/zca-js/dist/apis/getStickerCategoryDetail.js +24 -0
  797. package/node_modules/zca-js/dist/apis/getStickers.d.ts +1 -0
  798. package/node_modules/zca-js/dist/apis/getStickers.js +40 -0
  799. package/node_modules/zca-js/dist/apis/getStickersDetail.d.ts +3 -0
  800. package/node_modules/zca-js/dist/apis/getStickersDetail.js +40 -0
  801. package/node_modules/zca-js/dist/apis/getUnreadMark.d.ts +14 -0
  802. package/node_modules/zca-js/dist/apis/getUnreadMark.js +30 -0
  803. package/node_modules/zca-js/dist/apis/getUserInfo.d.ts +8 -0
  804. package/node_modules/zca-js/dist/apis/getUserInfo.js +44 -0
  805. package/node_modules/zca-js/dist/apis/inviteUserToGroups.d.ts +10 -0
  806. package/node_modules/zca-js/dist/apis/inviteUserToGroups.js +30 -0
  807. package/node_modules/zca-js/dist/apis/joinGroupInviteBox.d.ts +2 -0
  808. package/node_modules/zca-js/dist/apis/joinGroupInviteBox.js +25 -0
  809. package/node_modules/zca-js/dist/apis/joinGroupLink.d.ts +2 -0
  810. package/node_modules/zca-js/dist/apis/joinGroupLink.js +27 -0
  811. package/node_modules/zca-js/dist/apis/keepAlive.d.ts +4 -0
  812. package/node_modules/zca-js/dist/apis/keepAlive.js +22 -0
  813. package/node_modules/zca-js/dist/apis/lastOnline.d.ts +7 -0
  814. package/node_modules/zca-js/dist/apis/lastOnline.js +26 -0
  815. package/node_modules/zca-js/dist/apis/leaveGroup.d.ts +4 -0
  816. package/node_modules/zca-js/dist/apis/leaveGroup.js +33 -0
  817. package/node_modules/zca-js/dist/apis/listen.d.ts +102 -0
  818. package/node_modules/zca-js/dist/apis/listen.js +425 -0
  819. package/node_modules/zca-js/dist/apis/lockPoll.d.ts +2 -0
  820. package/node_modules/zca-js/dist/apis/lockPoll.js +28 -0
  821. package/node_modules/zca-js/dist/apis/login.d.ts +3 -0
  822. package/node_modules/zca-js/dist/apis/login.js +96 -0
  823. package/node_modules/zca-js/dist/apis/loginQR.d.ts +71 -0
  824. package/node_modules/zca-js/dist/apis/loginQR.js +376 -0
  825. package/node_modules/zca-js/dist/apis/logoutV2.js +79 -0
  826. package/node_modules/zca-js/dist/apis/lostFocus.d.ts +4 -0
  827. package/node_modules/zca-js/dist/apis/lostFocus.js +23 -0
  828. package/node_modules/zca-js/dist/apis/parseLink.d.ts +21 -0
  829. package/node_modules/zca-js/dist/apis/parseLink.js +27 -0
  830. package/node_modules/zca-js/dist/apis/pullMobileMsg.js +22 -0
  831. package/node_modules/zca-js/dist/apis/registerCatalog.d.ts +2 -0
  832. package/node_modules/zca-js/dist/apis/registerCatalog.js +27 -0
  833. package/node_modules/zca-js/dist/apis/rejectFriendRequest.d.ts +2 -0
  834. package/node_modules/zca-js/dist/apis/rejectFriendRequest.js +27 -0
  835. package/node_modules/zca-js/dist/apis/removeFriend.d.ts +2 -0
  836. package/node_modules/zca-js/dist/apis/removeFriend.js +28 -0
  837. package/node_modules/zca-js/dist/apis/removeFriendAlias.d.ts +2 -0
  838. package/node_modules/zca-js/dist/apis/removeFriendAlias.js +24 -0
  839. package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.d.ts +2 -0
  840. package/node_modules/zca-js/dist/apis/removeGroupBlockedMember.js +28 -0
  841. package/node_modules/zca-js/dist/apis/removeGroupDeputy.d.ts +2 -0
  842. package/node_modules/zca-js/dist/apis/removeGroupDeputy.js +30 -0
  843. package/node_modules/zca-js/dist/apis/removeQuickMessage.d.ts +5 -0
  844. package/node_modules/zca-js/dist/apis/removeQuickMessage.js +27 -0
  845. package/node_modules/zca-js/dist/apis/removeReminder.d.ts +3 -0
  846. package/node_modules/zca-js/dist/apis/removeReminder.js +40 -0
  847. package/node_modules/zca-js/dist/apis/removeUnreadMark.d.ts +8 -0
  848. package/node_modules/zca-js/dist/apis/removeUnreadMark.js +50 -0
  849. package/node_modules/zca-js/dist/apis/removeUserFromGroup.d.ts +4 -0
  850. package/node_modules/zca-js/dist/apis/removeUserFromGroup.js +34 -0
  851. package/node_modules/zca-js/dist/apis/requestSyncMessage.js +18 -0
  852. package/node_modules/zca-js/dist/apis/resetHiddenConversPin.d.ts +2 -0
  853. package/node_modules/zca-js/dist/apis/resetHiddenConversPin.js +20 -0
  854. package/node_modules/zca-js/dist/apis/reuseAvatar.d.ts +2 -0
  855. package/node_modules/zca-js/dist/apis/reuseAvatar.js +26 -0
  856. package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.d.ts +14 -0
  857. package/node_modules/zca-js/dist/apis/reviewPendingMemberRequest.js +38 -0
  858. package/node_modules/zca-js/dist/apis/scanURL.d.ts +4 -0
  859. package/node_modules/zca-js/dist/apis/scanURL.js +28 -0
  860. package/node_modules/zca-js/dist/apis/searchSticker.d.ts +3 -0
  861. package/node_modules/zca-js/dist/apis/searchSticker.js +28 -0
  862. package/node_modules/zca-js/dist/apis/sendBankCard.d.ts +9 -0
  863. package/node_modules/zca-js/dist/apis/sendBankCard.js +53 -0
  864. package/node_modules/zca-js/dist/apis/sendCard.d.ts +10 -0
  865. package/node_modules/zca-js/dist/apis/sendCard.js +75 -0
  866. package/node_modules/zca-js/dist/apis/sendDeliveredEvent.d.ts +16 -0
  867. package/node_modules/zca-js/dist/apis/sendDeliveredEvent.js +55 -0
  868. package/node_modules/zca-js/dist/apis/sendFriendRequest.d.ts +2 -0
  869. package/node_modules/zca-js/dist/apis/sendFriendRequest.js +39 -0
  870. package/node_modules/zca-js/dist/apis/sendLink.d.ts +10 -0
  871. package/node_modules/zca-js/dist/apis/sendLink.js +78 -0
  872. package/node_modules/zca-js/dist/apis/sendMessage.d.ts +105 -0
  873. package/node_modules/zca-js/dist/apis/sendMessage.js +486 -0
  874. package/node_modules/zca-js/dist/apis/sendReport.d.ts +17 -0
  875. package/node_modules/zca-js/dist/apis/sendReport.js +53 -0
  876. package/node_modules/zca-js/dist/apis/sendSeenEvent.d.ts +16 -0
  877. package/node_modules/zca-js/dist/apis/sendSeenEvent.js +63 -0
  878. package/node_modules/zca-js/dist/apis/sendSticker.d.ts +10 -0
  879. package/node_modules/zca-js/dist/apis/sendSticker.js +74 -0
  880. package/node_modules/zca-js/dist/apis/sendTypingEvent.d.ts +5 -0
  881. package/node_modules/zca-js/dist/apis/sendTypingEvent.js +33 -0
  882. package/node_modules/zca-js/dist/apis/sendVideo.d.ts +35 -0
  883. package/node_modules/zca-js/dist/apis/sendVideo.js +134 -0
  884. package/node_modules/zca-js/dist/apis/sendVoice.d.ts +12 -0
  885. package/node_modules/zca-js/dist/apis/sendVoice.js +89 -0
  886. package/node_modules/zca-js/dist/apis/setHiddenConversations.d.ts +3 -0
  887. package/node_modules/zca-js/dist/apis/setHiddenConversations.js +39 -0
  888. package/node_modules/zca-js/dist/apis/setMute.d.ts +20 -0
  889. package/node_modules/zca-js/dist/apis/setMute.js +67 -0
  890. package/node_modules/zca-js/dist/apis/setPinnedConversations.d.ts +3 -0
  891. package/node_modules/zca-js/dist/apis/setPinnedConversations.js +34 -0
  892. package/node_modules/zca-js/dist/apis/sharePoll.d.ts +2 -0
  893. package/node_modules/zca-js/dist/apis/sharePoll.js +28 -0
  894. package/node_modules/zca-js/dist/apis/unblockUser.d.ts +2 -0
  895. package/node_modules/zca-js/dist/apis/unblockUser.js +28 -0
  896. package/node_modules/zca-js/dist/apis/undo.d.ts +9 -0
  897. package/node_modules/zca-js/dist/apis/undo.js +42 -0
  898. package/node_modules/zca-js/dist/apis/undoFriendRequest.d.ts +2 -0
  899. package/node_modules/zca-js/dist/apis/undoFriendRequest.js +27 -0
  900. package/node_modules/zca-js/dist/apis/updateActiveStatus.d.ts +4 -0
  901. package/node_modules/zca-js/dist/apis/updateActiveStatus.js +27 -0
  902. package/node_modules/zca-js/dist/apis/updateArchivedChatList.d.ts +10 -0
  903. package/node_modules/zca-js/dist/apis/updateArchivedChatList.js +34 -0
  904. package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.d.ts +9 -0
  905. package/node_modules/zca-js/dist/apis/updateAutoDeleteChat.js +40 -0
  906. package/node_modules/zca-js/dist/apis/updateAutoReply.d.ts +15 -0
  907. package/node_modules/zca-js/dist/apis/updateAutoReply.js +38 -0
  908. package/node_modules/zca-js/dist/apis/updateBankAccount.d.ts +9 -0
  909. package/node_modules/zca-js/dist/apis/updateBankAccount.js +31 -0
  910. package/node_modules/zca-js/dist/apis/updateCatalog.d.ts +11 -0
  911. package/node_modules/zca-js/dist/apis/updateCatalog.js +30 -0
  912. package/node_modules/zca-js/dist/apis/updateGroupSettings.d.ts +40 -0
  913. package/node_modules/zca-js/dist/apis/updateGroupSettings.js +43 -0
  914. package/node_modules/zca-js/dist/apis/updateHiddenConversPin.d.ts +2 -0
  915. package/node_modules/zca-js/dist/apis/updateHiddenConversPin.js +30 -0
  916. package/node_modules/zca-js/dist/apis/updateLabels.d.ts +15 -0
  917. package/node_modules/zca-js/dist/apis/updateLabels.js +34 -0
  918. package/node_modules/zca-js/dist/apis/updateLang.d.ts +6 -0
  919. package/node_modules/zca-js/dist/apis/updateLang.js +30 -0
  920. package/node_modules/zca-js/dist/apis/updateProductCatalog.d.ts +25 -0
  921. package/node_modules/zca-js/dist/apis/updateProductCatalog.js +51 -0
  922. package/node_modules/zca-js/dist/apis/updateProfile.d.ts +20 -0
  923. package/node_modules/zca-js/dist/apis/updateProfile.js +43 -0
  924. package/node_modules/zca-js/dist/apis/updateProfileBio.d.ts +2 -0
  925. package/node_modules/zca-js/dist/apis/updateProfileBio.js +27 -0
  926. package/node_modules/zca-js/dist/apis/updateQuickMessage.d.ts +11 -0
  927. package/node_modules/zca-js/dist/apis/updateQuickMessage.js +61 -0
  928. package/node_modules/zca-js/dist/apis/updateSettings.d.ts +16 -0
  929. package/node_modules/zca-js/dist/apis/updateSettings.js +90 -0
  930. package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.d.ts +2 -0
  931. package/node_modules/zca-js/dist/apis/upgradeGroupToCommunity.js +27 -0
  932. package/node_modules/zca-js/dist/apis/uploadAttachment.d.ts +50 -0
  933. package/node_modules/zca-js/dist/apis/uploadAttachment.js +197 -0
  934. package/node_modules/zca-js/dist/apis/uploadProductPhoto.d.ts +14 -0
  935. package/node_modules/zca-js/dist/apis/uploadProductPhoto.js +50 -0
  936. package/node_modules/zca-js/dist/apis/votePoll.d.ts +5 -0
  937. package/node_modules/zca-js/dist/apis/votePoll.js +29 -0
  938. package/node_modules/zca-js/dist/apis.d.ts +317 -0
  939. package/node_modules/zca-js/dist/apis.js +327 -0
  940. package/node_modules/zca-js/dist/cjs/Errors/ZaloApiError.cjs +11 -0
  941. package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRAborted.cjs +12 -0
  942. package/node_modules/zca-js/dist/cjs/Errors/ZaloApiLoginQRDeclined.cjs +12 -0
  943. package/node_modules/zca-js/dist/cjs/Errors/ZaloApiMissingImageMetadataGetter.cjs +12 -0
  944. package/node_modules/zca-js/dist/cjs/apis/acceptFriendRequest.cjs +33 -0
  945. package/node_modules/zca-js/dist/cjs/apis/addGroupBlockedMember.cjs +33 -0
  946. package/node_modules/zca-js/dist/cjs/apis/addGroupDeputy.cjs +35 -0
  947. package/node_modules/zca-js/dist/cjs/apis/addPollOptions.cjs +31 -0
  948. package/node_modules/zca-js/dist/cjs/apis/addQuickMessage.cjs +65 -0
  949. package/node_modules/zca-js/dist/cjs/apis/addReaction.cjs +308 -0
  950. package/node_modules/zca-js/dist/cjs/apis/addUnreadMark.cjs +66 -0
  951. package/node_modules/zca-js/dist/cjs/apis/addUserToGroup.cjs +39 -0
  952. package/node_modules/zca-js/dist/cjs/apis/blockUser.cjs +33 -0
  953. package/node_modules/zca-js/dist/cjs/apis/blockViewFeed.cjs +35 -0
  954. package/node_modules/zca-js/dist/cjs/apis/changeAccountAvatar.cjs +57 -0
  955. package/node_modules/zca-js/dist/cjs/apis/changeFriendAlias.cjs +32 -0
  956. package/node_modules/zca-js/dist/cjs/apis/changeGroupAvatar.cjs +49 -0
  957. package/node_modules/zca-js/dist/cjs/apis/changeGroupName.cjs +37 -0
  958. package/node_modules/zca-js/dist/cjs/apis/changeGroupOwner.cjs +35 -0
  959. package/node_modules/zca-js/dist/cjs/apis/createAutoReply.cjs +42 -0
  960. package/node_modules/zca-js/dist/cjs/apis/createBankAccount.cjs +37 -0
  961. package/node_modules/zca-js/dist/cjs/apis/createCatalog.cjs +34 -0
  962. package/node_modules/zca-js/dist/cjs/apis/createGroup.cjs +48 -0
  963. package/node_modules/zca-js/dist/cjs/apis/createNote.cjs +52 -0
  964. package/node_modules/zca-js/dist/cjs/apis/createPoll.cjs +45 -0
  965. package/node_modules/zca-js/dist/cjs/apis/createProductCatalog.cjs +55 -0
  966. package/node_modules/zca-js/dist/cjs/apis/createReminder.cjs +77 -0
  967. package/node_modules/zca-js/dist/cjs/apis/custom.cjs +19 -0
  968. package/node_modules/zca-js/dist/cjs/apis/deleteAutoReply.cjs +34 -0
  969. package/node_modules/zca-js/dist/cjs/apis/deleteAvatar.cjs +32 -0
  970. package/node_modules/zca-js/dist/cjs/apis/deleteBankAccount.cjs +37 -0
  971. package/node_modules/zca-js/dist/cjs/apis/deleteCatalog.cjs +33 -0
  972. package/node_modules/zca-js/dist/cjs/apis/deleteChat.cjs +64 -0
  973. package/node_modules/zca-js/dist/cjs/apis/deleteGroupInviteBox.cjs +32 -0
  974. package/node_modules/zca-js/dist/cjs/apis/deleteMessage.cjs +66 -0
  975. package/node_modules/zca-js/dist/cjs/apis/deleteProductCatalog.cjs +36 -0
  976. package/node_modules/zca-js/dist/cjs/apis/deleteSnapshotMobileMsg.cjs +22 -0
  977. package/node_modules/zca-js/dist/cjs/apis/disableGroupLink.cjs +29 -0
  978. package/node_modules/zca-js/dist/cjs/apis/disperseGroup.cjs +33 -0
  979. package/node_modules/zca-js/dist/cjs/apis/editNote.cjs +51 -0
  980. package/node_modules/zca-js/dist/cjs/apis/editReminder.cjs +75 -0
  981. package/node_modules/zca-js/dist/cjs/apis/enableGroupLink.cjs +30 -0
  982. package/node_modules/zca-js/dist/cjs/apis/fetchAccountInfo.cjs +15 -0
  983. package/node_modules/zca-js/dist/cjs/apis/findUser.cjs +56 -0
  984. package/node_modules/zca-js/dist/cjs/apis/findUserByUsername.cjs +41 -0
  985. package/node_modules/zca-js/dist/cjs/apis/forwardMessage.cjs +129 -0
  986. package/node_modules/zca-js/dist/cjs/apis/getAliasList.cjs +32 -0
  987. package/node_modules/zca-js/dist/cjs/apis/getAllFriends.cjs +48 -0
  988. package/node_modules/zca-js/dist/cjs/apis/getAllGroups.cjs +15 -0
  989. package/node_modules/zca-js/dist/cjs/apis/getArchivedChatList.cjs +28 -0
  990. package/node_modules/zca-js/dist/cjs/apis/getAutoDeleteChat.cjs +26 -0
  991. package/node_modules/zca-js/dist/cjs/apis/getAutoReplyList.cjs +29 -0
  992. package/node_modules/zca-js/dist/cjs/apis/getAvatarList.cjs +33 -0
  993. package/node_modules/zca-js/dist/cjs/apis/getAvatarUrlProfile.cjs +44 -0
  994. package/node_modules/zca-js/dist/cjs/apis/getBizAccount.cjs +32 -0
  995. package/node_modules/zca-js/dist/cjs/apis/getCatalogList.cjs +37 -0
  996. package/node_modules/zca-js/dist/cjs/apis/getCloseFriends.cjs +25 -0
  997. package/node_modules/zca-js/dist/cjs/apis/getContext.cjs +9 -0
  998. package/node_modules/zca-js/dist/cjs/apis/getCookie.cjs +14 -0
  999. package/node_modules/zca-js/dist/cjs/apis/getCrossDB.cjs +22 -0
  1000. package/node_modules/zca-js/dist/cjs/apis/getFriendBoardList.cjs +31 -0
  1001. package/node_modules/zca-js/dist/cjs/apis/getFriendOnlines.cjs +40 -0
  1002. package/node_modules/zca-js/dist/cjs/apis/getFriendRecommendations.cjs +32 -0
  1003. package/node_modules/zca-js/dist/cjs/apis/getFriendRequestStatus.cjs +30 -0
  1004. package/node_modules/zca-js/dist/cjs/apis/getFullAvatar.cjs +30 -0
  1005. package/node_modules/zca-js/dist/cjs/apis/getGroupBlockedMember.cjs +34 -0
  1006. package/node_modules/zca-js/dist/cjs/apis/getGroupChatHistory.cjs +51 -0
  1007. package/node_modules/zca-js/dist/cjs/apis/getGroupInfo.cjs +37 -0
  1008. package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxInfo.cjs +43 -0
  1009. package/node_modules/zca-js/dist/cjs/apis/getGroupInviteBoxList.cjs +36 -0
  1010. package/node_modules/zca-js/dist/cjs/apis/getGroupLinkDetail.cjs +30 -0
  1011. package/node_modules/zca-js/dist/cjs/apis/getGroupLinkInfo.cjs +33 -0
  1012. package/node_modules/zca-js/dist/cjs/apis/getGroupMembersInfo.cjs +29 -0
  1013. package/node_modules/zca-js/dist/cjs/apis/getHiddenConversations.cjs +28 -0
  1014. package/node_modules/zca-js/dist/cjs/apis/getLabels.cjs +33 -0
  1015. package/node_modules/zca-js/dist/cjs/apis/getListBank.cjs +25 -0
  1016. package/node_modules/zca-js/dist/cjs/apis/getListBankAccount.cjs +32 -0
  1017. package/node_modules/zca-js/dist/cjs/apis/getListBoard.cjs +59 -0
  1018. package/node_modules/zca-js/dist/cjs/apis/getListDevice.cjs +27 -0
  1019. package/node_modules/zca-js/dist/cjs/apis/getListReminder.cjs +61 -0
  1020. package/node_modules/zca-js/dist/cjs/apis/getMultiUsersByPhones.cjs +53 -0
  1021. package/node_modules/zca-js/dist/cjs/apis/getMute.cjs +27 -0
  1022. package/node_modules/zca-js/dist/cjs/apis/getOwnId.cjs +9 -0
  1023. package/node_modules/zca-js/dist/cjs/apis/getPendingGroupMembers.cjs +32 -0
  1024. package/node_modules/zca-js/dist/cjs/apis/getPinConversations.cjs +27 -0
  1025. package/node_modules/zca-js/dist/cjs/apis/getPollDetail.cjs +35 -0
  1026. package/node_modules/zca-js/dist/cjs/apis/getProductCatalogList.cjs +38 -0
  1027. package/node_modules/zca-js/dist/cjs/apis/getQR.cjs +34 -0
  1028. package/node_modules/zca-js/dist/cjs/apis/getQuickMessageList.cjs +29 -0
  1029. package/node_modules/zca-js/dist/cjs/apis/getRelatedFriendGroup.cjs +35 -0
  1030. package/node_modules/zca-js/dist/cjs/apis/getReminder.cjs +30 -0
  1031. package/node_modules/zca-js/dist/cjs/apis/getReminderResponses.cjs +29 -0
  1032. package/node_modules/zca-js/dist/cjs/apis/getSentFriendRequest.cjs +29 -0
  1033. package/node_modules/zca-js/dist/cjs/apis/getSettings.cjs +25 -0
  1034. package/node_modules/zca-js/dist/cjs/apis/getStickerCategoryDetail.cjs +29 -0
  1035. package/node_modules/zca-js/dist/cjs/apis/getStickers.cjs +45 -0
  1036. package/node_modules/zca-js/dist/cjs/apis/getStickersDetail.cjs +45 -0
  1037. package/node_modules/zca-js/dist/cjs/apis/getUnreadMark.cjs +35 -0
  1038. package/node_modules/zca-js/dist/cjs/apis/getUserInfo.cjs +58 -0
  1039. package/node_modules/zca-js/dist/cjs/apis/inviteUserToGroups.cjs +35 -0
  1040. package/node_modules/zca-js/dist/cjs/apis/joinGroupInviteBox.cjs +30 -0
  1041. package/node_modules/zca-js/dist/cjs/apis/joinGroupLink.cjs +32 -0
  1042. package/node_modules/zca-js/dist/cjs/apis/keepAlive.cjs +27 -0
  1043. package/node_modules/zca-js/dist/cjs/apis/lastOnline.cjs +31 -0
  1044. package/node_modules/zca-js/dist/cjs/apis/leaveGroup.cjs +38 -0
  1045. package/node_modules/zca-js/dist/cjs/apis/listen.cjs +440 -0
  1046. package/node_modules/zca-js/dist/cjs/apis/lockPoll.cjs +33 -0
  1047. package/node_modules/zca-js/dist/cjs/apis/login.cjs +102 -0
  1048. package/node_modules/zca-js/dist/cjs/apis/loginQR.cjs +368 -0
  1049. package/node_modules/zca-js/dist/cjs/apis/logoutV2.cjs +83 -0
  1050. package/node_modules/zca-js/dist/cjs/apis/lostFocus.cjs +28 -0
  1051. package/node_modules/zca-js/dist/cjs/apis/parseLink.cjs +32 -0
  1052. package/node_modules/zca-js/dist/cjs/apis/pullMobileMsg.cjs +26 -0
  1053. package/node_modules/zca-js/dist/cjs/apis/registerCatalog.cjs +32 -0
  1054. package/node_modules/zca-js/dist/cjs/apis/rejectFriendRequest.cjs +32 -0
  1055. package/node_modules/zca-js/dist/cjs/apis/removeFriend.cjs +33 -0
  1056. package/node_modules/zca-js/dist/cjs/apis/removeFriendAlias.cjs +29 -0
  1057. package/node_modules/zca-js/dist/cjs/apis/removeGroupBlockedMember.cjs +33 -0
  1058. package/node_modules/zca-js/dist/cjs/apis/removeGroupDeputy.cjs +35 -0
  1059. package/node_modules/zca-js/dist/cjs/apis/removeQuickMessage.cjs +32 -0
  1060. package/node_modules/zca-js/dist/cjs/apis/removeReminder.cjs +54 -0
  1061. package/node_modules/zca-js/dist/cjs/apis/removeUnreadMark.cjs +64 -0
  1062. package/node_modules/zca-js/dist/cjs/apis/removeUserFromGroup.cjs +39 -0
  1063. package/node_modules/zca-js/dist/cjs/apis/requestSyncMessage.cjs +22 -0
  1064. package/node_modules/zca-js/dist/cjs/apis/resetHiddenConversPin.cjs +25 -0
  1065. package/node_modules/zca-js/dist/cjs/apis/reuseAvatar.cjs +31 -0
  1066. package/node_modules/zca-js/dist/cjs/apis/reviewPendingMemberRequest.cjs +43 -0
  1067. package/node_modules/zca-js/dist/cjs/apis/scanURL.cjs +33 -0
  1068. package/node_modules/zca-js/dist/cjs/apis/searchSticker.cjs +33 -0
  1069. package/node_modules/zca-js/dist/cjs/apis/sendBankCard.cjs +68 -0
  1070. package/node_modules/zca-js/dist/cjs/apis/sendCard.cjs +89 -0
  1071. package/node_modules/zca-js/dist/cjs/apis/sendDeliveredEvent.cjs +69 -0
  1072. package/node_modules/zca-js/dist/cjs/apis/sendFriendRequest.cjs +44 -0
  1073. package/node_modules/zca-js/dist/cjs/apis/sendLink.cjs +92 -0
  1074. package/node_modules/zca-js/dist/cjs/apis/sendMessage.cjs +500 -0
  1075. package/node_modules/zca-js/dist/cjs/apis/sendReport.cjs +67 -0
  1076. package/node_modules/zca-js/dist/cjs/apis/sendSeenEvent.cjs +77 -0
  1077. package/node_modules/zca-js/dist/cjs/apis/sendSticker.cjs +88 -0
  1078. package/node_modules/zca-js/dist/cjs/apis/sendTypingEvent.cjs +47 -0
  1079. package/node_modules/zca-js/dist/cjs/apis/sendVideo.cjs +148 -0
  1080. package/node_modules/zca-js/dist/cjs/apis/sendVoice.cjs +103 -0
  1081. package/node_modules/zca-js/dist/cjs/apis/setHiddenConversations.cjs +53 -0
  1082. package/node_modules/zca-js/dist/cjs/apis/setMute.cjs +81 -0
  1083. package/node_modules/zca-js/dist/cjs/apis/setPinnedConversations.cjs +48 -0
  1084. package/node_modules/zca-js/dist/cjs/apis/sharePoll.cjs +33 -0
  1085. package/node_modules/zca-js/dist/cjs/apis/unblockUser.cjs +33 -0
  1086. package/node_modules/zca-js/dist/cjs/apis/undo.cjs +56 -0
  1087. package/node_modules/zca-js/dist/cjs/apis/undoFriendRequest.cjs +32 -0
  1088. package/node_modules/zca-js/dist/cjs/apis/updateActiveStatus.cjs +32 -0
  1089. package/node_modules/zca-js/dist/cjs/apis/updateArchivedChatList.cjs +39 -0
  1090. package/node_modules/zca-js/dist/cjs/apis/updateAutoDeleteChat.cjs +54 -0
  1091. package/node_modules/zca-js/dist/cjs/apis/updateAutoReply.cjs +43 -0
  1092. package/node_modules/zca-js/dist/cjs/apis/updateBankAccount.cjs +36 -0
  1093. package/node_modules/zca-js/dist/cjs/apis/updateCatalog.cjs +35 -0
  1094. package/node_modules/zca-js/dist/cjs/apis/updateGroupSettings.cjs +48 -0
  1095. package/node_modules/zca-js/dist/cjs/apis/updateHiddenConversPin.cjs +35 -0
  1096. package/node_modules/zca-js/dist/cjs/apis/updateLabels.cjs +39 -0
  1097. package/node_modules/zca-js/dist/cjs/apis/updateLang.cjs +35 -0
  1098. package/node_modules/zca-js/dist/cjs/apis/updateProductCatalog.cjs +56 -0
  1099. package/node_modules/zca-js/dist/cjs/apis/updateProfile.cjs +48 -0
  1100. package/node_modules/zca-js/dist/cjs/apis/updateProfileBio.cjs +32 -0
  1101. package/node_modules/zca-js/dist/cjs/apis/updateQuickMessage.cjs +66 -0
  1102. package/node_modules/zca-js/dist/cjs/apis/updateSettings.cjs +95 -0
  1103. package/node_modules/zca-js/dist/cjs/apis/upgradeGroupToCommunity.cjs +32 -0
  1104. package/node_modules/zca-js/dist/cjs/apis/uploadAttachment.cjs +211 -0
  1105. package/node_modules/zca-js/dist/cjs/apis/uploadProductPhoto.cjs +55 -0
  1106. package/node_modules/zca-js/dist/cjs/apis/votePoll.cjs +34 -0
  1107. package/node_modules/zca-js/dist/cjs/apis.cjs +332 -0
  1108. package/node_modules/zca-js/dist/cjs/context.cjs +34 -0
  1109. package/node_modules/zca-js/dist/cjs/index.cjs +159 -0
  1110. package/node_modules/zca-js/dist/cjs/models/AutoReply.cjs +9 -0
  1111. package/node_modules/zca-js/dist/cjs/models/Bank.cjs +263 -0
  1112. package/node_modules/zca-js/dist/cjs/models/Board.cjs +8 -0
  1113. package/node_modules/zca-js/dist/cjs/models/DeliveredMessage.cjs +23 -0
  1114. package/node_modules/zca-js/dist/cjs/models/Enum.cjs +27 -0
  1115. package/node_modules/zca-js/dist/cjs/models/FriendEvent.cjs +87 -0
  1116. package/node_modules/zca-js/dist/cjs/models/Group.cjs +13 -0
  1117. package/node_modules/zca-js/dist/cjs/models/GroupEvent.cjs +94 -0
  1118. package/node_modules/zca-js/dist/cjs/models/Message.cjs +35 -0
  1119. package/node_modules/zca-js/dist/cjs/models/Reaction.cjs +74 -0
  1120. package/node_modules/zca-js/dist/cjs/models/Reminder.cjs +9 -0
  1121. package/node_modules/zca-js/dist/cjs/models/SeenMessage.cjs +23 -0
  1122. package/node_modules/zca-js/dist/cjs/models/Typing.cjs +23 -0
  1123. package/node_modules/zca-js/dist/cjs/models/Undo.cjs +16 -0
  1124. package/node_modules/zca-js/dist/cjs/models/ZBusiness.cjs +39 -0
  1125. package/node_modules/zca-js/dist/cjs/update.cjs +34 -0
  1126. package/node_modules/zca-js/dist/cjs/utils.cjs +703 -0
  1127. package/node_modules/zca-js/dist/cjs/zalo.cjs +112 -0
  1128. package/node_modules/zca-js/dist/context.d.ts +179 -0
  1129. package/node_modules/zca-js/dist/context.js +28 -0
  1130. package/node_modules/zca-js/dist/index.d.ts +166 -0
  1131. package/node_modules/zca-js/dist/index.js +14 -0
  1132. package/node_modules/zca-js/dist/models/Attachment.d.ts +9 -0
  1133. package/node_modules/zca-js/dist/models/Attachment.js +1 -0
  1134. package/node_modules/zca-js/dist/models/AutoReply.d.ts +20 -0
  1135. package/node_modules/zca-js/dist/models/AutoReply.js +7 -0
  1136. package/node_modules/zca-js/dist/models/Bank.d.ts +291 -0
  1137. package/node_modules/zca-js/dist/models/Bank.js +262 -0
  1138. package/node_modules/zca-js/dist/models/Board.d.ts +60 -0
  1139. package/node_modules/zca-js/dist/models/Board.js +6 -0
  1140. package/node_modules/zca-js/dist/models/Catalog.d.ts +16 -0
  1141. package/node_modules/zca-js/dist/models/Catalog.js +1 -0
  1142. package/node_modules/zca-js/dist/models/DeliveredMessage.d.ts +27 -0
  1143. package/node_modules/zca-js/dist/models/DeliveredMessage.js +17 -0
  1144. package/node_modules/zca-js/dist/models/Enum.d.ts +21 -0
  1145. package/node_modules/zca-js/dist/models/Enum.js +25 -0
  1146. package/node_modules/zca-js/dist/models/FriendEvent.d.ts +107 -0
  1147. package/node_modules/zca-js/dist/models/FriendEvent.js +83 -0
  1148. package/node_modules/zca-js/dist/models/Group.d.ts +125 -0
  1149. package/node_modules/zca-js/dist/models/Group.js +11 -0
  1150. package/node_modules/zca-js/dist/models/GroupEvent.d.ts +178 -0
  1151. package/node_modules/zca-js/dist/models/GroupEvent.js +90 -0
  1152. package/node_modules/zca-js/dist/models/Label.d.ts +10 -0
  1153. package/node_modules/zca-js/dist/models/Label.js +1 -0
  1154. package/node_modules/zca-js/dist/models/Message.d.ts +91 -0
  1155. package/node_modules/zca-js/dist/models/Message.js +29 -0
  1156. package/node_modules/zca-js/dist/models/ProductCatalog.d.ts +17 -0
  1157. package/node_modules/zca-js/dist/models/ProductCatalog.js +1 -0
  1158. package/node_modules/zca-js/dist/models/QuickMessage.d.ts +25 -0
  1159. package/node_modules/zca-js/dist/models/QuickMessage.js +1 -0
  1160. package/node_modules/zca-js/dist/models/Reaction.d.ts +85 -0
  1161. package/node_modules/zca-js/dist/models/Reaction.js +70 -0
  1162. package/node_modules/zca-js/dist/models/Reminder.d.ts +51 -0
  1163. package/node_modules/zca-js/dist/models/Reminder.js +7 -0
  1164. package/node_modules/zca-js/dist/models/SeenMessage.d.ts +26 -0
  1165. package/node_modules/zca-js/dist/models/SeenMessage.js +17 -0
  1166. package/node_modules/zca-js/dist/models/Sticker.d.ts +27 -0
  1167. package/node_modules/zca-js/dist/models/Sticker.js +1 -0
  1168. package/node_modules/zca-js/dist/models/Typing.d.ts +24 -0
  1169. package/node_modules/zca-js/dist/models/Typing.js +17 -0
  1170. package/node_modules/zca-js/dist/models/Undo.d.ts +34 -0
  1171. package/node_modules/zca-js/dist/models/Undo.js +12 -0
  1172. package/node_modules/zca-js/dist/models/User.d.ts +70 -0
  1173. package/node_modules/zca-js/dist/models/User.js +1 -0
  1174. package/node_modules/zca-js/dist/models/ZBusiness.d.ts +22 -0
  1175. package/node_modules/zca-js/dist/models/ZBusiness.js +35 -0
  1176. package/node_modules/zca-js/dist/models/index.d.ts +22 -0
  1177. package/node_modules/zca-js/dist/models/index.js +22 -0
  1178. package/node_modules/zca-js/dist/update.d.ts +2 -0
  1179. package/node_modules/zca-js/dist/update.js +29 -0
  1180. package/node_modules/zca-js/dist/utils.d.ts +167 -0
  1181. package/node_modules/zca-js/dist/utils.js +719 -0
  1182. package/node_modules/zca-js/dist/zalo.d.ts +41 -0
  1183. package/node_modules/zca-js/dist/zalo.js +107 -0
  1184. package/node_modules/zca-js/eslint.config.js +21 -0
  1185. package/node_modules/zca-js/index.d.ts +2 -0
  1186. package/node_modules/zca-js/package.json +78 -0
  1187. package/node_modules/zca-js/rollup.config.js +28 -0
  1188. package/package.json +80 -62
  1189. package/patches/zca-js+2.2.0.patch +1677 -0
  1190. package/src/cli.test.js +34 -5
  1191. package/src/commands/account.js +98 -5
  1192. package/src/commands/auto-reply.js +30 -10
  1193. package/src/commands/catalog.js +5 -4
  1194. package/src/commands/conv.js +551 -14
  1195. package/src/commands/friend.js +19 -7
  1196. package/src/commands/group.js +82 -31
  1197. package/src/commands/listen.js +624 -68
  1198. package/src/commands/login.js +179 -20
  1199. package/src/commands/mcp.js +422 -44
  1200. package/src/commands/msg.js +1288 -140
  1201. package/src/commands/oa-listen.js +130 -20
  1202. package/src/commands/oa.js +26 -5
  1203. package/src/commands/poll.js +7 -2
  1204. package/src/commands/profile.js +3 -2
  1205. package/src/commands/sync.js +2052 -0
  1206. package/src/core/accounts.js +69 -6
  1207. package/src/core/cached-message.js +200 -0
  1208. package/src/core/coverage.js +90 -0
  1209. package/src/core/current-user-names.js +104 -0
  1210. package/src/core/daemon-account.js +61 -0
  1211. package/src/core/daemon-channel.js +638 -0
  1212. package/src/core/daemon-sync.js +181 -0
  1213. package/src/core/db.js +1625 -0
  1214. package/src/core/forward.js +112 -0
  1215. package/src/core/group-history.js +248 -0
  1216. package/src/core/group-members.js +68 -0
  1217. package/src/core/group-settings.js +250 -0
  1218. package/src/core/history-fetch.js +208 -0
  1219. package/src/core/listener-lifecycle.js +90 -0
  1220. package/src/core/live-api.js +47 -0
  1221. package/src/core/live-store.js +733 -0
  1222. package/src/core/lock.js +129 -0
  1223. package/src/core/logout.js +289 -0
  1224. package/src/core/offline-queue.js +194 -0
  1225. package/src/core/pin.js +222 -0
  1226. package/src/core/read-state.js +318 -0
  1227. package/src/core/receipts.js +679 -0
  1228. package/src/core/recent-conversations.js +30 -0
  1229. package/src/core/self-heal.js +522 -0
  1230. package/src/core/socket-tap.js +154 -0
  1231. package/src/core/sync-v2/assets.js +181 -0
  1232. package/src/core/sync-v2/board.js +338 -0
  1233. package/src/core/sync-v2/conv-state.js +152 -0
  1234. package/src/core/sync-v2/gap-advice.js +110 -0
  1235. package/src/core/sync-v2/gid.js +106 -0
  1236. package/src/core/sync-v2/index.js +1259 -0
  1237. package/src/core/sync-v2/keepalive.js +177 -0
  1238. package/src/core/sync-v2/media.js +704 -0
  1239. package/src/core/sync-v2/message-types.js +522 -0
  1240. package/src/core/sync-v2/plan.js +95 -0
  1241. package/src/core/sync-v2/reactions.js +236 -0
  1242. package/src/core/sync-v2/renewlink.js +124 -0
  1243. package/src/core/sync-v2/senders.js +61 -0
  1244. package/src/core/sync-v2/zcloud-cipher.js +88 -0
  1245. package/src/core/sync-v2/zcloud.js +675 -0
  1246. package/src/core/sync.js +540 -0
  1247. package/src/core/zalo-client.js +179 -61
  1248. package/src/core/zca-custom.js +78 -0
  1249. package/src/index.js +15 -3
  1250. package/src/mcp/mcp-config.js +40 -3
  1251. package/src/mcp/mcp-http-transport.js +12 -2
  1252. package/src/mcp/mcp-server.js +5 -2
  1253. package/src/mcp/mcp-tools.js +969 -99
  1254. package/src/mcp/message-buffer.js +38 -8
  1255. package/src/mcp/message-buffer.test.js +67 -15
  1256. package/src/mcp/notifier.js +17 -1
  1257. package/src/mcp/notifier.test.js +6 -0
  1258. package/src/mcp/sync-jobs.js +82 -0
  1259. package/src/mcp/thread-name-cache.js +14 -1
  1260. package/src/mcp/thread-name-cache.test.js +4 -1
  1261. package/src/utils/bank-helpers.js +8 -3
  1262. package/src/utils/device-fingerprint.js +72 -0
  1263. package/src/utils/mentions.js +140 -0
  1264. package/src/utils/my-documents.js +95 -0
  1265. package/src/utils/open-file.js +49 -0
  1266. package/src/utils/output.js +75 -4
  1267. package/src/utils/parse-options.js +56 -0
  1268. package/src/utils/qr-http-server.js +44 -7
  1269. package/src/utils/quote.js +203 -0
  1270. package/src/utils/thread-type.js +72 -0
  1271. package/src/utils/update-check.js +42 -1
  1272. package/src/utils/urgency.js +29 -0
  1273. package/src/mcp/media-downloader.js +0 -191
  1274. package/src/mcp/media-downloader.test.js +0 -45
  1275. package/src/utils/qr-display.test.js +0 -97
@@ -0,0 +1,1259 @@
1
+ /**
2
+ * transfer-sync-v2 — restore mobile message history into zalo.db.
3
+ *
4
+ * This is the real, phone-backed sync (as opposed to the empty cmd 510/511
5
+ * socket backfill). Flow, all over the one zca-js WebSocket:
6
+ *
7
+ * 1. cmd 590 CONVERSATION round (priority 0, partition "") — prompts the
8
+ * owner's phone once (transfer_status 3 -> 4 on tap). Decrypts to the full
9
+ * conversation list (opaque `convId`s + type).
10
+ * 2. cmd 590 MESSAGE round(s) (priority 2), sharded at <=30 partitions each
11
+ * (`oneone/<convId>` / `group/<convId>`). Sent right after the confirm, so
12
+ * they inherit it (status 5, no extra tap). Each upload_batch carries a
13
+ * signed msgUrl.
14
+ * 3. Fetch each msgUrl, strip the [u32 LE len] frame, decrypt via libzproto
15
+ * (metadata -> sessionRecord, then messages), Zstd-decompress, protobuf-
16
+ * decode, map the opaque convId to the real numeric threadId (+ name) via
17
+ * the friend/group lists, and write into zalo.db.
18
+ * 4. cmd 591 dispose every session (clears the phone's sync banner).
19
+ *
20
+ * See tests/HANDOFF.md / agent/work/transfer-sync-v2 for the protocol notes.
21
+ */
22
+ import zlib from "node:zlib";
23
+ import crypto from "node:crypto";
24
+ import { resolve } from "node:path";
25
+ import {
26
+ initDb,
27
+ insertMessage,
28
+ upsertThread,
29
+ setSyncState,
30
+ runInTransaction,
31
+ getPendingSyncGaps,
32
+ resolveSyncGap,
33
+ replaceLiveGroupEventPlaceholder,
34
+ getThreadType,
35
+ getRecentThreads,
36
+ } from "../db.js";
37
+ import { ensureAssets, loadCodecs } from "./assets.js";
38
+ import { classifySyncMessage } from "./message-types.js";
39
+ import { resolveNonFriendDms } from "./gid.js";
40
+ import { createSenderResolver } from "./senders.js";
41
+ import { readUserAliases, currentUserName, resolveCurrentUserNames } from "../current-user-names.js";
42
+ import { startKeepAlive } from "./keepalive.js";
43
+ import { attachLiveStore } from "../live-store.js";
44
+
45
+ /**
46
+ * Lower bound of a "full history" sync: the beginning of time.
47
+ *
48
+ * This used to be pinned at 2024-01-01, which quietly made "full history" mean
49
+ * "the last couple of years" — an account with messages from 2018 never had
50
+ * them requested from the phone at all, with nothing in the output saying so.
51
+ * Zalo itself asks for 14/30 days and the bound is just the `from` field of the
52
+ * cmd 590 query, so there is no protocol reason to stop at any particular year.
53
+ *
54
+ * Use `--from` (see {@link resolveSyncWindow}) to raise it deliberately when a
55
+ * narrower window is actually wanted.
56
+ */
57
+ export const FULL_HISTORY_FROM = 0;
58
+
59
+ /** Zalo launched in 2012; nothing can predate it. Used only to sanity-check `--from`. */
60
+ const EARLIEST_PLAUSIBLE = 1325376000000; // 2012-01-01
61
+ const MAX_TS = 9007199254740991;
62
+ /**
63
+ * Wait allowance per message shard. The phone serves shards sequentially,
64
+ * so the overall budget scales with how many were sent rather than being a
65
+ * flat number that is either too small for a full history or absurd for a
66
+ * one-shard run.
67
+ */
68
+ const PER_SHARD_BUDGET_MS = 30000;
69
+ /**
70
+ * How many message sessions may be open on the phone at once. Zalo Web
71
+ * opens four; fifty at once got the socket dropped with no error frame.
72
+ */
73
+ const DEFAULT_WAVE_SIZE = 4;
74
+ /**
75
+ * How many times a dropped socket may be reconnected inside one restore.
76
+ *
77
+ * One, deliberately. A reconnect is cheap for us and potentially expensive for
78
+ * the account owner -- if the server does not carry the phone's confirmation
79
+ * across it, the resumed request prompts their phone again -- so this retries
80
+ * once and then reports honestly rather than looping on a wire that keeps
81
+ * dying.
82
+ */
83
+ const MAX_RESUMES = 1;
84
+ const DAY_MS = 24 * 60 * 60 * 1000;
85
+
86
+ /**
87
+ * Turn the `--days` option into the `from`/`to` bounds carried by every
88
+ * cmd 590 query — the conversation round as well as the message rounds, so a
89
+ * narrow window also means fewer conversations, fewer shards and a shorter run.
90
+ *
91
+ * A falsy `days` (the default) means full history. A window reaching further
92
+ * back than {@link FULL_HISTORY_FROM} is clamped to it, so `--days 9999` is
93
+ * exactly the default rather than a wider request never tested against the
94
+ * server.
95
+ *
96
+ * @param {number|null|undefined} days - how many days back to sync.
97
+ * @param {number} [now=Date.now()] - injectable for tests.
98
+ * @returns {{days: number|null, from: number, to: number, clamped: boolean, label: string}}
99
+ */
100
+ /**
101
+ * Record that a restore settled the window it asked about.
102
+ *
103
+ * Two things made the freshness debounce -- the guard that stops a run from
104
+ * re-pinging the phone -- effectively disabled:
105
+ *
106
+ * - a CONFIRMED empty window (the phone answered: nothing in this range was
107
+ * missed) returned before the success markers were written, so it never
108
+ * counted. That is the common case over any window a listener was
109
+ * connected for: the phone hands a sync only what a web session missed.
110
+ * - checkSyncFreshness never skips while any gap is pending, and nothing
111
+ * resolved gaps (resolveSyncGap had only test callers), so after the first
112
+ * listener reconnect every later run pinged the phone forever.
113
+ *
114
+ * Only a gap lying wholly inside the window is resolved: a --days 1 run says
115
+ * nothing about a gap from last week. A partial run resolves none.
116
+ *
117
+ * @param {{from: number}} win - the window the restore asked for
118
+ * @param {{resolveGaps?: boolean, now?: number}} [opts]
119
+ * @returns {{resolvedGaps: number}}
120
+ */
121
+ export function recordRestoreSuccess(win, opts = {}) {
122
+ const now = Number.isFinite(opts.now) ? opts.now : Date.now();
123
+ setSyncState("lastSyncOkAt", now);
124
+ setSyncState("lastSyncOkKind", "transfer");
125
+ // How far back this run actually covered, so a later, WIDER sync is not
126
+ // silently skipped by the freshness debounce.
127
+ setSyncState("lastSyncOkFrom", String(win.from));
128
+ let resolvedGaps = 0;
129
+ if (opts.resolveGaps) {
130
+ for (const g of getPendingSyncGaps()) {
131
+ if (Number(g.fromTs) >= Number(win.from) && Number(g.toTs) <= now) {
132
+ resolveSyncGap(g.id);
133
+ resolvedGaps++;
134
+ }
135
+ }
136
+ }
137
+ return { resolvedGaps };
138
+ }
139
+
140
+ export function resolveSyncWindow(days, now = Date.now(), fromTs = undefined) {
141
+ const since = (ts) => (ts > 0 ? new Date(ts).toISOString().slice(0, 10) : "the beginning");
142
+
143
+ // An explicit --from wins over --days: it is the more specific request.
144
+ if (fromTs !== undefined && fromTs !== null && fromTs !== "") {
145
+ const t = typeof fromTs === "number" ? fromTs : Date.parse(fromTs);
146
+ if (Number.isFinite(t) && t >= EARLIEST_PLAUSIBLE && t <= now) {
147
+ return { days: null, from: t, to: MAX_TS, clamped: false, label: `everything since ${since(t)}` };
148
+ }
149
+ return {
150
+ days: null,
151
+ from: FULL_HISTORY_FROM,
152
+ to: MAX_TS,
153
+ clamped: true,
154
+ label: `full history (--from was not a usable date, so: everything)`,
155
+ };
156
+ }
157
+
158
+ const n = Number(days);
159
+ const full = { days: null, from: FULL_HISTORY_FROM, to: MAX_TS, clamped: false };
160
+ if (!Number.isFinite(n) || n <= 0) return { ...full, label: "full history (everything your phone still holds)" };
161
+
162
+ const wanted = now - n * DAY_MS;
163
+ if (wanted <= FULL_HISTORY_FROM) {
164
+ return { ...full, days: n, clamped: true, label: `the last ${n} days — which is all of it, so: full history` };
165
+ }
166
+ return {
167
+ days: n,
168
+ from: wanted,
169
+ to: MAX_TS,
170
+ clamped: false,
171
+ label: `the last ${n} day${n === 1 ? "" : "s"} (since ${since(wanted)})`,
172
+ };
173
+ }
174
+
175
+ const randId = (n = 32) =>
176
+ [...crypto.randomBytes(n)]
177
+ .map((b) => "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[b % 62])
178
+ .join("");
179
+ const b64 = (u8) => Buffer.from(u8).toString("base64");
180
+
181
+ /** Split a downloaded batch blob into its length-prefixed payload chunks. */
182
+ export function splitChunks(buf) {
183
+ const out = [];
184
+ let o = 0;
185
+ while (o + 4 <= buf.length) {
186
+ const n = buf.readUInt32LE(o);
187
+ o += 4;
188
+ if (o + n > buf.length) break;
189
+ out.push(buf.subarray(o, o + n));
190
+ o += n;
191
+ }
192
+ return out;
193
+ }
194
+
195
+ function decompress(p) {
196
+ try {
197
+ return zlib.zstdDecompressSync(p);
198
+ } catch {}
199
+ try {
200
+ return zlib.inflateSync(p);
201
+ } catch {}
202
+ try {
203
+ return zlib.gunzipSync(p);
204
+ } catch {}
205
+ return p;
206
+ }
207
+
208
+ /**
209
+ * Decode a Zalo WebSocket frame body (the `{encrypt, data}` envelope) using the
210
+ * per-session transport cipher key (the `key` field of the cmd 1/1 handshake
211
+ * frame). Mirrors zca-js's decodeEventData without importing its internals.
212
+ * encrypt: 0=plain JSON, 1=inflate-only, 2=AES-128-GCM+inflate, 3=GCM only.
213
+ *
214
+ * @param {{encrypt: number, data: string}} parsed
215
+ * @param {string} cipherKey - base64 AES key from the handshake.
216
+ */
217
+ export function decodeFrame(parsed, cipherKey) {
218
+ if (parsed.encrypt === 0) return JSON.parse(parsed.data);
219
+ const raw = Buffer.from(parsed.encrypt === 1 ? parsed.data : decodeURIComponent(parsed.data), "base64");
220
+ let plain = raw;
221
+ if (parsed.encrypt !== 1) {
222
+ if (!cipherKey || raw.length < 48) throw new Error("missing cipher key or short frame");
223
+ const iv = raw.subarray(0, 16);
224
+ const aad = raw.subarray(16, 32);
225
+ const body = raw.subarray(32);
226
+ const ct = body.subarray(0, body.length - 16);
227
+ const tag = body.subarray(body.length - 16);
228
+ const key = Buffer.from(cipherKey, "base64");
229
+ const decipher = crypto.createDecipheriv(key.length === 16 ? "aes-128-gcm" : "aes-256-gcm", key, iv);
230
+ decipher.setAAD(aad);
231
+ decipher.setAuthTag(tag);
232
+ plain = Buffer.concat([decipher.update(ct), decipher.final()]);
233
+ }
234
+ // encrypt 1/2 wrap the payload with zlib OR gzip (pako auto-detects both);
235
+ // zlib.unzipSync handles either. encrypt 3 is uncompressed.
236
+ let out = plain;
237
+ if (parsed.encrypt !== 3) {
238
+ try {
239
+ out = zlib.unzipSync(plain);
240
+ } catch {
241
+ out = zlib.inflateRawSync(plain);
242
+ }
243
+ }
244
+ return JSON.parse(out.toString("utf8"));
245
+ }
246
+
247
+ /**
248
+ * Has a sync session delivered everything it was asked for?
249
+ *
250
+ * `isLast` looks like the end marker and mostly is, but a captured Zalo Web run
251
+ * ends its final message session with `isLast=0` and disposes it anyway. What
252
+ * actually completes a message session is coverage: every partition in the
253
+ * cmd 590 request has come back inside some batch's `scopes`. The conversation
254
+ * round asks for the empty partition and its batches carry no scopes, so there
255
+ * `isLast` is the only signal available.
256
+ *
257
+ * @param {{want: Set<string>, covered: Set<string>, sawLast: boolean}} state
258
+ * @returns {boolean}
259
+ */
260
+ /**
261
+ * Resolve a wait budget, refusing to produce something that means "do not wait".
262
+ *
263
+ * This exists because of a real regression: a call site that forgot to pass the
264
+ * budget produced `Date.now() + undefined` = NaN, every comparison against NaN
265
+ * is false, and the wait loop exited on its first check -- so a sync round that
266
+ * should have waited three minutes for a phone confirmation returned instantly
267
+ * and reported "not confirmed in time".
268
+ *
269
+ * @param {number|undefined} budgetMs - the requested budget
270
+ * @param {number} fallbackMs - used when the request is missing or nonsensical
271
+ * @returns {number} a finite, positive number of milliseconds
272
+ */
273
+ export function resolveWaitBudget(budgetMs, fallbackMs) {
274
+ if (Number.isFinite(budgetMs) && budgetMs > 0) return budgetMs;
275
+ if (Number.isFinite(fallbackMs) && fallbackMs > 0) return fallbackMs;
276
+ return 30000;
277
+ }
278
+
279
+ /**
280
+ * Which shards still have to go out, and whether a dropped socket is worth one
281
+ * more reconnect.
282
+ *
283
+ * Pulled out of the wave loop because this is the part that has to stay right
284
+ * across a disconnect: a shard the phone already served must never be asked for
285
+ * again (it would re-fetch, and in the worst case re-prompt), and a shard that
286
+ * was in flight when the wire died must go out again or its messages are simply
287
+ * lost. Mixing that bookkeeping in with the decrypt/decode/store body is how it
288
+ * gets broken quietly.
289
+ *
290
+ * @param {number} shardCount - how many message rounds the run needs
291
+ * @param {object} [opts]
292
+ * @param {number} [opts.waveSize=DEFAULT_WAVE_SIZE] sessions in flight at once
293
+ * @param {number} [opts.maxResumes=0] reconnects allowed; 0 disables resuming
294
+ * @returns {{remaining: () => number, resumes: () => number, done: () => boolean,
295
+ * pending: () => number[], nextWave: () => number[], settle: (i: number) => boolean,
296
+ * useResume: () => boolean}}
297
+ */
298
+ export function createShardSchedule(shardCount, opts = {}) {
299
+ const waveSize = Math.max(1, opts.waveSize || DEFAULT_WAVE_SIZE);
300
+ let resumesLeft = Number.isFinite(opts.maxResumes) && opts.maxResumes > 0 ? opts.maxResumes : 0;
301
+ let resumes = 0;
302
+ const pending = [];
303
+ for (let i = 0; i < Math.max(0, shardCount); i++) pending.push(i);
304
+
305
+ return {
306
+ remaining: () => pending.length,
307
+ resumes: () => resumes,
308
+ done: () => pending.length === 0,
309
+ pending: () => pending.slice(),
310
+ /** The shard indexes to send next -- never more than one wave at a time. */
311
+ nextWave: () => pending.slice(0, waveSize),
312
+ /**
313
+ * Mark a shard settled: served, or refused by the phone. Either way it
314
+ * is finished with, and a resume must not send it again.
315
+ *
316
+ * @param {number} idx - shard index
317
+ * @returns {boolean} true when it was still pending
318
+ */
319
+ settle(idx) {
320
+ const at = pending.indexOf(idx);
321
+ if (at >= 0) pending.splice(at, 1);
322
+ return at >= 0;
323
+ },
324
+ /**
325
+ * Spend one reconnect allowance.
326
+ *
327
+ * @returns {boolean} true when a reconnect may be attempted
328
+ */
329
+ useResume() {
330
+ if (resumesLeft <= 0) return false;
331
+ resumesLeft--;
332
+ resumes++;
333
+ return true;
334
+ },
335
+ };
336
+ }
337
+
338
+ /**
339
+ * Turn the end state of a restore into a `reason` and, when it failed outright,
340
+ * the message to throw.
341
+ *
342
+ * These two failures need opposite advice and used to read identically:
343
+ *
344
+ * - **the socket died** -- nothing is wrong with the phone, and if it had
345
+ * already confirmed, that tap is spent; the user needs to know a re-run costs
346
+ * them another one.
347
+ * - **the phone never answered** -- the connection was fine the whole time, so
348
+ * the only thing to do differently is confirm the prompt.
349
+ *
350
+ * @param {object} st
351
+ * @param {boolean} st.socketDied - the wire dropped and could not be resumed
352
+ * @param {boolean} st.timedOut - the wait budget ran out with the socket up
353
+ * @param {boolean} st.confirmed - the phone answered (transfer_status >= 4)
354
+ * @param {number} st.messagesSaved
355
+ * @param {number} st.finished - shards served
356
+ * @param {number} st.total - shards requested
357
+ * @param {number} [st.resumes=0] - reconnects used
358
+ * @param {number} [st.waitMs] - the budget, for the timeout wording
359
+ * @returns {{reason: string, error: string|null}}
360
+ */
361
+ export function describeRestoreOutcome(st) {
362
+ const resumes = st.resumes || 0;
363
+ const secs = Number.isFinite(st.waitMs) ? Math.round(st.waitMs / 1000) : null;
364
+
365
+ if (st.socketDied && !st.messagesSaved) {
366
+ return {
367
+ reason: "socket-lost",
368
+ error:
369
+ (resumes ? `the connection dropped again after ${resumes} reconnect(s)` : "the connection dropped") +
370
+ " before any messages arrived" +
371
+ (st.confirmed
372
+ ? " — your phone had already confirmed, so re-running will prompt it again"
373
+ : " — your phone was never prompted, so nothing was spent"),
374
+ };
375
+ }
376
+ if (st.timedOut && !st.messagesSaved) {
377
+ return {
378
+ reason: "timeout",
379
+ error: st.confirmed
380
+ ? `your phone confirmed but served no messages within ${secs ?? "the"}${secs ? "s" : " budget"} — the connection stayed up the whole time`
381
+ : `your phone did not answer the sync prompt${secs ? ` within ${secs}s` : ""} — the connection stayed up, so nothing was lost; re-run and confirm it`,
382
+ };
383
+ }
384
+ if (st.finished < st.total) return { reason: st.socketDied ? "socket-lost" : "partial", error: null };
385
+ return { reason: "complete", error: null };
386
+ }
387
+
388
+ export function isSessionComplete(state) {
389
+ if (!state) return false;
390
+ if (state.sawLast) return true;
391
+ const want = state.want?.size ?? 0;
392
+ if (!want) return false; // conversation round: only isLast can end it
393
+ return (state.covered?.size ?? 0) >= want;
394
+ }
395
+
396
+ /**
397
+ * The id a synced message should be stored under.
398
+ *
399
+ * `globalId` is the server id and the one every other path names a message by
400
+ * (a reaction's `gMsgID`, a removal's `globalDelMsgId`). It is absent on some
401
+ * messages, and jspb renders an absent uint64 as the string "0" — truthy — so
402
+ * a plain `globalId || clientId` stored them all under the literal id "0",
403
+ * where they overwrote one another through insertMessage's upsert.
404
+ *
405
+ * @param {object} msg - a decoded Sync2.Message.Message
406
+ * @returns {string}
407
+ */
408
+ function syncMsgId(msg) {
409
+ const gid = msg?.globalId;
410
+ if (gid !== undefined && gid !== null && String(gid) !== "0" && String(gid) !== "") return String(gid);
411
+ return String(msg?.clientId ?? "");
412
+ }
413
+
414
+ export class SyncV2 {
415
+ /**
416
+ * @param {object} api - a logged-in zca-js API (from getApi()).
417
+ * @param {string} accountName - ownId; picks the account data dir.
418
+ */
419
+ constructor(api, accountName) {
420
+ this.api = api;
421
+ this.accountName = accountName;
422
+ this.accountDir = resolve(
423
+ process.env.USERPROFILE || process.env.HOME || "",
424
+ ".zalo-agent-cli",
425
+ "accounts",
426
+ accountName,
427
+ );
428
+ }
429
+
430
+ /** Build opaque-globalId -> {id, name, type} from the friend + group lists. */
431
+ async _buildThreadMap(log) {
432
+ const map = new Map();
433
+ this.userAliases = await readUserAliases(this.api, log);
434
+ try {
435
+ const friends = await this.api.getAllFriends();
436
+ const arr = Array.isArray(friends) ? friends : friends?.data || [];
437
+ for (const f of arr)
438
+ if (f.globalId)
439
+ map.set(f.globalId, {
440
+ id: String(f.userId),
441
+ name: currentUserName(f.userId, f, this.userAliases).name,
442
+ zaloName: f.zaloName || "",
443
+ snapshotName: f.zaloName || f.displayName || "",
444
+ type: "dm",
445
+ });
446
+ } catch (e) {
447
+ log(`friend list unavailable (${e.message}); DM names/ids may be missing`);
448
+ }
449
+ try {
450
+ const groups = await this.api.getAllGroups();
451
+ const gridVer = groups?.gridVerMap || groups?.data?.gridVerMap || {};
452
+ const gids = Object.keys(gridVer);
453
+ for (let i = 0; i < gids.length; i += 50) {
454
+ const info = await this.api.getGroupInfo(gids.slice(i, i + 50)).catch(() => ({}));
455
+ const gi = info?.gridInfoMap || info?.data?.gridInfoMap || {};
456
+ for (const g of Object.values(gi))
457
+ if (g.globalId) map.set(g.globalId, { id: String(g.groupId), name: g.name || "", type: "group" });
458
+ }
459
+ } catch (e) {
460
+ log(`group list unavailable (${e.message}); group names/ids may be missing`);
461
+ }
462
+ return map;
463
+ }
464
+
465
+ /** Refresh already-cached titles even if this restore window has no messages for them. */
466
+ _refreshThreadNames(threadMap) {
467
+ for (const thread of threadMap.values()) {
468
+ if (getThreadType(thread.id) === thread.type) {
469
+ upsertThread({ threadId: thread.id, type: thread.type, name: thread.name, lastUpdate: 0 });
470
+ }
471
+ }
472
+ }
473
+
474
+ /** Refresh existing DM peers outside the requested message window, including non-friends. */
475
+ async _refreshDmNames(threadMap) {
476
+ const profiles = new Map(
477
+ [...threadMap.values()]
478
+ .filter((t) => t.type === "dm" && t.zaloName)
479
+ .map((t) => [t.id, { zaloName: t.zaloName }]),
480
+ );
481
+ const names = await resolveCurrentUserNames(
482
+ this.api,
483
+ getRecentThreads(-1, "dm").map((t) => String(t.threadId)),
484
+ { aliases: this.userAliases, profiles },
485
+ );
486
+ for (const [id, current] of names) {
487
+ upsertThread({ threadId: id, type: "dm", name: current.name, lastUpdate: 0 });
488
+ }
489
+ }
490
+
491
+ _send590(listener, kind, syncId, ek, ik, req) {
492
+ listener.sendWs(
493
+ {
494
+ version: 1,
495
+ cmd: 590,
496
+ subCmd: 0,
497
+ data: {
498
+ data: {
499
+ syncId,
500
+ syncType: 0,
501
+ ek: b64(ek.publicKey),
502
+ ik: b64(ik.publicKey),
503
+ toDevice: 0,
504
+ tempKey: "",
505
+ deviceName: "zalo-agent-cli",
506
+ req,
507
+ ver: 1,
508
+ ussidx: 0,
509
+ },
510
+ reqId: `req_${kind}_${syncId.slice(0, 6)}`,
511
+ },
512
+ },
513
+ false,
514
+ );
515
+ }
516
+ _dispose(listener, syncId) {
517
+ listener.sendWs(
518
+ { version: 1, cmd: 591, subCmd: 0, data: { data: { syncId, toDevice: 0, reason: 1 }, reqId: "req_disp" } },
519
+ false,
520
+ );
521
+ }
522
+
523
+ /**
524
+ * Run the full restore. Assumes the caller holds the account lock AND has
525
+ * already started the listener: this adds and removes its own socket taps,
526
+ * it never starts or stops the listener itself.
527
+ *
528
+ * @param {object} [opts]
529
+ * @param {number|null} [opts.days=null] only sync the last N days; falsy = full history.
530
+ * @param {string|number} [opts.from] explicit lower bound (date string or epoch ms); beats `days`.
531
+ * @param {number} [opts.shardSize=30] partitions per message round (server caps ~30).
532
+ * @param {number} [opts.waveSize=4] message sessions open at once (Zalo Web uses 4).
533
+ * @param {number} [opts.waitMs=120000] per-phase wait budget.
534
+ * @param {(s: {phase: string, detail?: string}) => void} [opts.onStatus]
535
+ * @param {boolean} [opts.liveStore=true] false when the caller already taps live traffic
536
+ * @param {number|false} [opts.keepAlive] heartbeat interval in ms, or false when the
537
+ * caller already pings this socket for the whole window it owns.
538
+ * @param {() => Promise<boolean>} [opts.reconnect] re-open the listener socket after a
539
+ * drop and resolve true once it is live. Supplied by the caller because this class
540
+ * never starts or stops the listener itself. Without it a dropped socket ends the run.
541
+ * @returns {Promise<{conversations:number, messagesSaved:number, threadsMapped:number, threadsUnmapped:number, reason:string, days:number|null, from:number, confirmed:boolean, resumes:number, rePrompted:boolean}>}
542
+ */
543
+ async restore(opts = {}) {
544
+ const shardSize = Math.min(30, Math.max(1, opts.shardSize || 30));
545
+ const waveSize = Math.min(30, Math.max(1, opts.waveSize || DEFAULT_WAVE_SIZE));
546
+ const waitMs = Math.max(30000, opts.waitMs || 120000);
547
+ const onStatus = typeof opts.onStatus === "function" ? opts.onStatus : () => {};
548
+ const log = (m) => onStatus({ phase: "info", detail: m });
549
+ // The caller announces the window (it also decides the debounce on it);
550
+ // it comes back on the result too, so no status line is emitted here.
551
+ const win = resolveSyncWindow(opts.days, Date.now(), opts.from);
552
+
553
+ onStatus({ phase: "assets", detail: "loading decryption assets" });
554
+ const assets = await ensureAssets(resolve(this.accountDir, "sync", "zproto-cache"), log);
555
+ const { zproto, M, C } = await loadCodecs(assets);
556
+
557
+ onStatus({ phase: "contacts", detail: "reading friend/group lists for thread mapping" });
558
+ const threadMap = await this._buildThreadMap(log);
559
+ const senders = createSenderResolver(this.api, threadMap, { log });
560
+
561
+ initDb(resolve(this.accountDir, "zalo.db"));
562
+ this._refreshThreadNames(threadMap);
563
+ await this._refreshDmNames(threadMap);
564
+
565
+ const L = this.api.listener;
566
+ const sessions = new Map(); // syncId -> {kind, batches:[], statuses:[], done, err}
567
+ const onMsg = async (buf) => {
568
+ if (!(buf instanceof Buffer) || buf.length < 4 || buf.readUInt16LE(1) !== 601) return;
569
+ let parsed;
570
+ try {
571
+ parsed = JSON.parse(buf.subarray(4).toString("utf8"));
572
+ } catch {
573
+ return;
574
+ }
575
+ let d;
576
+ try {
577
+ d =
578
+ typeof parsed.data === "string" && typeof parsed.encrypt === "number"
579
+ ? decodeFrame(parsed, L.cipherKey)
580
+ : parsed;
581
+ } catch {
582
+ return;
583
+ }
584
+ for (const c of d?.data?.controls || []) {
585
+ if (c?.content?.act_type !== "transfer_sync2") continue;
586
+ let dj = c.content.data;
587
+ try {
588
+ dj = JSON.parse(dj);
589
+ } catch {}
590
+ const s = sessions.get(dj?.syncId);
591
+ if (!s) continue;
592
+ if (c.content.act === "transfer_status") {
593
+ s.statuses.push(dj.status);
594
+ if (dj.status === 3)
595
+ onStatus({
596
+ phase: "confirm",
597
+ detail: "Confirm the sync request on your phone (tap ĐỒNG BỘ NGAY)",
598
+ });
599
+ } else if (c.content.act === "upload_batch") {
600
+ s.batches.push(dj);
601
+ for (const sc of dj.scopes || []) if (sc?.partition) s.covered.add(sc.partition);
602
+ if (dj.isLast) s.sawLast = true;
603
+ s.done = isSessionComplete(s);
604
+ } else if (/error/i.test(c.content.act)) {
605
+ s.err = dj;
606
+ }
607
+ }
608
+ };
609
+
610
+ // Zalo Web does not freeze while a sync runs: new messages keep arriving
611
+ // on the same socket and keep being stored. A full-history run holds this
612
+ // socket for many minutes, so without this everything that landed during
613
+ // it was dropped -- a hole precisely where the sync promises completeness.
614
+ // A caller holding the socket across several stages (`zalo-agent sync`)
615
+ // attaches one tap for its whole window and passes liveStore:false, so
616
+ // no live event is stored twice.
617
+ const detachLive =
618
+ opts.liveStore === false
619
+ ? () => {}
620
+ : attachLiveStore(L, (what, detail) =>
621
+ onStatus({
622
+ phase: "live",
623
+ detail: `stored a live ${what}${detail?.threadId ? ` in ${detail.threadId}` : ""}`,
624
+ }),
625
+ );
626
+
627
+ // Why the socket went away matters: Zalo's 3000 means "another session
628
+ // took the account", anything else points elsewhere. Without this the
629
+ // only symptom is a silent stall, which is what made the first two
630
+ // runs so hard to diagnose.
631
+ let closeInfo = null;
632
+ // Declared before the close handler that reads it: the handler reports
633
+ // how long the heartbeat had gone unanswered when the wire died.
634
+ let keeper = null;
635
+ const onClose = (code, reason) => {
636
+ closeInfo = { code, reason: String(reason || "") };
637
+ // A 1006 carries no close frame, so the only thing that can say
638
+ // whether the wire had already gone quiet is our own heartbeat.
639
+ // Zalo echoes every cmd 2/1 straight back, so a ping count well
640
+ // ahead of the echo count is a half-open socket we noticed late --
641
+ // the one piece of evidence a bare 1006 otherwise never leaves.
642
+ const hb = keeper?.stats();
643
+ closeInfo.heartbeat = hb?.sent
644
+ ? `${hb.echoed}/${hb.sent} echoed, last ${Math.round(hb.silentMs / 1000)}s ago`
645
+ : "";
646
+ onStatus({
647
+ phase: "warn",
648
+ detail:
649
+ `socket closed (code ${code}${closeInfo.reason ? ": " + closeInfo.reason : ""})` +
650
+ (closeInfo.heartbeat ? ` — heartbeat ${closeInfo.heartbeat}` : ""),
651
+ });
652
+ };
653
+ const onSockErr = (e) => {
654
+ closeInfo = closeInfo || { code: "error", reason: e?.message || String(e) };
655
+ onStatus({ phase: "warn", detail: `socket error: ${closeInfo.reason}` });
656
+ };
657
+
658
+ // Everything below is attached to the RAW socket, so all of it has to be
659
+ // re-attached after a reconnect -- `L.ws` is a different object then, and
660
+ // zca-js nulls the old one. (`attachLiveStore` taps the Listener, which
661
+ // outlives the socket, so it is deliberately not in here.)
662
+ const attachSocketTaps = () => {
663
+ try {
664
+ L.ws.on("message", onMsg);
665
+ L.ws.on("close", onClose);
666
+ L.ws.on("error", onSockErr);
667
+ } catch {
668
+ /* an older ws shape without these events is not fatal */
669
+ }
670
+ if (opts.keepAlive !== false) {
671
+ keeper = startKeepAlive(L, {
672
+ intervalMs: typeof opts.keepAlive === "number" ? opts.keepAlive : undefined,
673
+ });
674
+ }
675
+ };
676
+ const detachSocketTaps = () => {
677
+ try {
678
+ keeper?.stop();
679
+ } catch {
680
+ /* already stopped */
681
+ }
682
+ keeper = null;
683
+ for (const [ev, fn] of [
684
+ ["message", onMsg],
685
+ ["close", onClose],
686
+ ["error", onSockErr],
687
+ ]) {
688
+ try {
689
+ L.ws?.removeListener?.(ev, fn);
690
+ } catch {
691
+ /* the socket may already be gone */
692
+ }
693
+ }
694
+ };
695
+ attachSocketTaps();
696
+
697
+ /**
698
+ * One reconnect attempt, then re-arm every raw-socket tap on the new
699
+ * wire. The caller owns starting the listener (this class never does),
700
+ * so it supplies `opts.reconnect`; without one a dropped socket stays
701
+ * dropped, exactly as before.
702
+ *
703
+ * @returns {Promise<boolean>} true when a live socket is back
704
+ */
705
+ const reconnect = async () => {
706
+ if (typeof opts.reconnect !== "function") return false;
707
+ detachSocketTaps();
708
+ let ok = false;
709
+ try {
710
+ ok = Boolean(await opts.reconnect());
711
+ } catch (e) {
712
+ onStatus({ phase: "warn", detail: `reconnect failed: ${e?.message || e}` });
713
+ return false;
714
+ }
715
+ if (!ok || !L.ws || L.ws.readyState > 1) return false;
716
+ closeInfo = null;
717
+ attachSocketTaps();
718
+ return true;
719
+ };
720
+
721
+ const newSession = (kind, wantPartitions = []) => {
722
+ const id = randId();
723
+ sessions.set(id, {
724
+ kind,
725
+ batches: [],
726
+ statuses: [],
727
+ done: false,
728
+ sawLast: false,
729
+ err: null,
730
+ disposed: false,
731
+ // Completion is measured by coverage: every partition asked for
732
+ // has to come back in some batch's `scopes`.
733
+ want: new Set(wantPartitions.filter(Boolean)),
734
+ covered: new Set(),
735
+ });
736
+ return id;
737
+ };
738
+
739
+ /**
740
+ * Wait for one session to finish.
741
+ *
742
+ * `isLast` is NOT a reliable end marker -- a captured Zalo Web run ends
743
+ * its final message session with isLast=0 and disposes it anyway. What
744
+ * actually marks a message session complete is that every requested
745
+ * partition has appeared in a batch's `scopes`. The conversation round
746
+ * asks for the empty partition and carries no scopes, so it still falls
747
+ * back to isLast.
748
+ *
749
+ * Returns why it stopped, so the caller can tell "no data" from
750
+ * "the socket died" from "the phone never answered".
751
+ */
752
+ const waitDone = async (id, budgetMs) => {
753
+ const dl = Date.now() + resolveWaitBudget(budgetMs, waitMs);
754
+ const s = sessions.get(id);
755
+ while (!s.done && !s.err && Date.now() < dl) {
756
+ // A closed socket can never deliver the rest, so stop now
757
+ // instead of burning the whole budget waiting on a dead wire.
758
+ // zca-js sets `this.ws = null` on close, so an absent socket is
759
+ // just as dead as one reporting CLOSING/CLOSED -- checking only
760
+ // readyState missed every real disconnect.
761
+ if (!L.ws || L.ws.readyState > 1) return "socket-closed";
762
+ await new Promise((r) => setTimeout(r, 300));
763
+ }
764
+ if (s.err) return "error";
765
+ if (s.done) return "done";
766
+ return "timeout";
767
+ };
768
+
769
+ /** Dispose one session the moment it finishes, as Zalo Web does. */
770
+ const disposeOne = (id) => {
771
+ const s = sessions.get(id);
772
+ if (!s || s.disposed) return;
773
+ s.disposed = true;
774
+ try {
775
+ this._dispose(L, id);
776
+ } catch {
777
+ /* the socket may already be gone; nothing to release */
778
+ }
779
+ };
780
+
781
+ const ik = zproto.generateKeyPair();
782
+ let conversations = 0,
783
+ messagesSaved = 0,
784
+ attachmentsSaved = 0;
785
+ const mappedThreads = new Set(),
786
+ unmappedThreads = new Set();
787
+ /** type name -> count, for the command's summary line. */
788
+ const typeCounts = Object.create(null);
789
+ let reason = "complete";
790
+ // Did the phone actually answer? transfer_status 4 = Confirmed,
791
+ // 5 = Authorized. Needed to tell "empty window" from "never tapped".
792
+ let confirmed = false;
793
+ // Set by the message rounds; read by done(), which can run before them.
794
+ let resumeInfo = { resumes: 0, rePrompted: false };
795
+ const done = (r) =>
796
+ this._result(conversations, messagesSaved, mappedThreads, unmappedThreads, r, {
797
+ days: win.days,
798
+ from: win.from,
799
+ confirmed,
800
+ ...resumeInfo,
801
+ attachmentsSaved,
802
+ typeCounts: { ...typeCounts },
803
+ // Every threadId the conversation round accounted for. Anything
804
+ // cached outside this list is orphaned.
805
+ liveThreadIds: [...mappedThreads, ...unmappedThreads],
806
+ });
807
+
808
+ // decrypt one session's batches -> decoded proto objects
809
+ const eachChunkObj = async (s, ek, protoClass, onObj) => {
810
+ let sessionRecord = null;
811
+ const ordered = s.batches
812
+ .slice()
813
+ .sort((a, b) => (a.batchType === 2 ? -1 : 1) - (b.batchType === 2 ? -1 : 1) || a.idx - b.idx);
814
+ for (const bt of ordered) {
815
+ if (!bt.msgUrl) continue;
816
+ await new Promise((r) => setImmediate(r));
817
+ let blob;
818
+ try {
819
+ const r = await fetch(bt.msgUrl);
820
+ if (!r.ok) continue;
821
+ blob = Buffer.from(await r.arrayBuffer());
822
+ } catch {
823
+ continue;
824
+ }
825
+ for (const chunk of splitChunks(blob)) {
826
+ // Hand the event loop back before each chunk. Decode and
827
+ // store are synchronous and a single shard can carry tens of
828
+ // thousands of messages; zca-js keeps the socket alive with
829
+ // a setInterval ping, and a blocked loop means a missed ping
830
+ // means Zalo drops the connection mid-run. This is the same
831
+ // problem Zalo Web avoids by decoding in a worker thread.
832
+ await new Promise((r) => setImmediate(r));
833
+ try {
834
+ let plain;
835
+ if (bt.batchType === 2) {
836
+ const m = zproto.decryptMetadata(chunk, ik.publicKey, ik.privateKey, ek.privateKey);
837
+ sessionRecord = m.sessionRecord;
838
+ plain = m.plaintext;
839
+ } else {
840
+ if (!sessionRecord) continue;
841
+ plain = zproto.decryptMessage(chunk, sessionRecord).plaintext;
842
+ }
843
+ let obj;
844
+ try {
845
+ obj = protoClass.deserializeBinary(decompress(plain)).toObject();
846
+ } catch {
847
+ continue;
848
+ }
849
+ await onObj(obj);
850
+ } catch {
851
+ /* skip bad chunk */
852
+ }
853
+ }
854
+ }
855
+ };
856
+
857
+ try {
858
+ await new Promise((r) => setTimeout(r, 1200));
859
+
860
+ // ---- conversation round ----
861
+ // `ek` is fresh per session and `ik` is stable across them (see
862
+ // FINDINGS.md § cmd 590 request envelope), so a retried round needs
863
+ // its OWN ek -- and the decrypt then has to use that one.
864
+ let ekConv = zproto.generateKeyPair();
865
+ let convId = newSession("conv");
866
+ onStatus({ phase: "conversation", detail: "requesting your conversation list" });
867
+ this._send590(L, "conv", convId, ekConv, ik, {
868
+ type: "conversation",
869
+ priority: 0,
870
+ batchSize: 2000,
871
+ queries: [{ partition: "", from: win.from, to: win.to, limit: 2147483647 }],
872
+ });
873
+ let convWhy = await waitDone(convId, waitMs);
874
+ let convSession = sessions.get(convId);
875
+ confirmed = convSession.statuses.some((st) => Number(st) >= 4);
876
+
877
+ // A socket that dies here loses the conversation list outright --
878
+ // it only ever arrives on the socket that asked for it. Reconnect
879
+ // and ask again rather than ending the run: if the phone already
880
+ // confirmed, the server carries that authorization and the resent
881
+ // round goes straight through; if it had not, the prompt the user
882
+ // sees is the one a manual re-run would have shown them anyway.
883
+ if (convWhy === "socket-closed" && (await reconnect())) {
884
+ onStatus({
885
+ phase: "reconnect",
886
+ detail: confirmed
887
+ ? "reconnected — asking for your conversation list again (your phone already confirmed)"
888
+ : "reconnected — asking for your conversation list again; your phone may prompt once more",
889
+ });
890
+ const retryId = newSession("conv");
891
+ ekConv = zproto.generateKeyPair();
892
+ this._send590(L, "conv", retryId, ekConv, ik, {
893
+ type: "conversation",
894
+ priority: 0,
895
+ batchSize: 2000,
896
+ queries: [{ partition: "", from: win.from, to: win.to, limit: 2147483647 }],
897
+ });
898
+ convWhy = await waitDone(retryId, waitMs);
899
+ convSession = sessions.get(retryId);
900
+ convId = retryId;
901
+ confirmed = confirmed || convSession.statuses.some((st) => Number(st) >= 4);
902
+ }
903
+
904
+ if (convSession.err) throw new Error(`conversation round failed: ${JSON.stringify(convSession.err)}`);
905
+ if (convWhy === "socket-closed") {
906
+ throw new Error(
907
+ confirmed
908
+ ? "the connection dropped after your phone confirmed, before the conversation list arrived"
909
+ : "the connection dropped while waiting for your phone to confirm — re-run and you will be prompted again",
910
+ );
911
+ }
912
+ if (convWhy === "timeout" && !confirmed) {
913
+ throw new Error(
914
+ `your phone did not answer the sync prompt within ${Math.round(waitMs / 1000)}s — the connection stayed up, so nothing was lost; re-run and confirm the prompt`,
915
+ );
916
+ }
917
+
918
+ const convs = [];
919
+ await eachChunkObj(convSession, ekConv, C.SyncChunk, (obj) => {
920
+ for (const c of obj.conversationsList || []) convs.push(c);
921
+ });
922
+ // Zalo Web releases the conversation session as soon as it has the
923
+ // list, before asking for any messages. Match that: it clears the
924
+ // phone's banner for that round instead of holding it open.
925
+ disposeOne(convId);
926
+ conversations = convs.length;
927
+ // The conversation round carries per-thread state the message
928
+ // rounds never repeat (whether you have replied, and the ids of the
929
+ // newest message). Keep it keyed by the opaque convId so the
930
+ // message loop can attach it once the real threadId is known.
931
+ const convMeta = new Map();
932
+ for (const c of convs) {
933
+ convMeta.set(c.convId, {
934
+ respondedByMe: c.respondedByMe,
935
+ lastGlobalId: c.lastGlobalId,
936
+ lastClientId: c.lastClientId,
937
+ lastTs: Number(c.lastTs) || 0,
938
+ });
939
+ }
940
+ if (!conversations) {
941
+ // With --days an empty result is expected when nothing happened
942
+ // in the window, so separate that from a prompt that was never
943
+ // confirmed — the two need opposite advice from the caller.
944
+ reason = confirmed ? "empty-window" : "no-conversations";
945
+ // The phone answered and had nothing for this window: that IS
946
+ // the window settled. Only an unconfirmed prompt is a non-result.
947
+ if (confirmed) recordRestoreSuccess(win, { resolveGaps: true });
948
+ return done(reason);
949
+ }
950
+
951
+ // Tier 3: resolve 1-1 conversations not in the friend list (non-friends, OA) to
952
+ // real ids + names via /api/gid/decrypt — the same fallback Zalo Web uses. Left
953
+ // groups have no per-item endpoint, so they stay opaque (as in Zalo Web).
954
+ const unresolved = convs.filter((c) => c.convType !== 2 && !threadMap.has(c.convId)).map((c) => c.convId);
955
+ if (unresolved.length) {
956
+ onStatus({ phase: "resolve", detail: `resolving ${unresolved.length} non-friend conversation(s)` });
957
+ try {
958
+ const extra = await resolveNonFriendDms(this.api, unresolved, log);
959
+ for (const [gid, v] of extra)
960
+ threadMap.set(gid, {
961
+ id: v.id,
962
+ name: currentUserName(v.id, { zaloName: v.zaloName }, this.userAliases).name,
963
+ zaloName: v.zaloName || "",
964
+ snapshotName: v.name,
965
+ type: "dm",
966
+ });
967
+ this._refreshThreadNames(threadMap);
968
+ onStatus({
969
+ phase: "resolve",
970
+ detail: `resolved ${extra.size}/${unresolved.length} via gid/decrypt`,
971
+ });
972
+ } catch (e) {
973
+ log(`tier-3 resolve failed (${e.message})`);
974
+ }
975
+ }
976
+
977
+ // `to` is per conversation, not a global bound. Zalo Web sends each
978
+ // partition its own conversation's `lastTs` -- a capture of one run
979
+ // shows 30 distinct `to` values across 30 partitions -- and asks for
980
+ // an unbounded `to` only on the conversation round, where it does
981
+ // not yet know what the latest message is. Sending MAX_SAFE_INTEGER
982
+ // per partition asks the phone to scan to the year 285428 for a
983
+ // conversation that has been quiet since 2024.
984
+ const askedTo = Math.min(win.to, Date.now());
985
+ const partitions = convs.map((c) => {
986
+ const lastTs = Number(c.lastTs) || 0;
987
+ return {
988
+ partition: (c.convType === 2 ? "group/" : "oneone/") + c.convId,
989
+ from: win.from,
990
+ // Never past what the caller asked for, and never past now.
991
+ to: lastTs > 0 ? Math.min(lastTs, askedTo) : askedTo,
992
+ limit: 2147483647,
993
+ };
994
+ });
995
+ const shards = [];
996
+ for (let i = 0; i < partitions.length; i += shardSize) shards.push(partitions.slice(i, i + shardSize));
997
+ onStatus({ phase: "messages", detail: `${conversations} conversations in ${shards.length} batch(es)` });
998
+
999
+ // ---- message rounds (sharded) ----
1000
+ // Requests go out in waves. Zalo Web opens at most FOUR message
1001
+ // sessions at once and the phone serves them one at a time; firing
1002
+ // all fifty shards of a full-history run at once got the socket
1003
+ // dropped with no error frame, so the in-flight count is capped.
1004
+ // Within a wave the requests still go out together, which is what
1005
+ // makes them inherit the single confirmation.
1006
+ const sendWave = async (wave) => {
1007
+ const meta = [];
1008
+ for (const shard of wave) {
1009
+ const ek = zproto.generateKeyPair();
1010
+ const sid = newSession(
1011
+ "msg",
1012
+ shard.map((q) => q.partition),
1013
+ );
1014
+ meta.push({ sid, ek });
1015
+ this._send590(L, "msg", sid, ek, ik, {
1016
+ type: "message",
1017
+ priority: 2,
1018
+ batchSize: 2000,
1019
+ queries: shard,
1020
+ });
1021
+ await new Promise((r) => setTimeout(r, 600));
1022
+ }
1023
+ return meta;
1024
+ };
1025
+
1026
+ // One budget for the whole run, not one per shard: a per-shard
1027
+ // budget multiplies (50 shards x 10 min = eight hours of waiting on
1028
+ // a phone that already went quiet). It scales with the shard count
1029
+ // because the phone serves them one at a time -- a full-history run
1030
+ // is 50 shards and genuinely needs longer than a one-shard run --
1031
+ // and a dropped socket aborts immediately regardless, so a long
1032
+ // budget costs nothing when something actually breaks.
1033
+ const shardBudget = (n) => Math.max(waitMs, n * PER_SHARD_BUDGET_MS);
1034
+ let runDeadline = Date.now() + shardBudget(shards.length);
1035
+ onStatus({
1036
+ phase: "messages",
1037
+ detail: `waiting up to ${Math.round(shardBudget(shards.length) / 60000)} min for the phone to serve ${shards.length} batch(es)`,
1038
+ });
1039
+ let finished = 0;
1040
+ let socketDied = false;
1041
+ let timedOut = false;
1042
+ let stop = false;
1043
+ let rePrompted = false;
1044
+ // A reconnect is only on the table when the caller handed us a way
1045
+ // to reconnect -- this class never starts the listener itself.
1046
+ const schedule = createShardSchedule(shards.length, {
1047
+ waveSize,
1048
+ maxResumes: typeof opts.reconnect === "function" ? MAX_RESUMES : 0,
1049
+ });
1050
+
1051
+ // ---- wave by wave: send, wait, decrypt, decode, store ----
1052
+ // Storing per shard rather than after all of them means an
1053
+ // interrupted run keeps what it already pulled.
1054
+ while (!schedule.done() && !stop) {
1055
+ const wave = schedule.nextWave();
1056
+ const waveMeta = await sendWave(wave.map((i) => shards[i]));
1057
+ let lostSocket = false;
1058
+ for (let k = 0; k < waveMeta.length; k++) {
1059
+ const m = waveMeta[k];
1060
+ const left = runDeadline - Date.now();
1061
+ const why = left > 0 ? await waitDone(m.sid, left) : "timeout";
1062
+ if (why === "socket-closed") {
1063
+ lostSocket = true;
1064
+ break;
1065
+ }
1066
+ if (why === "timeout") {
1067
+ stop = true;
1068
+ timedOut = true;
1069
+ onStatus({
1070
+ phase: "warn",
1071
+ detail: `timed out after ${finished}/${shards.length} batch(es) — keeping what arrived`,
1072
+ });
1073
+ break;
1074
+ }
1075
+ // Served or refused, this shard is settled: a resume must
1076
+ // not ask the phone for it again.
1077
+ schedule.settle(wave[k]);
1078
+ // A message session that was prompted (status 3) rather than
1079
+ // authorized outright (5) cost the user a second tap.
1080
+ if (schedule.resumes() && sessions.get(m.sid).statuses.some((st) => Number(st) === 3)) {
1081
+ rePrompted = true;
1082
+ }
1083
+ if (why === "error") {
1084
+ onStatus({ phase: "warn", detail: `batch failed: ${JSON.stringify(sessions.get(m.sid).err)}` });
1085
+ continue;
1086
+ }
1087
+
1088
+ const before = messagesSaved;
1089
+ await eachChunkObj(sessions.get(m.sid), m.ek, M.SyncChunk, async (obj) => {
1090
+ // Network identity lookups must finish before opening
1091
+ // the synchronous SQLite transaction for this chunk.
1092
+ await senders.prepare((obj.partitionsList || []).flatMap((p) => p.messagesList || []));
1093
+ // One transaction per decoded chunk rather than one per
1094
+ // row: thousands of individual WAL commits is both slow
1095
+ // and a long block on the event loop.
1096
+ runInTransaction(() => {
1097
+ for (const part of obj.partitionsList || []) {
1098
+ const gid = /^(?:oneone|group)\/(.+)$/.exec(part.id)?.[1];
1099
+ const hit = gid && threadMap.get(gid);
1100
+ const isGroup = part.id.startsWith("group/");
1101
+ const threadId = hit ? hit.id : part.id;
1102
+ (hit ? mappedThreads : unmappedThreads).add(threadId);
1103
+ const cm = (gid && convMeta.get(gid)) || {};
1104
+ for (const msg of part.messagesList || []) {
1105
+ // The payload's numeric msgType + meta decide the row;
1106
+ // `content` is always a string, so it cannot.
1107
+ const info = classifySyncMessage(msg);
1108
+ const threadType = hit ? hit.type : isGroup ? "group" : "dm";
1109
+ try {
1110
+ upsertThread({
1111
+ threadId,
1112
+ type: threadType,
1113
+ // The partition prefix is the phone's own
1114
+ // classification: authoritative when the
1115
+ // thread map agrees, so it can heal a 1-1 a
1116
+ // pin notice once turned into a "group".
1117
+ authoritative: threadType === (isGroup ? "group" : "dm"),
1118
+ name: hit ? hit.name : "",
1119
+ lastUpdate: Number(msg.timestamp) || 0,
1120
+ sync_timestamp: Date.now(),
1121
+ respondedByMe: cm.respondedByMe,
1122
+ lastGlobalId: cm.lastGlobalId,
1123
+ lastClientId: cm.lastClientId,
1124
+ });
1125
+ // The listener stored this system line under a
1126
+ // placeholder id (a group event carries no
1127
+ // message id); the phone's row replaces it.
1128
+ if (info.type === "group_event") {
1129
+ replaceLiveGroupEventPlaceholder(threadId, Number(msg.timestamp) || 0);
1130
+ }
1131
+ insertMessage({
1132
+ // jspb renders an unset uint64 as
1133
+ // the STRING "0", which is truthy,
1134
+ // so `globalId || clientId` kept it
1135
+ // and every message without a
1136
+ // global id collided on the primary
1137
+ // key "0", overwriting each other.
1138
+ // 0 means absent here, exactly as
1139
+ // it does in a removal's
1140
+ // globalDelMsgId and a reaction's
1141
+ // gMsgID.
1142
+ msgId: syncMsgId(msg),
1143
+ threadId,
1144
+ senderId: senders.get(msg.senderId).id,
1145
+ senderName: senders.get(msg.senderId).name,
1146
+ text: info.text,
1147
+ timestamp: Number(msg.timestamp) || 0,
1148
+ type: info.type,
1149
+ raw_data: info.raw,
1150
+ has_attachment: info.hasAttachment,
1151
+ // The phone is the only source of
1152
+ // delivery/read state, and this was
1153
+ // parsed and then dropped on the way
1154
+ // to the column: 87k rows carried a
1155
+ // real status inside raw_data while
1156
+ // the column stayed NULL on all of
1157
+ // them.
1158
+ msgStatus: info.raw?.msgStatus,
1159
+ });
1160
+ messagesSaved++;
1161
+ if (info.hasAttachment) attachmentsSaved++;
1162
+ typeCounts[info.type] = (typeCounts[info.type] || 0) + 1;
1163
+ } catch {
1164
+ /* dedupe/constraint — keep going */
1165
+ }
1166
+ }
1167
+ }
1168
+ });
1169
+ });
1170
+
1171
+ finished++;
1172
+ // Per-shard progress: without it a 50-shard run prints nothing
1173
+ // between "50 batch(es)" and the final total, so a stall looks
1174
+ // exactly like work in progress.
1175
+ onStatus({
1176
+ phase: "progress",
1177
+ detail: `batch ${finished}/${shards.length} — ${messagesSaved - before} new message(s), ${messagesSaved} total`,
1178
+ });
1179
+ }
1180
+
1181
+ if (!lostSocket) continue;
1182
+ socketDied = true;
1183
+ onStatus({
1184
+ phase: "warn",
1185
+ detail:
1186
+ `connection lost after ${finished}/${shards.length} batch(es) — keeping what arrived` +
1187
+ (closeInfo
1188
+ ? ` [close ${closeInfo.code}${closeInfo.reason ? ": " + closeInfo.reason : ""}]`
1189
+ : " [no close event seen]"),
1190
+ });
1191
+ // Re-tapping the phone is the expensive part of this command, so
1192
+ // a dropped wire is worth one reconnect before giving the tap
1193
+ // up. The shards already served stay served; only what is still
1194
+ // pending goes out again. Worst case the phone prompts once more
1195
+ // -- which is exactly what a manual re-run would have cost, and
1196
+ // that run would have had to re-fetch everything as well.
1197
+ if (schedule.useResume() && (await reconnect())) {
1198
+ socketDied = false;
1199
+ // The remaining shards still need their own time; the
1200
+ // reconnect must not eat the budget they were owed.
1201
+ runDeadline = Date.now() + shardBudget(schedule.remaining());
1202
+ onStatus({
1203
+ phase: "reconnect",
1204
+ detail: `reconnected — re-requesting the ${schedule.remaining()} batch(es) that never arrived (attempt ${schedule.resumes()} of ${MAX_RESUMES})`,
1205
+ });
1206
+ continue;
1207
+ }
1208
+ stop = true;
1209
+ }
1210
+ if (rePrompted) {
1211
+ onStatus({
1212
+ phase: "warn",
1213
+ detail:
1214
+ "the resumed request needed a fresh confirmation — " +
1215
+ "the reconnect did not inherit the first one",
1216
+ });
1217
+ }
1218
+ resumeInfo = { resumes: schedule.resumes(), rePrompted };
1219
+ const outcome = describeRestoreOutcome({
1220
+ socketDied,
1221
+ timedOut,
1222
+ confirmed,
1223
+ messagesSaved,
1224
+ finished,
1225
+ total: shards.length,
1226
+ resumes: schedule.resumes(),
1227
+ waitMs,
1228
+ });
1229
+ if (outcome.error) throw new Error(outcome.error);
1230
+ reason = outcome.reason;
1231
+ // A partial run still records success (unchanged), so the next run
1232
+ // within the hour is skipped unless --force -- but it settles no gap.
1233
+ recordRestoreSuccess(win, { resolveGaps: reason === "complete" });
1234
+ } finally {
1235
+ for (const id of sessions.keys()) {
1236
+ try {
1237
+ this._dispose(L, id);
1238
+ } catch {}
1239
+ }
1240
+ await new Promise((r) => setTimeout(r, 1500));
1241
+ detachSocketTaps();
1242
+ try {
1243
+ detachLive();
1244
+ } catch {}
1245
+ }
1246
+ return done(reason);
1247
+ }
1248
+
1249
+ _result(conversations, messagesSaved, mapped, unmapped, reason, extra = {}) {
1250
+ return {
1251
+ conversations,
1252
+ messagesSaved,
1253
+ threadsMapped: mapped.size,
1254
+ threadsUnmapped: unmapped.size,
1255
+ reason,
1256
+ ...extra,
1257
+ };
1258
+ }
1259
+ }