@mtkruto/node 0.67.1 → 0.68.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 (355) hide show
  1. package/esm/0_errors.js +2 -6
  2. package/esm/3_errors.js +2 -12
  3. package/esm/3_transport.d.ts +3 -3
  4. package/esm/3_transport.js +3 -3
  5. package/esm/3_types.d.ts +8 -7
  6. package/esm/3_types.d.ts.map +1 -1
  7. package/esm/3_types.js +8 -7
  8. package/esm/4_errors.js +2 -12
  9. package/esm/_dnt.polyfills.d.ts +99 -0
  10. package/esm/_dnt.polyfills.d.ts.map +1 -1
  11. package/esm/_dnt.polyfills.js +127 -1
  12. package/esm/_dnt.test_polyfills.d.ts.map +1 -0
  13. package/esm/client/0_filters_test.d.ts.map +1 -1
  14. package/esm/client/0_markdown_test.d.ts.map +1 -1
  15. package/esm/client/0_params.d.ts +2 -0
  16. package/esm/client/0_params.d.ts.map +1 -1
  17. package/esm/client/0_password.d.ts +5 -5
  18. package/esm/client/0_password.d.ts.map +1 -1
  19. package/esm/client/0_password_test.d.ts.map +1 -1
  20. package/esm/client/0_storage_operations.js +143 -155
  21. package/esm/client/0_storage_operations_test.d.ts.map +1 -1
  22. package/esm/client/0_utilities.d.ts +1 -1
  23. package/esm/client/0_utilities_test.d.ts.map +1 -1
  24. package/esm/client/1_client_plain.js +4 -22
  25. package/esm/client/1_composer.js +8 -21
  26. package/esm/client/2_account_manager.js +85 -97
  27. package/esm/client/2_bot_info_manager.js +26 -38
  28. package/esm/client/2_business_connection_manager.js +10 -23
  29. package/esm/client/2_client_encrypted.js +194 -211
  30. package/esm/client/2_file_manager.d.ts +4 -3
  31. package/esm/client/2_file_manager.d.ts.map +1 -1
  32. package/esm/client/2_file_manager.js +268 -224
  33. package/esm/client/2_file_manager_test.d.ts.map +1 -1
  34. package/esm/client/2_network_statistics_manager.js +8 -21
  35. package/esm/client/2_payment_manager.js +7 -20
  36. package/esm/client/2_reaction_manager.js +7 -20
  37. package/esm/client/2_translations_manager.js +97 -107
  38. package/esm/client/2_update_manager.js +764 -759
  39. package/esm/client/3_client_encrypted_pool.js +10 -26
  40. package/esm/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  41. package/esm/client/3_message_manager.d.ts +1 -1
  42. package/esm/client/3_message_manager.js +441 -448
  43. package/esm/client/3_message_manager_test.d.ts.map +1 -1
  44. package/esm/client/3_video_chat_manager.d.ts +1 -1
  45. package/esm/client/3_video_chat_manager.js +57 -68
  46. package/esm/client/4_callback_query_manager.js +18 -30
  47. package/esm/client/4_chat_list_manager.js +322 -318
  48. package/esm/client/4_chat_manager.js +118 -131
  49. package/esm/client/4_forum_manager.js +67 -73
  50. package/esm/client/4_gift_manager.js +16 -29
  51. package/esm/client/4_inline_query_manager.js +16 -28
  52. package/esm/client/4_link_preview_manager.js +6 -19
  53. package/esm/client/4_poll_manager.js +44 -57
  54. package/esm/client/4_story_manager.js +41 -53
  55. package/esm/client/5_client.d.ts +7 -0
  56. package/esm/client/5_client.d.ts.map +1 -1
  57. package/esm/client/5_client.js +1271 -1290
  58. package/esm/connection/1_connection_tcp.node.js +48 -65
  59. package/esm/connection/1_connection_web_socket.js +75 -91
  60. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  61. package/esm/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
  62. package/esm/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
  63. package/esm/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
  64. package/esm/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  65. package/esm/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
  66. package/esm/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
  68. package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
  69. package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
  70. package/esm/deps/jsr.io/@std/internal/1.0.10/format.js +70 -0
  71. package/esm/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
  73. package/esm/mod.js +2 -12
  74. package/esm/session/0_session_state.js +12 -38
  75. package/esm/session/1_session.js +49 -72
  76. package/esm/session/2_session_encrypted.js +324 -320
  77. package/esm/storage/1_utilities_test.d.ts.map +1 -1
  78. package/esm/storage/2_storage_indexed_db.js +26 -44
  79. package/esm/storage/2_storage_local_storage.node.js +12 -25
  80. package/esm/storage/2_storage_memory.js +24 -41
  81. package/esm/storage/2_storage_session_storage.js +3 -16
  82. package/esm/tl/0_utilities_test.d.ts.map +1 -1
  83. package/esm/tl/1_tl_reader.js +80 -88
  84. package/esm/tl/1_tl_reader_test.d.ts.map +1 -1
  85. package/esm/tl/1_tl_writer.js +155 -164
  86. package/esm/tl/1_tl_writer_test.d.ts.map +1 -1
  87. package/esm/tl/2_telegram.d.ts +9 -10
  88. package/esm/tl/2_telegram.d.ts.map +1 -1
  89. package/esm/tl/2_telegram.js +10 -10
  90. package/esm/transport/0_transport.js +1 -8
  91. package/esm/transport/1_transport_abridged.js +11 -24
  92. package/esm/transport/1_transport_intermediate.js +10 -23
  93. package/{script/transport/2_transport_provider.d.ts → esm/transport/1_transport_provider.d.ts} +1 -1
  94. package/esm/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
  95. package/{script/transport/3_transport_provider_tcp.d.ts → esm/transport/2_transport_provider_tcp.d.ts} +2 -2
  96. package/esm/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
  97. package/esm/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +1 -1
  98. package/esm/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
  99. package/esm/transport/2_transport_provider_web_socket.d.ts.map +1 -0
  100. package/esm/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +1 -1
  101. package/esm/types/0_upload_progress.d.ts +29 -0
  102. package/esm/types/0_upload_progress.d.ts.map +1 -0
  103. package/esm/types/0_upload_progress.js +20 -0
  104. package/esm/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
  105. package/esm/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
  106. package/esm/types/1_sticker.d.ts +1 -1
  107. package/esm/types/1_sticker.d.ts.map +1 -1
  108. package/esm/types/2_chat.d.ts.map +1 -1
  109. package/esm/types/2_poll_answer.d.ts +19 -0
  110. package/esm/types/2_poll_answer.d.ts.map +1 -1
  111. package/esm/types/2_poll_answer.js +19 -0
  112. package/esm/types/2_pre_checkout_query.d.ts.map +1 -1
  113. package/esm/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
  114. package/esm/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
  115. package/esm/types/{3_reply_markup.js → 2_reply_markup.js} +1 -1
  116. package/esm/types/2_story_interactive_area.d.ts.map +1 -1
  117. package/esm/types/3_chat_member_updated.d.ts.map +1 -1
  118. package/esm/types/3_story.d.ts.map +1 -1
  119. package/esm/types/5_message.d.ts +1 -1
  120. package/esm/types/5_message.d.ts.map +1 -1
  121. package/esm/types/5_message.js +1 -1
  122. package/esm/types/6_inline_query_result.d.ts +1 -1
  123. package/esm/types/6_inline_query_result.js +1 -1
  124. package/esm/types/7_update.d.ts +21 -2
  125. package/esm/types/7_update.d.ts.map +1 -1
  126. package/esm/utilities/0_bigint_test.d.ts.map +1 -1
  127. package/esm/utilities/0_buffer.d.ts +1 -1
  128. package/esm/utilities/0_buffer.d.ts.map +1 -1
  129. package/esm/utilities/0_buffer_test.d.ts.map +1 -1
  130. package/esm/utilities/0_hash.d.ts +2 -2
  131. package/esm/utilities/0_hash.d.ts.map +1 -1
  132. package/esm/utilities/0_mutex.js +4 -19
  133. package/esm/utilities/0_part_stream.js +11 -25
  134. package/esm/utilities/0_part_stream_test.d.ts.map +1 -1
  135. package/esm/utilities/0_rle.d.ts +2 -2
  136. package/esm/utilities/0_rle.d.ts.map +1 -1
  137. package/esm/utilities/0_rle_test.d.ts.map +1 -1
  138. package/esm/utilities/0_text.d.ts +20 -1
  139. package/esm/utilities/0_text.d.ts.map +1 -1
  140. package/esm/utilities/0_text.js +19 -0
  141. package/esm/utilities/1_auth.d.ts +1 -1
  142. package/esm/utilities/1_auth.d.ts.map +1 -1
  143. package/esm/utilities/1_base64.d.ts +1 -1
  144. package/esm/utilities/1_base64.d.ts.map +1 -1
  145. package/esm/utilities/1_base64_test.d.ts.map +1 -1
  146. package/esm/utilities/1_crypto.js +42 -53
  147. package/esm/utilities/1_crypto_test.d.ts.map +1 -1
  148. package/esm/utilities/1_logger.d.ts +2 -2
  149. package/esm/utilities/1_math_test.d.ts.map +1 -1
  150. package/esm/utilities/2_queue.js +29 -47
  151. package/package.json +1 -1
  152. package/script/0_errors.js +2 -6
  153. package/script/2_tl.js +17 -7
  154. package/script/3_errors.js +2 -12
  155. package/script/3_transport.d.ts +3 -3
  156. package/script/3_transport.js +3 -3
  157. package/script/3_types.d.ts +8 -7
  158. package/script/3_types.d.ts.map +1 -1
  159. package/script/3_types.js +8 -7
  160. package/script/4_constants.js +17 -7
  161. package/script/4_errors.js +2 -12
  162. package/script/_dnt.polyfills.d.ts +99 -0
  163. package/script/_dnt.polyfills.d.ts.map +1 -1
  164. package/script/_dnt.polyfills.js +128 -0
  165. package/script/_dnt.test_polyfills.d.ts.map +1 -0
  166. package/script/client/0_filters_test.d.ts.map +1 -1
  167. package/script/client/0_markdown_test.d.ts.map +1 -1
  168. package/script/client/0_params.d.ts +2 -0
  169. package/script/client/0_params.d.ts.map +1 -1
  170. package/script/client/0_password.d.ts +5 -5
  171. package/script/client/0_password.d.ts.map +1 -1
  172. package/script/client/0_password.js +17 -7
  173. package/script/client/0_password_test.d.ts.map +1 -1
  174. package/script/client/0_storage_operations.js +143 -155
  175. package/script/client/0_storage_operations_test.d.ts.map +1 -1
  176. package/script/client/0_utilities.d.ts +1 -1
  177. package/script/client/0_utilities_test.d.ts.map +1 -1
  178. package/script/client/1_client_plain.js +4 -22
  179. package/script/client/1_composer.js +8 -21
  180. package/script/client/2_account_manager.js +85 -97
  181. package/script/client/2_bot_info_manager.js +26 -38
  182. package/script/client/2_business_connection_manager.js +10 -23
  183. package/script/client/2_client_encrypted.js +195 -212
  184. package/script/client/2_file_manager.d.ts +4 -3
  185. package/script/client/2_file_manager.d.ts.map +1 -1
  186. package/script/client/2_file_manager.js +285 -231
  187. package/script/client/2_file_manager_test.d.ts.map +1 -1
  188. package/script/client/2_network_statistics_manager.js +8 -21
  189. package/script/client/2_payment_manager.js +7 -20
  190. package/script/client/2_reaction_manager.js +7 -20
  191. package/script/client/2_translations_manager.js +98 -108
  192. package/script/client/2_update_manager.js +764 -759
  193. package/script/client/3_client_encrypted_pool.js +10 -26
  194. package/script/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  195. package/script/client/3_message_manager.d.ts +1 -1
  196. package/script/client/3_message_manager.js +441 -448
  197. package/script/client/3_message_manager_test.d.ts.map +1 -1
  198. package/script/client/3_video_chat_manager.d.ts +1 -1
  199. package/script/client/3_video_chat_manager.js +57 -68
  200. package/script/client/4_callback_query_manager.js +18 -30
  201. package/script/client/4_chat_list_manager.js +322 -318
  202. package/script/client/4_chat_manager.js +118 -131
  203. package/script/client/4_forum_manager.js +67 -73
  204. package/script/client/4_gift_manager.js +16 -29
  205. package/script/client/4_inline_query_manager.js +16 -28
  206. package/script/client/4_link_preview_manager.js +6 -19
  207. package/script/client/4_poll_manager.js +44 -57
  208. package/script/client/4_story_manager.js +41 -53
  209. package/script/client/5_client.d.ts +7 -0
  210. package/script/client/5_client.d.ts.map +1 -1
  211. package/script/client/5_client.js +1271 -1290
  212. package/script/connection/1_connection_tcp.node.js +48 -65
  213. package/script/connection/1_connection_web_socket.js +92 -98
  214. package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  215. package/script/deps/jsr.io/@std/assert/1.0.13/equal.js +17 -7
  216. package/script/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
  217. package/script/deps/jsr.io/@std/async/1.0.13/delay.js +17 -7
  218. package/script/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
  219. package/script/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
  220. package/script/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  221. package/script/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
  222. package/script/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
  223. package/script/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
  224. package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
  225. package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
  226. package/script/deps/jsr.io/@std/internal/1.0.10/format.js +106 -0
  227. package/script/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
  228. package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +17 -7
  229. package/script/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
  230. package/script/deps/jsr.io/@std/path/1.1.0/_os.js +17 -7
  231. package/script/mod.js +19 -19
  232. package/script/session/0_session_state.js +12 -38
  233. package/script/session/1_session.js +66 -79
  234. package/script/session/2_session_encrypted.js +325 -321
  235. package/script/storage/1_utilities_test.d.ts.map +1 -1
  236. package/script/storage/2_storage_indexed_db.js +26 -44
  237. package/script/storage/2_storage_local_storage.node.js +12 -25
  238. package/script/storage/2_storage_memory.js +24 -41
  239. package/script/storage/2_storage_session_storage.js +3 -16
  240. package/script/tl/0_utilities_test.d.ts.map +1 -1
  241. package/script/tl/1_tl_reader.js +81 -89
  242. package/script/tl/1_tl_reader_test.d.ts.map +1 -1
  243. package/script/tl/1_tl_writer.js +156 -165
  244. package/script/tl/1_tl_writer_test.d.ts.map +1 -1
  245. package/script/tl/2_telegram.d.ts +9 -10
  246. package/script/tl/2_telegram.d.ts.map +1 -1
  247. package/script/tl/2_telegram.js +32 -10
  248. package/script/transport/0_obfuscation.js +17 -7
  249. package/script/transport/0_transport.js +1 -8
  250. package/script/transport/1_transport_abridged.js +11 -24
  251. package/script/transport/1_transport_intermediate.js +10 -23
  252. package/{esm/transport/2_transport_provider.d.ts → script/transport/1_transport_provider.d.ts} +1 -1
  253. package/script/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
  254. package/{esm/transport/3_transport_provider_tcp.d.ts → script/transport/2_transport_provider_tcp.d.ts} +2 -2
  255. package/script/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
  256. package/script/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +3 -3
  257. package/script/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
  258. package/script/transport/2_transport_provider_web_socket.d.ts.map +1 -0
  259. package/script/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +2 -2
  260. package/script/types/0_upload_progress.d.ts +29 -0
  261. package/script/types/0_upload_progress.d.ts.map +1 -0
  262. package/script/types/0_upload_progress.js +21 -0
  263. package/script/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
  264. package/script/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
  265. package/script/types/1_sticker.d.ts +1 -1
  266. package/script/types/1_sticker.d.ts.map +1 -1
  267. package/script/types/2_chat.d.ts.map +1 -1
  268. package/script/types/2_poll_answer.d.ts +19 -0
  269. package/script/types/2_poll_answer.d.ts.map +1 -1
  270. package/script/types/2_poll_answer.js +19 -0
  271. package/script/types/2_pre_checkout_query.d.ts.map +1 -1
  272. package/script/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
  273. package/script/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
  274. package/script/types/{3_reply_markup.js → 2_reply_markup.js} +3 -3
  275. package/script/types/2_story_interactive_area.d.ts.map +1 -1
  276. package/script/types/3_chat_member_updated.d.ts.map +1 -1
  277. package/script/types/3_story.d.ts.map +1 -1
  278. package/script/types/5_message.d.ts +1 -1
  279. package/script/types/5_message.d.ts.map +1 -1
  280. package/script/types/5_message.js +2 -2
  281. package/script/types/6_inline_query_result.d.ts +1 -1
  282. package/script/types/6_inline_query_result.js +4 -4
  283. package/script/types/7_update.d.ts +21 -2
  284. package/script/types/7_update.d.ts.map +1 -1
  285. package/script/utilities/0_bigint.js +17 -7
  286. package/script/utilities/0_bigint_test.d.ts.map +1 -1
  287. package/script/utilities/0_buffer.d.ts +1 -1
  288. package/script/utilities/0_buffer.d.ts.map +1 -1
  289. package/script/utilities/0_buffer_test.d.ts.map +1 -1
  290. package/script/utilities/0_env.js +17 -7
  291. package/script/utilities/0_hash.d.ts +2 -2
  292. package/script/utilities/0_hash.d.ts.map +1 -1
  293. package/script/utilities/0_hash.js +17 -7
  294. package/script/utilities/0_misc.js +17 -7
  295. package/script/utilities/0_mutex.js +4 -19
  296. package/script/utilities/0_part_stream.js +11 -25
  297. package/script/utilities/0_part_stream_test.d.ts.map +1 -1
  298. package/script/utilities/0_rle.d.ts +2 -2
  299. package/script/utilities/0_rle.d.ts.map +1 -1
  300. package/script/utilities/0_rle_test.d.ts.map +1 -1
  301. package/script/utilities/0_text.d.ts +20 -1
  302. package/script/utilities/0_text.d.ts.map +1 -1
  303. package/script/utilities/0_text.js +19 -0
  304. package/script/utilities/1_auth.d.ts +1 -1
  305. package/script/utilities/1_auth.d.ts.map +1 -1
  306. package/script/utilities/1_auth.js +17 -7
  307. package/script/utilities/1_base64.d.ts +1 -1
  308. package/script/utilities/1_base64.d.ts.map +1 -1
  309. package/script/utilities/1_base64_test.d.ts.map +1 -1
  310. package/script/utilities/1_crypto.js +60 -61
  311. package/script/utilities/1_crypto_test.d.ts.map +1 -1
  312. package/script/utilities/1_logger.d.ts +2 -2
  313. package/script/utilities/1_math_test.d.ts.map +1 -1
  314. package/script/utilities/2_queue.js +30 -48
  315. package/esm/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
  316. package/esm/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
  317. package/esm/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
  318. package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
  319. package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
  320. package/esm/deps/jsr.io/@std/internal/1.0.9/format.js +0 -37
  321. package/esm/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
  322. package/esm/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
  323. package/esm/transport/3_transport_provider_web_socket.d.ts.map +0 -1
  324. package/script/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
  325. package/script/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
  326. package/script/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
  327. package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
  328. package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
  329. package/script/deps/jsr.io/@std/internal/1.0.9/format.js +0 -63
  330. package/script/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
  331. package/script/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
  332. package/script/transport/3_transport_provider_web_socket.d.ts.map +0 -1
  333. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
  334. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
  335. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
  336. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
  337. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
  338. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
  339. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
  340. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +0 -0
  341. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
  342. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
  343. /package/esm/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
  344. /package/esm/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
  345. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
  346. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
  347. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
  348. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
  349. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
  350. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
  351. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
  352. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
  353. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
  354. /package/script/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
  355. /package/script/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
@@ -18,31 +18,19 @@
18
18
  * You should have received a copy of the GNU Lesser General Public License
19
19
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20
20
  */
21
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
22
- if (kind === "m") throw new TypeError("Private method is not writable");
23
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
24
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
25
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
26
- };
27
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
28
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
29
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
30
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
- };
32
- var _NetworkStatisticsManager_c;
33
21
  Object.defineProperty(exports, "__esModule", { value: true });
34
22
  exports.NetworkStatisticsManager = void 0;
35
23
  class NetworkStatisticsManager {
24
+ #c;
36
25
  constructor(c) {
37
- _NetworkStatisticsManager_c.set(this, void 0);
38
- __classPrivateFieldSet(this, _NetworkStatisticsManager_c, c, "f");
26
+ this.#c = c;
39
27
  }
40
28
  async getNetworkStatistics() {
41
29
  const [messagesRead, messagesWrite, cdnRead, cdnWrite] = await Promise.all([
42
- __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_messages_read"]),
43
- __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_messages_write"]),
44
- __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_cdn_read"]),
45
- __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.get(["netstat_cdn_write"]),
30
+ this.#c.storage.get(["netstat_messages_read"]),
31
+ this.#c.storage.get(["netstat_messages_write"]),
32
+ this.#c.storage.get(["netstat_cdn_read"]),
33
+ this.#c.storage.get(["netstat_cdn_write"]),
46
34
  ]);
47
35
  const messages = {
48
36
  sent: Number(messagesWrite || 0),
@@ -58,14 +46,13 @@ class NetworkStatisticsManager {
58
46
  return {
59
47
  read: async (count) => {
60
48
  const key = cdn ? "netstat_cdn_read" : "netstat_messages_read";
61
- await __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.incr([key], count);
49
+ await this.#c.storage.incr([key], count);
62
50
  },
63
51
  write: async (count) => {
64
52
  const key = cdn ? "netstat_cdn_write" : "netstat_messages_write";
65
- await __classPrivateFieldGet(this, _NetworkStatisticsManager_c, "f").storage.incr([key], count);
53
+ await this.#c.storage.incr([key], count);
66
54
  },
67
55
  };
68
56
  }
69
57
  }
70
58
  exports.NetworkStatisticsManager = NetworkStatisticsManager;
71
- _NetworkStatisticsManager_c = new WeakMap();
@@ -18,18 +18,6 @@
18
18
  * You should have received a copy of the GNU Lesser General Public License
19
19
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20
20
  */
21
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
22
- if (kind === "m") throw new TypeError("Private method is not writable");
23
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
24
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
25
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
26
- };
27
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
28
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
29
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
30
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
- };
32
- var _PaymentManager_c;
33
21
  Object.defineProperty(exports, "__esModule", { value: true });
34
22
  exports.PaymentManager = void 0;
35
23
  const _0_errors_js_1 = require("../0_errors.js");
@@ -39,22 +27,22 @@ const paymentManagerUpdates = [
39
27
  "updateBotPrecheckoutQuery",
40
28
  ];
41
29
  class PaymentManager {
30
+ #c;
42
31
  constructor(c) {
43
- _PaymentManager_c.set(this, void 0);
44
- __classPrivateFieldSet(this, _PaymentManager_c, c, "f");
32
+ this.#c = c;
45
33
  }
46
34
  canHandleUpdate(update) {
47
35
  return _2_tl_js_1.Api.isOneOf(paymentManagerUpdates, update);
48
36
  }
49
37
  async handleUpdate(update) {
50
38
  if (_2_tl_js_1.Api.is("updateBotPrecheckoutQuery", update)) {
51
- const preCheckoutQuery = await (0, _3_types_js_1.constructPreCheckoutQuery)(update, __classPrivateFieldGet(this, _PaymentManager_c, "f").getEntity);
39
+ const preCheckoutQuery = await (0, _3_types_js_1.constructPreCheckoutQuery)(update, this.#c.getEntity);
52
40
  return { preCheckoutQuery };
53
41
  }
54
42
  return null;
55
43
  }
56
44
  async answerPreCheckoutQuery(preCheckoutQueryId, ok, params) {
57
- __classPrivateFieldGet(this, _PaymentManager_c, "f").storage.assertBot("answerPreCheckoutQuery");
45
+ this.#c.storage.assertBot("answerPreCheckoutQuery");
58
46
  if (!ok && !params?.error) {
59
47
  throw new _0_errors_js_1.InputError("error is required when ok is false");
60
48
  }
@@ -62,12 +50,11 @@ class PaymentManager {
62
50
  if (!queryId) {
63
51
  throw new _0_errors_js_1.InputError("Invalid pre-checkout query ID");
64
52
  }
65
- await __classPrivateFieldGet(this, _PaymentManager_c, "f").invoke({ _: "messages.setBotPrecheckoutResults", query_id: queryId, error: params?.error, success: ok ? true : undefined });
53
+ await this.#c.invoke({ _: "messages.setBotPrecheckoutResults", query_id: queryId, error: params?.error, success: ok ? true : undefined });
66
54
  }
67
55
  async refundStarPayment(userId, telegramPaymentChargeId) {
68
- __classPrivateFieldGet(this, _PaymentManager_c, "f").storage.assertBot("refundStarPayment");
69
- await __classPrivateFieldGet(this, _PaymentManager_c, "f").invoke({ _: "payments.refundStarsCharge", user_id: await __classPrivateFieldGet(this, _PaymentManager_c, "f").getInputUser(userId), charge_id: telegramPaymentChargeId });
56
+ this.#c.storage.assertBot("refundStarPayment");
57
+ await this.#c.invoke({ _: "payments.refundStarsCharge", user_id: await this.#c.getInputUser(userId), charge_id: telegramPaymentChargeId });
70
58
  }
71
59
  }
72
60
  exports.PaymentManager = PaymentManager;
73
- _PaymentManager_c = new WeakMap();
@@ -18,18 +18,6 @@
18
18
  * You should have received a copy of the GNU Lesser General Public License
19
19
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20
20
  */
21
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
22
- if (kind === "m") throw new TypeError("Private method is not writable");
23
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
24
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
25
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
26
- };
27
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
28
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
29
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
30
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
- };
32
- var _ReactionManager_c;
33
21
  Object.defineProperty(exports, "__esModule", { value: true });
34
22
  exports.ReactionManager = void 0;
35
23
  const _0_deps_js_1 = require("../0_deps.js");
@@ -43,16 +31,16 @@ const reactionManagerUpdates = [
43
31
  "updateChannelMessageForwards",
44
32
  ];
45
33
  class ReactionManager {
34
+ #c;
46
35
  constructor(c) {
47
- _ReactionManager_c.set(this, void 0);
48
- __classPrivateFieldSet(this, _ReactionManager_c, c, "f");
36
+ this.#c = c;
49
37
  }
50
38
  canHandleUpdate(update) {
51
39
  return _2_tl_js_1.Api.isOneOf(reactionManagerUpdates, update);
52
40
  }
53
41
  async handleUpdate(update) {
54
42
  if (_2_tl_js_1.Api.is("updateBotMessageReactions", update)) {
55
- const messageReactionCount = await (0, _3_types_js_1.constructMessageReactionCount)(update, __classPrivateFieldGet(this, _ReactionManager_c, "f").getEntity);
43
+ const messageReactionCount = await (0, _3_types_js_1.constructMessageReactionCount)(update, this.#c.getEntity);
56
44
  if (messageReactionCount) {
57
45
  return { messageReactionCount };
58
46
  }
@@ -61,7 +49,7 @@ class ReactionManager {
61
49
  }
62
50
  }
63
51
  else if (_2_tl_js_1.Api.is("updateBotMessageReaction", update)) {
64
- const messageReactions = await (0, _3_types_js_1.constructMessageReactions)(update, __classPrivateFieldGet(this, _ReactionManager_c, "f").getEntity);
52
+ const messageReactions = await (0, _3_types_js_1.constructMessageReactions)(update, this.#c.getEntity);
65
53
  if (messageReactions) {
66
54
  return { messageReactions };
67
55
  }
@@ -71,10 +59,10 @@ class ReactionManager {
71
59
  }
72
60
  else if (_2_tl_js_1.Api.is("updateMessageReactions", update)) {
73
61
  const chatId = _2_tl_js_1.Api.peerToChatId(update.peer);
74
- const message = await __classPrivateFieldGet(this, _ReactionManager_c, "f").messageStorage.getMessage(chatId, update.msg_id);
62
+ const message = await this.#c.messageStorage.getMessage(chatId, update.msg_id);
75
63
  if (_2_tl_js_1.Api.is("message", message)) {
76
64
  message.reactions = update.reactions;
77
- await __classPrivateFieldGet(this, _ReactionManager_c, "f").messageStorage.setMessage(chatId, update.msg_id, message);
65
+ await this.#c.messageStorage.setMessage(chatId, update.msg_id, message);
78
66
  const views = message.views ?? 0;
79
67
  const forwards = message.forwards ?? 0;
80
68
  const recentReactions = update.reactions.recent_reactions ?? [];
@@ -87,7 +75,7 @@ class ReactionManager {
87
75
  }
88
76
  else if (_2_tl_js_1.Api.isOneOf(["updateChannelMessageViews", "updateChannelMessageForwards"], update)) {
89
77
  const chatId = _2_tl_js_1.Api.peerToChatId({ ...update, _: "peerChannel" });
90
- const message = await __classPrivateFieldGet(this, _ReactionManager_c, "f").messageStorage.getMessage(chatId, update.id);
78
+ const message = await this.#c.messageStorage.getMessage(chatId, update.id);
91
79
  if (_2_tl_js_1.Api.is("message", message)) {
92
80
  if ("views" in update) {
93
81
  message.views = update.views;
@@ -111,4 +99,3 @@ class ReactionManager {
111
99
  }
112
100
  }
113
101
  exports.ReactionManager = ReactionManager;
114
- _ReactionManager_c = new WeakMap();
@@ -18,18 +18,6 @@
18
18
  * You should have received a copy of the GNU Lesser General Public License
19
19
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20
20
  */
21
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
22
- if (kind === "m") throw new TypeError("Private method is not writable");
23
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
24
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
25
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
26
- };
27
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
28
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
29
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
30
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
- };
32
- var _TranslationsManager_instances, _TranslationsManager_c, _TranslationsManager_getTranslationsInner, _TranslationsManager_updateTranslationsQueue, _TranslationsManager_updateTranslations, _TranslationsManager_applyLangPackDifferenceAndSave, _TranslationsManager_applyLangPackDifference;
33
21
  Object.defineProperty(exports, "__esModule", { value: true });
34
22
  exports.TranslationsManager = void 0;
35
23
  const _0_deps_js_1 = require("../0_deps.js");
@@ -42,130 +30,132 @@ const translationsManagerUpdates = [
42
30
  "updateLangPack",
43
31
  ];
44
32
  class TranslationsManager {
33
+ #c;
45
34
  constructor(c) {
46
- _TranslationsManager_instances.add(this);
47
- _TranslationsManager_c.set(this, void 0);
48
- _TranslationsManager_updateTranslationsQueue.set(this, new _1_utilities_js_1.Queue("updateTranslations"));
49
- __classPrivateFieldSet(this, _TranslationsManager_c, c, "f");
35
+ this.#c = c;
50
36
  }
51
37
  canHandleUpdate(update) {
52
38
  return _2_tl_js_1.Api.isOneOf(translationsManagerUpdates, update);
53
39
  }
54
40
  async getTranslations(params) {
55
- __classPrivateFieldGet(this, _TranslationsManager_c, "f").storage.assertUser("getTranslations");
56
- const platform = params?.platform ?? __classPrivateFieldGet(this, _TranslationsManager_c, "f").langPack;
41
+ this.#c.storage.assertUser("getTranslations");
42
+ const platform = params?.platform ?? this.#c.langPack;
57
43
  if (!platform) {
58
44
  throw new _0_errors_js_1.InputError("No platform specified.");
59
45
  }
60
- const language = params?.language ?? __classPrivateFieldGet(this, _TranslationsManager_c, "f").langCode;
46
+ const language = params?.language ?? this.#c.langCode;
61
47
  if (!language) {
62
48
  throw new _0_errors_js_1.InputError("No language specified.");
63
49
  }
64
- return await __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_getTranslationsInner).call(this, platform, language);
50
+ return await this.#getTranslationsInner(platform, language);
65
51
  }
66
- async handleUpdate(update) {
67
- if (!__classPrivateFieldGet(this, _TranslationsManager_c, "f").langPack) {
68
- return null;
52
+ async #getTranslationsInner(platform, language, assert = false) {
53
+ const maybeTranslations = await this.#c.messageStorage.getTranslations(platform, language);
54
+ if (maybeTranslations != null) {
55
+ return maybeTranslations[1];
69
56
  }
70
- if (_2_tl_js_1.Api.is("updateLangPackTooLong", update)) {
71
- await __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_updateTranslations).call(this, __classPrivateFieldGet(this, _TranslationsManager_c, "f").langPack, update.lang_code);
72
- const translations = await __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_getTranslationsInner).call(this, __classPrivateFieldGet(this, _TranslationsManager_c, "f").langPack, update.lang_code, true);
73
- return { platform: __classPrivateFieldGet(this, _TranslationsManager_c, "f").langPack, language: update.lang_code, translations };
57
+ else if (assert) {
58
+ (0, _0_deps_js_1.unreachable)();
74
59
  }
75
- else if (_2_tl_js_1.Api.is("updateLangPack", update)) {
76
- if (!__classPrivateFieldGet(this, _TranslationsManager_c, "f").langCode) {
77
- return null;
78
- }
79
- const translations = await __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_applyLangPackDifferenceAndSave).call(this, __classPrivateFieldGet(this, _TranslationsManager_c, "f").langPack, __classPrivateFieldGet(this, _TranslationsManager_c, "f").langCode, update.difference.version, update.difference.from_version, update.difference.strings);
80
- if (!translations) {
81
- return null;
82
- }
83
- else {
84
- return { platform: __classPrivateFieldGet(this, _TranslationsManager_c, "f").langPack, language: __classPrivateFieldGet(this, _TranslationsManager_c, "f").langCode, translations };
85
- }
60
+ else {
61
+ await this.#updateTranslations(platform, language);
62
+ return await this.#getTranslationsInner(platform, language, true);
86
63
  }
87
- return null;
88
64
  }
89
- }
90
- exports.TranslationsManager = TranslationsManager;
91
- _TranslationsManager_c = new WeakMap(), _TranslationsManager_updateTranslationsQueue = new WeakMap(), _TranslationsManager_instances = new WeakSet(), _TranslationsManager_getTranslationsInner = async function _TranslationsManager_getTranslationsInner(platform, language, assert = false) {
92
- const maybeTranslations = await __classPrivateFieldGet(this, _TranslationsManager_c, "f").messageStorage.getTranslations(platform, language);
93
- if (maybeTranslations != null) {
94
- return maybeTranslations[1];
95
- }
96
- else if (assert) {
97
- (0, _0_deps_js_1.unreachable)();
98
- }
99
- else {
100
- await __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_updateTranslations).call(this, platform, language);
101
- return await __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_getTranslationsInner).call(this, platform, language, true);
102
- }
103
- }, _TranslationsManager_updateTranslations = async function _TranslationsManager_updateTranslations(platform, language) {
104
- await new Promise((resolve, reject) => {
105
- __classPrivateFieldGet(this, _TranslationsManager_updateTranslationsQueue, "f").add(async () => {
106
- try {
107
- const maybeTranslations = await __classPrivateFieldGet(this, _TranslationsManager_c, "f").messageStorage.getTranslations(platform, language);
108
- if (maybeTranslations != null) {
109
- const difference = await __classPrivateFieldGet(this, _TranslationsManager_c, "f").invoke({ _: "langpack.getDifference", lang_pack: platform, lang_code: language, from_version: maybeTranslations[0] });
110
- const newTranslations = __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_applyLangPackDifference).call(this, maybeTranslations[1], difference.strings);
111
- await __classPrivateFieldGet(this, _TranslationsManager_c, "f").messageStorage.setTranslations(platform, language, difference.version, newTranslations);
65
+ #updateTranslationsQueue = new _1_utilities_js_1.Queue("updateTranslations");
66
+ async #updateTranslations(platform, language) {
67
+ await new Promise((resolve, reject) => {
68
+ this.#updateTranslationsQueue.add(async () => {
69
+ try {
70
+ const maybeTranslations = await this.#c.messageStorage.getTranslations(platform, language);
71
+ if (maybeTranslations != null) {
72
+ const difference = await this.#c.invoke({ _: "langpack.getDifference", lang_pack: platform, lang_code: language, from_version: maybeTranslations[0] });
73
+ const newTranslations = this.#applyLangPackDifference(maybeTranslations[1], difference.strings);
74
+ await this.#c.messageStorage.setTranslations(platform, language, difference.version, newTranslations);
75
+ }
76
+ else {
77
+ const pack = await this.#c.invoke({ _: "langpack.getLangPack", lang_pack: platform, lang_code: language });
78
+ const version = pack.version;
79
+ const translations = pack.strings.map(_3_types_js_1.constructTranslation);
80
+ await this.#c.messageStorage.setTranslations(platform, language, version, translations);
81
+ }
82
+ resolve();
112
83
  }
113
- else {
114
- const pack = await __classPrivateFieldGet(this, _TranslationsManager_c, "f").invoke({ _: "langpack.getLangPack", lang_pack: platform, lang_code: language });
115
- const version = pack.version;
116
- const translations = pack.strings.map(_3_types_js_1.constructTranslation);
117
- await __classPrivateFieldGet(this, _TranslationsManager_c, "f").messageStorage.setTranslations(platform, language, version, translations);
84
+ catch (err) {
85
+ reject(err);
118
86
  }
119
- resolve();
120
- }
121
- catch (err) {
122
- reject(err);
123
- }
87
+ });
124
88
  });
125
- });
126
- }, _TranslationsManager_applyLangPackDifferenceAndSave = async function _TranslationsManager_applyLangPackDifferenceAndSave(platform, language, version, fromVersion, strings) {
127
- const result = await new Promise((resolve, reject) => {
128
- __classPrivateFieldGet(this, _TranslationsManager_updateTranslationsQueue, "f").add(async () => {
129
- try {
130
- const maybeTranslations = await __classPrivateFieldGet(this, _TranslationsManager_c, "f").messageStorage.getTranslations(platform, language);
131
- let newTranslations = null;
132
- if (maybeTranslations) {
133
- if (fromVersion != maybeTranslations[0]) {
134
- resolve("mustUpdate");
135
- return;
89
+ }
90
+ async #applyLangPackDifferenceAndSave(platform, language, version, fromVersion, strings) {
91
+ const result = await new Promise((resolve, reject) => {
92
+ this.#updateTranslationsQueue.add(async () => {
93
+ try {
94
+ const maybeTranslations = await this.#c.messageStorage.getTranslations(platform, language);
95
+ let newTranslations = null;
96
+ if (maybeTranslations) {
97
+ if (fromVersion != maybeTranslations[0]) {
98
+ resolve("mustUpdate");
99
+ return;
100
+ }
101
+ newTranslations = this.#applyLangPackDifference(maybeTranslations[1], strings);
102
+ await this.#c.messageStorage.setTranslations(platform, language, version, newTranslations);
136
103
  }
137
- newTranslations = __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_applyLangPackDifference).call(this, maybeTranslations[1], strings);
138
- await __classPrivateFieldGet(this, _TranslationsManager_c, "f").messageStorage.setTranslations(platform, language, version, newTranslations);
104
+ resolve(newTranslations);
139
105
  }
140
- resolve(newTranslations);
141
- }
142
- catch (err) {
143
- reject(err);
144
- }
106
+ catch (err) {
107
+ reject(err);
108
+ }
109
+ });
145
110
  });
146
- });
147
- if (result == "mustUpdate") {
148
- await __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_updateTranslations).call(this, platform, language);
149
- return await __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_getTranslationsInner).call(this, platform, language, true);
111
+ if (result == "mustUpdate") {
112
+ await this.#updateTranslations(platform, language);
113
+ return await this.#getTranslationsInner(platform, language, true);
114
+ }
115
+ else {
116
+ return result;
117
+ }
150
118
  }
151
- else {
152
- return result;
119
+ #applyLangPackDifference(translations, strings) {
120
+ for (const string of strings) {
121
+ if (_2_tl_js_1.Api.is("langPackStringDeleted", string)) {
122
+ translations = translations.filter((v) => v.key != string.key);
123
+ }
124
+ else {
125
+ const newTranslation = (0, _3_types_js_1.constructTranslation)(string);
126
+ const currentTranslation = translations.find((v) => v.key == string.key);
127
+ if (currentTranslation) {
128
+ Object.assign(currentTranslation, newTranslation);
129
+ }
130
+ else {
131
+ translations.push(newTranslation);
132
+ }
133
+ }
134
+ }
135
+ return translations;
153
136
  }
154
- }, _TranslationsManager_applyLangPackDifference = function _TranslationsManager_applyLangPackDifference(translations, strings) {
155
- for (const string of strings) {
156
- if (_2_tl_js_1.Api.is("langPackStringDeleted", string)) {
157
- translations = translations.filter((v) => v.key != string.key);
137
+ async handleUpdate(update) {
138
+ if (!this.#c.langPack) {
139
+ return null;
158
140
  }
159
- else {
160
- const newTranslation = (0, _3_types_js_1.constructTranslation)(string);
161
- const currentTranslation = translations.find((v) => v.key == string.key);
162
- if (currentTranslation) {
163
- Object.assign(currentTranslation, newTranslation);
141
+ if (_2_tl_js_1.Api.is("updateLangPackTooLong", update)) {
142
+ await this.#updateTranslations(this.#c.langPack, update.lang_code);
143
+ const translations = await this.#getTranslationsInner(this.#c.langPack, update.lang_code, true);
144
+ return { platform: this.#c.langPack, language: update.lang_code, translations };
145
+ }
146
+ else if (_2_tl_js_1.Api.is("updateLangPack", update)) {
147
+ if (!this.#c.langCode) {
148
+ return null;
149
+ }
150
+ const translations = await this.#applyLangPackDifferenceAndSave(this.#c.langPack, this.#c.langCode, update.difference.version, update.difference.from_version, update.difference.strings);
151
+ if (!translations) {
152
+ return null;
164
153
  }
165
154
  else {
166
- translations.push(newTranslation);
155
+ return { platform: this.#c.langPack, language: this.#c.langCode, translations };
167
156
  }
168
157
  }
158
+ return null;
169
159
  }
170
- return translations;
171
- };
160
+ }
161
+ exports.TranslationsManager = TranslationsManager;