@mtkruto/node 0.67.2 → 0.69.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 (1183) hide show
  1. package/esm/0_deps.d.ts +12 -12
  2. package/esm/0_deps.js +14 -14
  3. package/esm/0_errors.js +2 -6
  4. package/esm/3_errors.js +2 -12
  5. package/esm/3_types.d.ts +4 -0
  6. package/esm/3_types.d.ts.map +1 -1
  7. package/esm/3_types.js +4 -0
  8. package/esm/4_constants.d.ts +1 -1
  9. package/esm/4_constants.d.ts.map +1 -1
  10. package/esm/4_errors.d.ts +2 -2
  11. package/esm/4_errors.d.ts.map +1 -1
  12. package/esm/4_errors.js +2 -12
  13. package/esm/_dnt.polyfills.d.ts +99 -0
  14. package/esm/_dnt.polyfills.d.ts.map +1 -1
  15. package/esm/_dnt.polyfills.js +127 -1
  16. package/esm/_dnt.test_polyfills.d.ts.map +1 -0
  17. package/esm/client/0_client_abstract.d.ts +3 -3
  18. package/esm/client/0_client_abstract.d.ts.map +1 -1
  19. package/esm/client/0_filters.d.ts +1 -1
  20. package/esm/client/0_filters.d.ts.map +1 -1
  21. package/esm/client/0_filters.js +3 -3
  22. package/esm/client/0_filters_test.d.ts.map +1 -1
  23. package/esm/client/0_html.d.ts +1 -1
  24. package/esm/client/0_html.d.ts.map +1 -1
  25. package/esm/client/0_html.js +1 -1
  26. package/esm/client/0_markdown.d.ts +1 -1
  27. package/esm/client/0_markdown.d.ts.map +1 -1
  28. package/esm/client/0_markdown.js +8 -8
  29. package/esm/client/0_markdown_test.d.ts.map +1 -1
  30. package/esm/client/0_params.d.ts +44 -8
  31. package/esm/client/0_params.d.ts.map +1 -1
  32. package/esm/client/0_password.d.ts +5 -5
  33. package/esm/client/0_password.d.ts.map +1 -1
  34. package/esm/client/0_password.js +1 -1
  35. package/esm/client/0_password_test.d.ts.map +1 -1
  36. package/esm/client/0_storage_operations.d.ts +4 -4
  37. package/esm/client/0_storage_operations.d.ts.map +1 -1
  38. package/esm/client/0_storage_operations.js +159 -171
  39. package/esm/client/0_storage_operations_test.d.ts.map +1 -1
  40. package/esm/client/0_update_processor.d.ts +2 -2
  41. package/esm/client/0_update_processor.d.ts.map +1 -1
  42. package/esm/client/0_utilities.d.ts +1 -1
  43. package/esm/client/0_utilities.js +8 -8
  44. package/esm/client/0_utilities_test.d.ts.map +1 -1
  45. package/esm/client/1_client_plain.d.ts +3 -3
  46. package/esm/client/1_client_plain.d.ts.map +1 -1
  47. package/esm/client/1_client_plain.js +5 -23
  48. package/esm/client/1_composer.d.ts +3 -3
  49. package/esm/client/1_composer.d.ts.map +1 -1
  50. package/esm/client/1_composer.js +14 -27
  51. package/esm/client/1_types.d.ts +4 -4
  52. package/esm/client/1_types.d.ts.map +1 -1
  53. package/esm/client/2_account_manager.d.ts +3 -3
  54. package/esm/client/2_account_manager.d.ts.map +1 -1
  55. package/esm/client/2_account_manager.js +86 -98
  56. package/esm/client/2_bot_info_manager.d.ts +3 -3
  57. package/esm/client/2_bot_info_manager.d.ts.map +1 -1
  58. package/esm/client/2_bot_info_manager.js +26 -38
  59. package/esm/client/2_business_connection_manager.d.ts +3 -3
  60. package/esm/client/2_business_connection_manager.d.ts.map +1 -1
  61. package/esm/client/2_business_connection_manager.js +10 -23
  62. package/esm/client/2_client_encrypted.d.ts +2 -2
  63. package/esm/client/2_client_encrypted.d.ts.map +1 -1
  64. package/esm/client/2_client_encrypted.js +194 -211
  65. package/esm/client/2_file_manager.d.ts +7 -6
  66. package/esm/client/2_file_manager.d.ts.map +1 -1
  67. package/esm/client/2_file_manager.js +303 -245
  68. package/esm/client/2_file_manager_test.d.ts.map +1 -1
  69. package/esm/client/2_network_statistics_manager.d.ts +1 -1
  70. package/esm/client/2_network_statistics_manager.d.ts.map +1 -1
  71. package/esm/client/2_network_statistics_manager.js +8 -21
  72. package/esm/client/2_payment_manager.d.ts +4 -4
  73. package/esm/client/2_payment_manager.d.ts.map +1 -1
  74. package/esm/client/2_payment_manager.js +7 -20
  75. package/esm/client/2_reaction_manager.d.ts +3 -3
  76. package/esm/client/2_reaction_manager.d.ts.map +1 -1
  77. package/esm/client/2_reaction_manager.js +7 -20
  78. package/esm/client/2_translations_manager.d.ts +4 -4
  79. package/esm/client/2_translations_manager.d.ts.map +1 -1
  80. package/esm/client/2_translations_manager.js +97 -107
  81. package/esm/client/2_update_manager.d.ts +2 -2
  82. package/esm/client/2_update_manager.d.ts.map +1 -1
  83. package/esm/client/2_update_manager.js +766 -761
  84. package/esm/client/3_client_encrypted_pool.d.ts +1 -1
  85. package/esm/client/3_client_encrypted_pool.d.ts.map +1 -1
  86. package/esm/client/3_client_encrypted_pool.js +10 -26
  87. package/esm/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  88. package/esm/client/3_message_manager.d.ts +11 -8
  89. package/esm/client/3_message_manager.d.ts.map +1 -1
  90. package/esm/client/3_message_manager.js +580 -466
  91. package/esm/client/3_message_manager_test.d.ts.map +1 -1
  92. package/esm/client/3_video_chat_manager.d.ts +6 -6
  93. package/esm/client/3_video_chat_manager.d.ts.map +1 -1
  94. package/esm/client/3_video_chat_manager.js +61 -72
  95. package/esm/client/4_callback_query_manager.d.ts +5 -5
  96. package/esm/client/4_callback_query_manager.d.ts.map +1 -1
  97. package/esm/client/4_callback_query_manager.js +18 -30
  98. package/esm/client/4_chat_list_manager.d.ts +6 -6
  99. package/esm/client/4_chat_list_manager.d.ts.map +1 -1
  100. package/esm/client/4_chat_list_manager.js +328 -324
  101. package/esm/client/4_chat_manager.d.ts +7 -7
  102. package/esm/client/4_chat_manager.d.ts.map +1 -1
  103. package/esm/client/4_chat_manager.js +120 -133
  104. package/esm/client/4_forum_manager.d.ts +4 -4
  105. package/esm/client/4_forum_manager.d.ts.map +1 -1
  106. package/esm/client/4_forum_manager.js +67 -73
  107. package/esm/client/4_gift_manager.d.ts +4 -4
  108. package/esm/client/4_gift_manager.d.ts.map +1 -1
  109. package/esm/client/4_gift_manager.js +17 -30
  110. package/esm/client/4_inline_query_manager.d.ts +5 -5
  111. package/esm/client/4_inline_query_manager.d.ts.map +1 -1
  112. package/esm/client/4_inline_query_manager.js +16 -28
  113. package/esm/client/4_link_preview_manager.d.ts +5 -5
  114. package/esm/client/4_link_preview_manager.d.ts.map +1 -1
  115. package/esm/client/4_link_preview_manager.js +6 -19
  116. package/esm/client/4_poll_manager.d.ts +4 -4
  117. package/esm/client/4_poll_manager.d.ts.map +1 -1
  118. package/esm/client/4_poll_manager.js +44 -57
  119. package/esm/client/4_story_manager.d.ts +7 -7
  120. package/esm/client/4_story_manager.d.ts.map +1 -1
  121. package/esm/client/4_story_manager.js +43 -55
  122. package/esm/client/5_client.d.ts +34 -15
  123. package/esm/client/5_client.d.ts.map +1 -1
  124. package/esm/client/5_client.js +1299 -1291
  125. package/esm/connection/0_connection.d.ts +1 -1
  126. package/esm/connection/0_connection.d.ts.map +1 -1
  127. package/esm/connection/1_connection_tcp.node.d.ts +1 -1
  128. package/esm/connection/1_connection_tcp.node.d.ts.map +1 -1
  129. package/esm/connection/1_connection_tcp.node.js +49 -66
  130. package/esm/connection/1_connection_web_socket.d.ts +1 -1
  131. package/esm/connection/1_connection_web_socket.d.ts.map +1 -1
  132. package/esm/connection/1_connection_web_socket.js +75 -91
  133. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  134. package/{script/deps/jsr.io/@std/assert/1.0.13 → esm/deps/jsr.io/@std/assert/1.0.14}/assert.d.ts.map +1 -1
  135. package/esm/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts +26 -0
  136. package/esm/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts.map +1 -0
  137. package/esm/deps/jsr.io/@std/assert/1.0.14/assertion_error.js +30 -0
  138. package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts.map +1 -1
  139. package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts.map +1 -1
  140. package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts.map +1 -1
  141. package/esm/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts +15 -0
  142. package/esm/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts.map +1 -0
  143. package/esm/deps/jsr.io/@std/assert/1.0.14/unreachable.js +20 -0
  144. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts.map +1 -1
  145. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts.map +1 -1
  146. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts.map +1 -1
  147. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts.map +1 -1
  148. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts.map +1 -1
  149. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.js +17 -2
  150. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts.map +1 -1
  151. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts.map +1 -1
  152. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.js +31 -47
  153. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts.map +1 -1
  154. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts.map +1 -1
  155. package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts.map +1 -1
  156. package/esm/deps/jsr.io/@std/async/1.0.14/tee.js +79 -0
  157. package/esm/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  158. package/esm/deps/jsr.io/@std/internal/1.0.10/_os.d.ts +2 -0
  159. package/esm/deps/jsr.io/@std/internal/1.0.10/_os.d.ts.map +1 -0
  160. package/esm/deps/jsr.io/@std/internal/1.0.10/_os.js +12 -0
  161. package/esm/deps/jsr.io/@std/internal/1.0.10/os.d.ts +3 -0
  162. package/esm/deps/jsr.io/@std/internal/1.0.10/os.d.ts.map +1 -0
  163. package/esm/deps/jsr.io/@std/internal/1.0.10/os.js +5 -0
  164. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts.map +1 -1
  165. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts.map +1 -1
  166. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts.map +1 -1
  167. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts.map +1 -1
  168. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts.map +1 -1
  169. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts.map +1 -1
  170. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts.map +1 -1
  171. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts.map +1 -1
  172. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/basename.d.ts.map +1 -1
  173. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.js +1 -1
  174. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts.map +1 -1
  175. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.js +1 -1
  176. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts.map +1 -1
  177. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.js +1 -1
  178. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts.map +1 -1
  179. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.js +1 -1
  180. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts.map +1 -1
  181. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/basename.d.ts.map +1 -1
  182. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/extname.d.ts.map +1 -1
  183. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts.map +1 -1
  184. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts.map +1 -1
  185. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/join.d.ts.map +1 -1
  186. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/normalize.d.ts.map +1 -1
  187. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/posix/to_file_url.d.ts.map +1 -1
  188. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/to_file_url.d.ts.map +1 -1
  189. package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.js +1 -1
  190. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/_util.d.ts.map +1 -1
  191. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/basename.d.ts.map +1 -1
  192. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/extname.d.ts.map +1 -1
  193. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/from_file_url.d.ts.map +1 -1
  194. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/is_absolute.d.ts.map +1 -1
  195. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/join.d.ts.map +1 -1
  196. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/normalize.d.ts.map +1 -1
  197. package/{script/deps/jsr.io/@std/path/1.1.0 → esm/deps/jsr.io/@std/path/1.1.2}/windows/to_file_url.d.ts.map +1 -1
  198. package/esm/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts.map +1 -1
  199. package/esm/mod.js +2 -12
  200. package/esm/session/0_session_state.js +12 -38
  201. package/esm/session/1_session.d.ts +2 -2
  202. package/esm/session/1_session.d.ts.map +1 -1
  203. package/esm/session/1_session.js +49 -72
  204. package/esm/session/2_session_encrypted.d.ts +2 -2
  205. package/esm/session/2_session_encrypted.d.ts.map +1 -1
  206. package/esm/session/2_session_encrypted.js +324 -320
  207. package/esm/session/2_session_plain.js +1 -1
  208. package/esm/storage/0_storage.d.ts +1 -1
  209. package/esm/storage/0_storage.d.ts.map +1 -1
  210. package/esm/storage/1_utilities.d.ts +14 -11
  211. package/esm/storage/1_utilities.d.ts.map +1 -1
  212. package/esm/storage/1_utilities.js +17 -17
  213. package/esm/storage/1_utilities_test.d.ts.map +1 -1
  214. package/esm/storage/2_storage_indexed_db.d.ts +1 -1
  215. package/esm/storage/2_storage_indexed_db.d.ts.map +1 -1
  216. package/esm/storage/2_storage_indexed_db.js +29 -47
  217. package/esm/storage/2_storage_local_storage.node.d.ts +1 -1
  218. package/esm/storage/2_storage_local_storage.node.d.ts.map +1 -1
  219. package/esm/storage/2_storage_local_storage.node.js +15 -28
  220. package/esm/storage/2_storage_memory.d.ts +2 -2
  221. package/esm/storage/2_storage_memory.d.ts.map +1 -1
  222. package/esm/storage/2_storage_memory.js +26 -43
  223. package/esm/storage/2_storage_session_storage.d.ts +2 -2
  224. package/esm/storage/2_storage_session_storage.d.ts.map +1 -1
  225. package/esm/storage/2_storage_session_storage.js +6 -19
  226. package/esm/tl/0_utilities.js +1 -1
  227. package/esm/tl/0_utilities_test.d.ts.map +1 -1
  228. package/esm/tl/1_tl_reader.d.ts +1 -1
  229. package/esm/tl/1_tl_reader.d.ts.map +1 -1
  230. package/esm/tl/1_tl_reader.js +82 -90
  231. package/esm/tl/1_tl_reader_test.d.ts.map +1 -1
  232. package/esm/tl/1_tl_writer.d.ts +1 -1
  233. package/esm/tl/1_tl_writer.d.ts.map +1 -1
  234. package/esm/tl/1_tl_writer.js +155 -164
  235. package/esm/tl/1_tl_writer_test.d.ts.map +1 -1
  236. package/esm/tl/1_utilities.d.ts +1 -1
  237. package/esm/tl/1_utilities.d.ts.map +1 -1
  238. package/esm/tl/1_utilities.js +2 -2
  239. package/esm/tl/2_message.js +1 -1
  240. package/esm/tl/2_mtproto.d.ts +1 -1
  241. package/esm/tl/2_mtproto.d.ts.map +1 -1
  242. package/esm/tl/2_telegram.d.ts +1 -1
  243. package/esm/tl/2_telegram.d.ts.map +1 -1
  244. package/esm/transport/0_obfuscation.d.ts +1 -1
  245. package/esm/transport/0_obfuscation.d.ts.map +1 -1
  246. package/esm/transport/0_obfuscation.js +2 -2
  247. package/esm/transport/0_transport.d.ts +1 -1
  248. package/esm/transport/0_transport.d.ts.map +1 -1
  249. package/esm/transport/0_transport.js +1 -8
  250. package/esm/transport/1_transport_abridged.d.ts +1 -1
  251. package/esm/transport/1_transport_abridged.d.ts.map +1 -1
  252. package/esm/transport/1_transport_abridged.js +11 -24
  253. package/esm/transport/1_transport_intermediate.d.ts +1 -1
  254. package/esm/transport/1_transport_intermediate.d.ts.map +1 -1
  255. package/esm/transport/1_transport_intermediate.js +10 -23
  256. package/esm/transport/1_transport_provider.d.ts +2 -2
  257. package/esm/transport/1_transport_provider.d.ts.map +1 -1
  258. package/esm/transport/2_transport_provider_tcp.d.ts +1 -1
  259. package/esm/transport/2_transport_provider_tcp.d.ts.map +1 -1
  260. package/esm/transport/2_transport_provider_web_socket.d.ts +1 -1
  261. package/esm/transport/2_transport_provider_web_socket.d.ts.map +1 -1
  262. package/esm/transport/2_transport_provider_web_socket.js +1 -1
  263. package/esm/types/0_birthday.d.ts +1 -1
  264. package/esm/types/0_birthday.d.ts.map +1 -1
  265. package/esm/types/0_callback_query_answer.d.ts +1 -1
  266. package/esm/types/0_callback_query_answer.d.ts.map +1 -1
  267. package/esm/types/0_callback_query_question.js +2 -2
  268. package/esm/types/0_chat_administrator_rights.d.ts +1 -1
  269. package/esm/types/0_chat_administrator_rights.d.ts.map +1 -1
  270. package/esm/types/0_chat_member_rights.d.ts +1 -1
  271. package/esm/types/0_chat_member_rights.d.ts.map +1 -1
  272. package/esm/types/0_contact.d.ts +1 -1
  273. package/esm/types/0_contact.d.ts.map +1 -1
  274. package/esm/types/0_dice.d.ts +1 -1
  275. package/esm/types/0_dice.d.ts.map +1 -1
  276. package/esm/types/0_failed_invitation.d.ts +1 -1
  277. package/esm/types/0_failed_invitation.d.ts.map +1 -1
  278. package/esm/types/0_invoice.d.ts +1 -1
  279. package/esm/types/0_invoice.d.ts.map +1 -1
  280. package/esm/types/0_live_stream_channel.d.ts +1 -1
  281. package/esm/types/0_live_stream_channel.d.ts.map +1 -1
  282. package/esm/types/0_mask_position.d.ts +1 -1
  283. package/esm/types/0_mask_position.d.ts.map +1 -1
  284. package/esm/types/0_mask_position.js +1 -1
  285. package/esm/types/0_message_entity.d.ts +1 -1
  286. package/esm/types/0_message_entity.d.ts.map +1 -1
  287. package/esm/types/0_message_entity.js +1 -1
  288. package/esm/types/0_message_search_filter.d.ts +1 -1
  289. package/esm/types/0_message_search_filter.d.ts.map +1 -1
  290. package/esm/types/0_opening_hours.d.ts +1 -1
  291. package/esm/types/0_opening_hours.d.ts.map +1 -1
  292. package/esm/types/0_reaction.js +5 -5
  293. package/esm/types/0_refunded_payment.d.ts +1 -1
  294. package/esm/types/0_refunded_payment.d.ts.map +1 -1
  295. package/esm/types/0_restriction_reason.d.ts +1 -1
  296. package/esm/types/0_restriction_reason.d.ts.map +1 -1
  297. package/esm/types/0_self_destruct_option.js +3 -3
  298. package/esm/types/0_shipping_address.d.ts +1 -1
  299. package/esm/types/0_shipping_address.d.ts.map +1 -1
  300. package/esm/types/0_slow_mode_duration.js +2 -2
  301. package/esm/types/0_upload_progress.d.ts +29 -0
  302. package/esm/types/0_upload_progress.d.ts.map +1 -0
  303. package/esm/types/0_upload_progress.js +20 -0
  304. package/esm/types/0_voice.d.ts +1 -1
  305. package/esm/types/0_voice.d.ts.map +1 -1
  306. package/esm/types/0_voice_transcription.d.ts +1 -1
  307. package/esm/types/0_voice_transcription.d.ts.map +1 -1
  308. package/esm/types/1_animation.d.ts +1 -1
  309. package/esm/types/1_animation.d.ts.map +1 -1
  310. package/esm/types/1_audio.d.ts +1 -1
  311. package/esm/types/1_audio.d.ts.map +1 -1
  312. package/esm/types/1_bot_command_scope.d.ts +2 -2
  313. package/esm/types/1_bot_command_scope.d.ts.map +1 -1
  314. package/esm/types/1_chat_p.d.ts +2 -2
  315. package/esm/types/1_chat_p.d.ts.map +1 -1
  316. package/esm/types/1_chat_p.js +2 -2
  317. package/esm/types/1_document.d.ts +1 -1
  318. package/esm/types/1_document.d.ts.map +1 -1
  319. package/esm/types/1_giveaway.d.ts +2 -2
  320. package/esm/types/1_giveaway.d.ts.map +1 -1
  321. package/esm/types/1_inline_keyboard_button.d.ts +3 -3
  322. package/esm/types/1_inline_keyboard_button.d.ts.map +1 -1
  323. package/esm/types/1_inline_keyboard_button.js +4 -4
  324. package/esm/types/1_inline_query_result_button.d.ts +1 -1
  325. package/esm/types/1_inline_query_result_button.d.ts.map +1 -1
  326. package/esm/types/1_input_media.d.ts +4 -4
  327. package/esm/types/1_input_media.d.ts.map +1 -1
  328. package/esm/types/1_input_story_content.d.ts +1 -1
  329. package/esm/types/1_input_story_content.d.ts.map +1 -1
  330. package/esm/types/1_keyboard_button.d.ts +3 -3
  331. package/esm/types/1_keyboard_button.d.ts.map +1 -1
  332. package/esm/types/1_keyboard_button.js +1 -1
  333. package/esm/types/1_message_reaction.d.ts +1 -1
  334. package/esm/types/1_message_reaction.d.ts.map +1 -1
  335. package/esm/types/1_message_reaction.js +2 -2
  336. package/esm/types/1_mini_app_info.d.ts +2 -2
  337. package/esm/types/1_mini_app_info.d.ts.map +1 -1
  338. package/esm/types/1_network_statistics.d.ts +1 -1
  339. package/esm/types/1_network_statistics.d.ts.map +1 -1
  340. package/esm/types/1_order_info.d.ts +2 -2
  341. package/esm/types/1_order_info.d.ts.map +1 -1
  342. package/esm/types/1_photo.d.ts +1 -1
  343. package/esm/types/1_photo.d.ts.map +1 -1
  344. package/esm/types/1_poll_option.d.ts +2 -2
  345. package/esm/types/1_poll_option.d.ts.map +1 -1
  346. package/esm/types/1_poll_option.js +2 -2
  347. package/esm/types/1_reaction_count.d.ts +2 -2
  348. package/esm/types/1_reaction_count.d.ts.map +1 -1
  349. package/esm/types/1_reply_quote.d.ts +2 -2
  350. package/esm/types/1_reply_quote.d.ts.map +1 -1
  351. package/esm/types/1_sticker.d.ts +4 -4
  352. package/esm/types/1_sticker.d.ts.map +1 -1
  353. package/esm/types/1_sticker.js +2 -2
  354. package/esm/types/1_story_privacy.d.ts +1 -1
  355. package/esm/types/1_story_privacy.d.ts.map +1 -1
  356. package/esm/types/1_story_reaction.d.ts +2 -2
  357. package/esm/types/1_story_reaction.d.ts.map +1 -1
  358. package/esm/types/1_user.d.ts +2 -2
  359. package/esm/types/1_user.d.ts.map +1 -1
  360. package/esm/types/1_user.js +1 -1
  361. package/esm/types/1_venue.d.ts +1 -1
  362. package/esm/types/1_venue.d.ts.map +1 -1
  363. package/esm/types/1_video.d.ts +1 -1
  364. package/esm/types/1_video.d.ts.map +1 -1
  365. package/esm/types/1_video_note.d.ts +1 -1
  366. package/esm/types/1_video_note.d.ts.map +1 -1
  367. package/esm/types/2_business_connection.d.ts +3 -3
  368. package/esm/types/2_business_connection.d.ts.map +1 -1
  369. package/esm/types/2_chat.d.ts +6 -6
  370. package/esm/types/2_chat.d.ts.map +1 -1
  371. package/esm/types/2_chat.js +3 -3
  372. package/esm/types/2_chat_member.d.ts +4 -4
  373. package/esm/types/2_chat_member.d.ts.map +1 -1
  374. package/esm/types/2_chat_member.js +1 -1
  375. package/esm/types/2_chat_settings.d.ts +1 -1
  376. package/esm/types/2_chat_settings.d.ts.map +1 -1
  377. package/esm/types/2_chat_settings.js +1 -1
  378. package/esm/types/2_chosen_inline_result.d.ts +3 -3
  379. package/esm/types/2_chosen_inline_result.d.ts.map +1 -1
  380. package/esm/types/2_forward_header.d.ts +4 -4
  381. package/esm/types/2_forward_header.d.ts.map +1 -1
  382. package/esm/types/2_forward_header.js +6 -6
  383. package/esm/types/2_game.d.ts +3 -3
  384. package/esm/types/2_game.d.ts.map +1 -1
  385. package/esm/types/2_gift_upgraded_component.d.ts +2 -2
  386. package/esm/types/2_gift_upgraded_component.d.ts.map +1 -1
  387. package/esm/types/2_inactive_chat.d.ts +1 -1
  388. package/esm/types/2_inactive_chat.d.ts.map +1 -1
  389. package/esm/types/2_inline_query.d.ts +3 -3
  390. package/esm/types/2_inline_query.d.ts.map +1 -1
  391. package/esm/types/2_inline_query.js +1 -1
  392. package/esm/types/2_invite_link.d.ts +3 -3
  393. package/esm/types/2_invite_link.d.ts.map +1 -1
  394. package/esm/types/2_message_interactions.d.ts +1 -1
  395. package/esm/types/2_message_interactions.d.ts.map +1 -1
  396. package/esm/types/2_message_reaction_count.d.ts +4 -4
  397. package/esm/types/2_message_reaction_count.d.ts.map +1 -1
  398. package/esm/types/2_message_reactions.d.ts +4 -4
  399. package/esm/types/2_message_reactions.d.ts.map +1 -1
  400. package/esm/types/2_poll.d.ts +3 -3
  401. package/esm/types/2_poll.d.ts.map +1 -1
  402. package/esm/types/2_poll.js +3 -3
  403. package/esm/types/2_poll_answer.d.ts +22 -3
  404. package/esm/types/2_poll_answer.d.ts.map +1 -1
  405. package/esm/types/2_poll_answer.js +19 -0
  406. package/esm/types/2_pre_checkout_query.d.ts +4 -4
  407. package/esm/types/2_pre_checkout_query.d.ts.map +1 -1
  408. package/esm/types/2_reply_markup.d.ts +3 -3
  409. package/esm/types/2_reply_markup.d.ts.map +1 -1
  410. package/esm/types/2_reply_to.d.ts +2 -2
  411. package/esm/types/2_reply_to.d.ts.map +1 -1
  412. package/esm/types/2_sticker_set.d.ts +51 -0
  413. package/esm/types/2_sticker_set.d.ts.map +1 -0
  414. package/esm/types/2_sticker_set.js +91 -0
  415. package/esm/types/2_story_content.d.ts +2 -2
  416. package/esm/types/2_story_content.d.ts.map +1 -1
  417. package/esm/types/2_story_interactions.d.ts +2 -2
  418. package/esm/types/2_story_interactions.d.ts.map +1 -1
  419. package/esm/types/2_story_interactive_area.d.ts +5 -5
  420. package/esm/types/2_story_interactive_area.d.ts.map +1 -1
  421. package/esm/types/2_successful_payment.d.ts +2 -2
  422. package/esm/types/2_successful_payment.d.ts.map +1 -1
  423. package/esm/types/3_chat_member_updated.d.ts +5 -5
  424. package/esm/types/3_chat_member_updated.d.ts.map +1 -1
  425. package/esm/types/3_gift.d.ts +4 -4
  426. package/esm/types/3_gift.d.ts.map +1 -1
  427. package/esm/types/3_join_request.d.ts +4 -4
  428. package/esm/types/3_join_request.d.ts.map +1 -1
  429. package/esm/types/3_story.d.ts +8 -8
  430. package/esm/types/3_story.d.ts.map +1 -1
  431. package/esm/types/4_claimed_gift.d.ts +4 -4
  432. package/esm/types/4_claimed_gift.d.ts.map +1 -1
  433. package/esm/types/4_link_preview.d.ts +5 -5
  434. package/esm/types/4_link_preview.d.ts.map +1 -1
  435. package/esm/types/5_claimed_gifts.d.ts +2 -2
  436. package/esm/types/5_claimed_gifts.d.ts.map +1 -1
  437. package/esm/types/5_claimed_gifts.js +3 -3
  438. package/esm/types/5_message.d.ts +29 -29
  439. package/esm/types/5_message.d.ts.map +1 -1
  440. package/esm/types/5_message.js +8 -8
  441. package/esm/types/5_message_content.d.ts +4 -4
  442. package/esm/types/5_message_content.d.ts.map +1 -1
  443. package/esm/types/6_callback_query.d.ts +3 -3
  444. package/esm/types/6_callback_query.d.ts.map +1 -1
  445. package/esm/types/6_callback_query.js +2 -2
  446. package/esm/types/6_chat_list_item.d.ts +4 -4
  447. package/esm/types/6_chat_list_item.d.ts.map +1 -1
  448. package/esm/types/6_chat_list_item.js +6 -6
  449. package/esm/types/6_inline_query_result.d.ts +6 -6
  450. package/esm/types/6_inline_query_result.d.ts.map +1 -1
  451. package/esm/types/6_inline_query_result.js +16 -16
  452. package/esm/types/6_saved_chat.d.ts +36 -0
  453. package/esm/types/6_saved_chat.d.ts.map +1 -0
  454. package/esm/types/6_saved_chat.js +43 -0
  455. package/esm/types/6_topic.d.ts +2 -2
  456. package/esm/types/6_topic.d.ts.map +1 -1
  457. package/esm/types/6_topic.js +1 -1
  458. package/esm/types/7_inline_query_answer.d.ts +2 -2
  459. package/esm/types/7_inline_query_answer.d.ts.map +1 -1
  460. package/esm/types/7_saved_chats.d.ts +33 -0
  461. package/esm/types/7_saved_chats.d.ts.map +1 -0
  462. package/esm/types/7_saved_chats.js +36 -0
  463. package/esm/types/7_update.d.ts +44 -25
  464. package/esm/types/7_update.d.ts.map +1 -1
  465. package/esm/types/_file_id.d.ts +60 -49
  466. package/esm/types/_file_id.d.ts.map +1 -1
  467. package/esm/types/_file_id.js +92 -73
  468. package/esm/types/_getters.d.ts +3 -3
  469. package/esm/types/_getters.d.ts.map +1 -1
  470. package/esm/utilities/0_bigint.js +5 -5
  471. package/esm/utilities/0_bigint_test.d.ts.map +1 -1
  472. package/esm/utilities/0_buffer.d.ts +1 -1
  473. package/esm/utilities/0_buffer.d.ts.map +1 -1
  474. package/esm/utilities/0_buffer.js +3 -3
  475. package/esm/utilities/0_buffer_test.d.ts.map +1 -1
  476. package/esm/utilities/0_env.js +1 -1
  477. package/esm/utilities/0_hash.d.ts +2 -2
  478. package/esm/utilities/0_hash.d.ts.map +1 -1
  479. package/esm/utilities/0_misc.d.ts.map +1 -1
  480. package/esm/utilities/0_misc.js +4 -3
  481. package/esm/utilities/0_mutex.js +4 -19
  482. package/esm/utilities/0_part_stream.js +11 -25
  483. package/esm/utilities/0_part_stream_test.d.ts.map +1 -1
  484. package/esm/utilities/0_rle.d.ts +2 -2
  485. package/esm/utilities/0_rle.d.ts.map +1 -1
  486. package/esm/utilities/0_rle.js +1 -1
  487. package/esm/utilities/0_rle_test.d.ts.map +1 -1
  488. package/esm/utilities/0_text.d.ts +20 -1
  489. package/esm/utilities/0_text.d.ts.map +1 -1
  490. package/esm/utilities/0_text.js +19 -0
  491. package/esm/utilities/1_auth.d.ts +1 -1
  492. package/esm/utilities/1_auth.d.ts.map +1 -1
  493. package/esm/utilities/1_auth.js +1 -1
  494. package/esm/utilities/1_base64.d.ts +1 -1
  495. package/esm/utilities/1_base64.d.ts.map +1 -1
  496. package/esm/utilities/1_base64.js +1 -1
  497. package/esm/utilities/1_base64_test.d.ts.map +1 -1
  498. package/esm/utilities/1_crypto.js +42 -53
  499. package/esm/utilities/1_crypto_test.d.ts.map +1 -1
  500. package/esm/utilities/1_logger.d.ts +2 -2
  501. package/esm/utilities/1_logger.js +2 -2
  502. package/esm/utilities/1_math.js +2 -2
  503. package/esm/utilities/1_math_test.d.ts.map +1 -1
  504. package/esm/utilities/2_queue.js +29 -47
  505. package/package.json +1 -1
  506. package/script/0_deps.d.ts +12 -12
  507. package/script/0_deps.js +14 -14
  508. package/script/0_errors.js +2 -6
  509. package/script/2_tl.js +17 -7
  510. package/script/3_errors.js +2 -12
  511. package/script/3_types.d.ts +4 -0
  512. package/script/3_types.d.ts.map +1 -1
  513. package/script/3_types.js +4 -0
  514. package/script/4_constants.d.ts +1 -1
  515. package/script/4_constants.d.ts.map +1 -1
  516. package/script/4_constants.js +17 -7
  517. package/script/4_errors.d.ts +2 -2
  518. package/script/4_errors.d.ts.map +1 -1
  519. package/script/4_errors.js +2 -12
  520. package/script/_dnt.polyfills.d.ts +99 -0
  521. package/script/_dnt.polyfills.d.ts.map +1 -1
  522. package/script/_dnt.polyfills.js +128 -0
  523. package/script/_dnt.test_polyfills.d.ts.map +1 -0
  524. package/script/client/0_client_abstract.d.ts +3 -3
  525. package/script/client/0_client_abstract.d.ts.map +1 -1
  526. package/script/client/0_filters.d.ts +1 -1
  527. package/script/client/0_filters.d.ts.map +1 -1
  528. package/script/client/0_filters.js +3 -3
  529. package/script/client/0_filters_test.d.ts.map +1 -1
  530. package/script/client/0_html.d.ts +1 -1
  531. package/script/client/0_html.d.ts.map +1 -1
  532. package/script/client/0_html.js +1 -1
  533. package/script/client/0_markdown.d.ts +1 -1
  534. package/script/client/0_markdown.d.ts.map +1 -1
  535. package/script/client/0_markdown.js +8 -8
  536. package/script/client/0_markdown_test.d.ts.map +1 -1
  537. package/script/client/0_params.d.ts +44 -8
  538. package/script/client/0_params.d.ts.map +1 -1
  539. package/script/client/0_password.d.ts +5 -5
  540. package/script/client/0_password.d.ts.map +1 -1
  541. package/script/client/0_password.js +18 -8
  542. package/script/client/0_password_test.d.ts.map +1 -1
  543. package/script/client/0_storage_operations.d.ts +4 -4
  544. package/script/client/0_storage_operations.d.ts.map +1 -1
  545. package/script/client/0_storage_operations.js +159 -171
  546. package/script/client/0_storage_operations_test.d.ts.map +1 -1
  547. package/script/client/0_update_processor.d.ts +2 -2
  548. package/script/client/0_update_processor.d.ts.map +1 -1
  549. package/script/client/0_utilities.d.ts +1 -1
  550. package/script/client/0_utilities.js +8 -8
  551. package/script/client/0_utilities_test.d.ts.map +1 -1
  552. package/script/client/1_client_plain.d.ts +3 -3
  553. package/script/client/1_client_plain.d.ts.map +1 -1
  554. package/script/client/1_client_plain.js +5 -23
  555. package/script/client/1_composer.d.ts +3 -3
  556. package/script/client/1_composer.d.ts.map +1 -1
  557. package/script/client/1_composer.js +14 -27
  558. package/script/client/1_types.d.ts +4 -4
  559. package/script/client/1_types.d.ts.map +1 -1
  560. package/script/client/2_account_manager.d.ts +3 -3
  561. package/script/client/2_account_manager.d.ts.map +1 -1
  562. package/script/client/2_account_manager.js +86 -98
  563. package/script/client/2_bot_info_manager.d.ts +3 -3
  564. package/script/client/2_bot_info_manager.d.ts.map +1 -1
  565. package/script/client/2_bot_info_manager.js +26 -38
  566. package/script/client/2_business_connection_manager.d.ts +3 -3
  567. package/script/client/2_business_connection_manager.d.ts.map +1 -1
  568. package/script/client/2_business_connection_manager.js +10 -23
  569. package/script/client/2_client_encrypted.d.ts +2 -2
  570. package/script/client/2_client_encrypted.d.ts.map +1 -1
  571. package/script/client/2_client_encrypted.js +195 -212
  572. package/script/client/2_file_manager.d.ts +7 -6
  573. package/script/client/2_file_manager.d.ts.map +1 -1
  574. package/script/client/2_file_manager.js +320 -252
  575. package/script/client/2_file_manager_test.d.ts.map +1 -1
  576. package/script/client/2_network_statistics_manager.d.ts +1 -1
  577. package/script/client/2_network_statistics_manager.d.ts.map +1 -1
  578. package/script/client/2_network_statistics_manager.js +8 -21
  579. package/script/client/2_payment_manager.d.ts +4 -4
  580. package/script/client/2_payment_manager.d.ts.map +1 -1
  581. package/script/client/2_payment_manager.js +7 -20
  582. package/script/client/2_reaction_manager.d.ts +3 -3
  583. package/script/client/2_reaction_manager.d.ts.map +1 -1
  584. package/script/client/2_reaction_manager.js +7 -20
  585. package/script/client/2_translations_manager.d.ts +4 -4
  586. package/script/client/2_translations_manager.d.ts.map +1 -1
  587. package/script/client/2_translations_manager.js +98 -108
  588. package/script/client/2_update_manager.d.ts +2 -2
  589. package/script/client/2_update_manager.d.ts.map +1 -1
  590. package/script/client/2_update_manager.js +766 -761
  591. package/script/client/3_client_encrypted_pool.d.ts +1 -1
  592. package/script/client/3_client_encrypted_pool.d.ts.map +1 -1
  593. package/script/client/3_client_encrypted_pool.js +10 -26
  594. package/script/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  595. package/script/client/3_message_manager.d.ts +11 -8
  596. package/script/client/3_message_manager.d.ts.map +1 -1
  597. package/script/client/3_message_manager.js +580 -466
  598. package/script/client/3_message_manager_test.d.ts.map +1 -1
  599. package/script/client/3_video_chat_manager.d.ts +6 -6
  600. package/script/client/3_video_chat_manager.d.ts.map +1 -1
  601. package/script/client/3_video_chat_manager.js +61 -72
  602. package/script/client/4_callback_query_manager.d.ts +5 -5
  603. package/script/client/4_callback_query_manager.d.ts.map +1 -1
  604. package/script/client/4_callback_query_manager.js +18 -30
  605. package/script/client/4_chat_list_manager.d.ts +6 -6
  606. package/script/client/4_chat_list_manager.d.ts.map +1 -1
  607. package/script/client/4_chat_list_manager.js +328 -324
  608. package/script/client/4_chat_manager.d.ts +7 -7
  609. package/script/client/4_chat_manager.d.ts.map +1 -1
  610. package/script/client/4_chat_manager.js +120 -133
  611. package/script/client/4_forum_manager.d.ts +4 -4
  612. package/script/client/4_forum_manager.d.ts.map +1 -1
  613. package/script/client/4_forum_manager.js +67 -73
  614. package/script/client/4_gift_manager.d.ts +4 -4
  615. package/script/client/4_gift_manager.d.ts.map +1 -1
  616. package/script/client/4_gift_manager.js +17 -30
  617. package/script/client/4_inline_query_manager.d.ts +5 -5
  618. package/script/client/4_inline_query_manager.d.ts.map +1 -1
  619. package/script/client/4_inline_query_manager.js +16 -28
  620. package/script/client/4_link_preview_manager.d.ts +5 -5
  621. package/script/client/4_link_preview_manager.d.ts.map +1 -1
  622. package/script/client/4_link_preview_manager.js +6 -19
  623. package/script/client/4_poll_manager.d.ts +4 -4
  624. package/script/client/4_poll_manager.d.ts.map +1 -1
  625. package/script/client/4_poll_manager.js +44 -57
  626. package/script/client/4_story_manager.d.ts +7 -7
  627. package/script/client/4_story_manager.d.ts.map +1 -1
  628. package/script/client/4_story_manager.js +43 -55
  629. package/script/client/5_client.d.ts +34 -15
  630. package/script/client/5_client.d.ts.map +1 -1
  631. package/script/client/5_client.js +1299 -1291
  632. package/script/connection/0_connection.d.ts +1 -1
  633. package/script/connection/0_connection.d.ts.map +1 -1
  634. package/script/connection/1_connection_tcp.node.d.ts +1 -1
  635. package/script/connection/1_connection_tcp.node.d.ts.map +1 -1
  636. package/script/connection/1_connection_tcp.node.js +49 -66
  637. package/script/connection/1_connection_web_socket.d.ts +1 -1
  638. package/script/connection/1_connection_web_socket.d.ts.map +1 -1
  639. package/script/connection/1_connection_web_socket.js +92 -98
  640. package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  641. package/{esm/deps/jsr.io/@std/assert/1.0.13 → script/deps/jsr.io/@std/assert/1.0.14}/assert.d.ts.map +1 -1
  642. package/script/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts +26 -0
  643. package/script/deps/jsr.io/@std/assert/1.0.14/assertion_error.d.ts.map +1 -0
  644. package/script/deps/jsr.io/@std/assert/1.0.14/assertion_error.js +34 -0
  645. package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts.map +1 -1
  646. package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.js +17 -7
  647. package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts.map +1 -1
  648. package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts.map +1 -1
  649. package/script/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts +15 -0
  650. package/script/deps/jsr.io/@std/assert/1.0.14/unreachable.d.ts.map +1 -0
  651. package/script/deps/jsr.io/@std/assert/1.0.14/unreachable.js +23 -0
  652. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts.map +1 -1
  653. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts.map +1 -1
  654. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts.map +1 -1
  655. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts.map +1 -1
  656. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts.map +1 -1
  657. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.js +34 -9
  658. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts.map +1 -1
  659. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts.map +1 -1
  660. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.js +31 -47
  661. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts.map +1 -1
  662. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts.map +1 -1
  663. package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts.map +1 -1
  664. package/script/deps/jsr.io/@std/async/1.0.14/tee.js +82 -0
  665. package/script/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  666. package/script/deps/jsr.io/@std/internal/1.0.10/_os.d.ts +2 -0
  667. package/script/deps/jsr.io/@std/internal/1.0.10/_os.d.ts.map +1 -0
  668. package/script/deps/jsr.io/@std/internal/1.0.10/_os.js +48 -0
  669. package/script/deps/jsr.io/@std/internal/1.0.10/format.js +17 -7
  670. package/script/deps/jsr.io/@std/internal/1.0.10/os.d.ts +3 -0
  671. package/script/deps/jsr.io/@std/internal/1.0.10/os.d.ts.map +1 -0
  672. package/script/deps/jsr.io/@std/internal/1.0.10/os.js +8 -0
  673. package/script/deps/jsr.io/@std/internal/1.0.10/styles.js +17 -7
  674. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts.map +1 -1
  675. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts.map +1 -1
  676. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts.map +1 -1
  677. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts.map +1 -1
  678. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts.map +1 -1
  679. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts.map +1 -1
  680. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts.map +1 -1
  681. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts.map +1 -1
  682. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/basename.d.ts.map +1 -1
  683. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.js +2 -2
  684. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts.map +1 -1
  685. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.js +2 -2
  686. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts.map +1 -1
  687. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.js +2 -2
  688. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts.map +1 -1
  689. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.js +2 -2
  690. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts.map +1 -1
  691. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/basename.d.ts.map +1 -1
  692. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/extname.d.ts.map +1 -1
  693. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts.map +1 -1
  694. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts.map +1 -1
  695. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/join.d.ts.map +1 -1
  696. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/normalize.d.ts.map +1 -1
  697. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/posix/to_file_url.d.ts.map +1 -1
  698. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/to_file_url.d.ts.map +1 -1
  699. package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.js +2 -2
  700. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/_util.d.ts.map +1 -1
  701. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/basename.d.ts.map +1 -1
  702. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/extname.d.ts.map +1 -1
  703. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/from_file_url.d.ts.map +1 -1
  704. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/is_absolute.d.ts.map +1 -1
  705. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/join.d.ts.map +1 -1
  706. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/normalize.d.ts.map +1 -1
  707. package/{esm/deps/jsr.io/@std/path/1.1.0 → script/deps/jsr.io/@std/path/1.1.2}/windows/to_file_url.d.ts.map +1 -1
  708. package/script/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts.map +1 -1
  709. package/script/mod.js +19 -19
  710. package/script/session/0_session_state.js +12 -38
  711. package/script/session/1_session.d.ts +2 -2
  712. package/script/session/1_session.d.ts.map +1 -1
  713. package/script/session/1_session.js +66 -79
  714. package/script/session/2_session_encrypted.d.ts +2 -2
  715. package/script/session/2_session_encrypted.d.ts.map +1 -1
  716. package/script/session/2_session_encrypted.js +325 -321
  717. package/script/session/2_session_plain.js +1 -1
  718. package/script/storage/0_storage.d.ts +1 -1
  719. package/script/storage/0_storage.d.ts.map +1 -1
  720. package/script/storage/1_utilities.d.ts +14 -11
  721. package/script/storage/1_utilities.d.ts.map +1 -1
  722. package/script/storage/1_utilities.js +39 -39
  723. package/script/storage/1_utilities_test.d.ts.map +1 -1
  724. package/script/storage/2_storage_indexed_db.d.ts +1 -1
  725. package/script/storage/2_storage_indexed_db.d.ts.map +1 -1
  726. package/script/storage/2_storage_indexed_db.js +29 -47
  727. package/script/storage/2_storage_local_storage.node.d.ts +1 -1
  728. package/script/storage/2_storage_local_storage.node.d.ts.map +1 -1
  729. package/script/storage/2_storage_local_storage.node.js +15 -28
  730. package/script/storage/2_storage_memory.d.ts +2 -2
  731. package/script/storage/2_storage_memory.d.ts.map +1 -1
  732. package/script/storage/2_storage_memory.js +26 -43
  733. package/script/storage/2_storage_session_storage.d.ts +2 -2
  734. package/script/storage/2_storage_session_storage.d.ts.map +1 -1
  735. package/script/storage/2_storage_session_storage.js +6 -19
  736. package/script/tl/0_utilities.js +1 -1
  737. package/script/tl/0_utilities_test.d.ts.map +1 -1
  738. package/script/tl/1_tl_reader.d.ts +1 -1
  739. package/script/tl/1_tl_reader.d.ts.map +1 -1
  740. package/script/tl/1_tl_reader.js +83 -91
  741. package/script/tl/1_tl_reader_test.d.ts.map +1 -1
  742. package/script/tl/1_tl_writer.d.ts +1 -1
  743. package/script/tl/1_tl_writer.d.ts.map +1 -1
  744. package/script/tl/1_tl_writer.js +156 -165
  745. package/script/tl/1_tl_writer_test.d.ts.map +1 -1
  746. package/script/tl/1_utilities.d.ts +1 -1
  747. package/script/tl/1_utilities.d.ts.map +1 -1
  748. package/script/tl/1_utilities.js +2 -2
  749. package/script/tl/2_message.js +1 -1
  750. package/script/tl/2_mtproto.d.ts +1 -1
  751. package/script/tl/2_mtproto.d.ts.map +1 -1
  752. package/script/tl/2_telegram.d.ts +1 -1
  753. package/script/tl/2_telegram.d.ts.map +1 -1
  754. package/script/tl/2_telegram.js +17 -7
  755. package/script/transport/0_obfuscation.d.ts +1 -1
  756. package/script/transport/0_obfuscation.d.ts.map +1 -1
  757. package/script/transport/0_obfuscation.js +19 -9
  758. package/script/transport/0_transport.d.ts +1 -1
  759. package/script/transport/0_transport.d.ts.map +1 -1
  760. package/script/transport/0_transport.js +1 -8
  761. package/script/transport/1_transport_abridged.d.ts +1 -1
  762. package/script/transport/1_transport_abridged.d.ts.map +1 -1
  763. package/script/transport/1_transport_abridged.js +11 -24
  764. package/script/transport/1_transport_intermediate.d.ts +1 -1
  765. package/script/transport/1_transport_intermediate.d.ts.map +1 -1
  766. package/script/transport/1_transport_intermediate.js +10 -23
  767. package/script/transport/1_transport_provider.d.ts +2 -2
  768. package/script/transport/1_transport_provider.d.ts.map +1 -1
  769. package/script/transport/2_transport_provider_tcp.d.ts +1 -1
  770. package/script/transport/2_transport_provider_tcp.d.ts.map +1 -1
  771. package/script/transport/2_transport_provider_web_socket.d.ts +1 -1
  772. package/script/transport/2_transport_provider_web_socket.d.ts.map +1 -1
  773. package/script/transport/2_transport_provider_web_socket.js +1 -1
  774. package/script/types/0_birthday.d.ts +1 -1
  775. package/script/types/0_birthday.d.ts.map +1 -1
  776. package/script/types/0_callback_query_answer.d.ts +1 -1
  777. package/script/types/0_callback_query_answer.d.ts.map +1 -1
  778. package/script/types/0_callback_query_question.js +2 -2
  779. package/script/types/0_chat_administrator_rights.d.ts +1 -1
  780. package/script/types/0_chat_administrator_rights.d.ts.map +1 -1
  781. package/script/types/0_chat_member_rights.d.ts +1 -1
  782. package/script/types/0_chat_member_rights.d.ts.map +1 -1
  783. package/script/types/0_contact.d.ts +1 -1
  784. package/script/types/0_contact.d.ts.map +1 -1
  785. package/script/types/0_dice.d.ts +1 -1
  786. package/script/types/0_dice.d.ts.map +1 -1
  787. package/script/types/0_failed_invitation.d.ts +1 -1
  788. package/script/types/0_failed_invitation.d.ts.map +1 -1
  789. package/script/types/0_invoice.d.ts +1 -1
  790. package/script/types/0_invoice.d.ts.map +1 -1
  791. package/script/types/0_live_stream_channel.d.ts +1 -1
  792. package/script/types/0_live_stream_channel.d.ts.map +1 -1
  793. package/script/types/0_mask_position.d.ts +1 -1
  794. package/script/types/0_mask_position.d.ts.map +1 -1
  795. package/script/types/0_mask_position.js +1 -1
  796. package/script/types/0_message_entity.d.ts +1 -1
  797. package/script/types/0_message_entity.d.ts.map +1 -1
  798. package/script/types/0_message_entity.js +1 -1
  799. package/script/types/0_message_search_filter.d.ts +1 -1
  800. package/script/types/0_message_search_filter.d.ts.map +1 -1
  801. package/script/types/0_opening_hours.d.ts +1 -1
  802. package/script/types/0_opening_hours.d.ts.map +1 -1
  803. package/script/types/0_reaction.js +5 -5
  804. package/script/types/0_refunded_payment.d.ts +1 -1
  805. package/script/types/0_refunded_payment.d.ts.map +1 -1
  806. package/script/types/0_restriction_reason.d.ts +1 -1
  807. package/script/types/0_restriction_reason.d.ts.map +1 -1
  808. package/script/types/0_self_destruct_option.js +3 -3
  809. package/script/types/0_shipping_address.d.ts +1 -1
  810. package/script/types/0_shipping_address.d.ts.map +1 -1
  811. package/script/types/0_slow_mode_duration.js +2 -2
  812. package/script/types/0_upload_progress.d.ts +29 -0
  813. package/script/types/0_upload_progress.d.ts.map +1 -0
  814. package/script/types/0_upload_progress.js +21 -0
  815. package/script/types/0_voice.d.ts +1 -1
  816. package/script/types/0_voice.d.ts.map +1 -1
  817. package/script/types/0_voice_transcription.d.ts +1 -1
  818. package/script/types/0_voice_transcription.d.ts.map +1 -1
  819. package/script/types/1_animation.d.ts +1 -1
  820. package/script/types/1_animation.d.ts.map +1 -1
  821. package/script/types/1_audio.d.ts +1 -1
  822. package/script/types/1_audio.d.ts.map +1 -1
  823. package/script/types/1_bot_command_scope.d.ts +2 -2
  824. package/script/types/1_bot_command_scope.d.ts.map +1 -1
  825. package/script/types/1_chat_p.d.ts +2 -2
  826. package/script/types/1_chat_p.d.ts.map +1 -1
  827. package/script/types/1_chat_p.js +2 -2
  828. package/script/types/1_document.d.ts +1 -1
  829. package/script/types/1_document.d.ts.map +1 -1
  830. package/script/types/1_giveaway.d.ts +2 -2
  831. package/script/types/1_giveaway.d.ts.map +1 -1
  832. package/script/types/1_inline_keyboard_button.d.ts +3 -3
  833. package/script/types/1_inline_keyboard_button.d.ts.map +1 -1
  834. package/script/types/1_inline_keyboard_button.js +4 -4
  835. package/script/types/1_inline_query_result_button.d.ts +1 -1
  836. package/script/types/1_inline_query_result_button.d.ts.map +1 -1
  837. package/script/types/1_input_media.d.ts +4 -4
  838. package/script/types/1_input_media.d.ts.map +1 -1
  839. package/script/types/1_input_story_content.d.ts +1 -1
  840. package/script/types/1_input_story_content.d.ts.map +1 -1
  841. package/script/types/1_keyboard_button.d.ts +3 -3
  842. package/script/types/1_keyboard_button.d.ts.map +1 -1
  843. package/script/types/1_keyboard_button.js +1 -1
  844. package/script/types/1_message_reaction.d.ts +1 -1
  845. package/script/types/1_message_reaction.d.ts.map +1 -1
  846. package/script/types/1_message_reaction.js +2 -2
  847. package/script/types/1_mini_app_info.d.ts +2 -2
  848. package/script/types/1_mini_app_info.d.ts.map +1 -1
  849. package/script/types/1_network_statistics.d.ts +1 -1
  850. package/script/types/1_network_statistics.d.ts.map +1 -1
  851. package/script/types/1_order_info.d.ts +2 -2
  852. package/script/types/1_order_info.d.ts.map +1 -1
  853. package/script/types/1_photo.d.ts +1 -1
  854. package/script/types/1_photo.d.ts.map +1 -1
  855. package/script/types/1_poll_option.d.ts +2 -2
  856. package/script/types/1_poll_option.d.ts.map +1 -1
  857. package/script/types/1_poll_option.js +2 -2
  858. package/script/types/1_reaction_count.d.ts +2 -2
  859. package/script/types/1_reaction_count.d.ts.map +1 -1
  860. package/script/types/1_reply_quote.d.ts +2 -2
  861. package/script/types/1_reply_quote.d.ts.map +1 -1
  862. package/script/types/1_sticker.d.ts +4 -4
  863. package/script/types/1_sticker.d.ts.map +1 -1
  864. package/script/types/1_sticker.js +2 -2
  865. package/script/types/1_story_privacy.d.ts +1 -1
  866. package/script/types/1_story_privacy.d.ts.map +1 -1
  867. package/script/types/1_story_reaction.d.ts +2 -2
  868. package/script/types/1_story_reaction.d.ts.map +1 -1
  869. package/script/types/1_user.d.ts +2 -2
  870. package/script/types/1_user.d.ts.map +1 -1
  871. package/script/types/1_user.js +1 -1
  872. package/script/types/1_venue.d.ts +1 -1
  873. package/script/types/1_venue.d.ts.map +1 -1
  874. package/script/types/1_video.d.ts +1 -1
  875. package/script/types/1_video.d.ts.map +1 -1
  876. package/script/types/1_video_note.d.ts +1 -1
  877. package/script/types/1_video_note.d.ts.map +1 -1
  878. package/script/types/2_business_connection.d.ts +3 -3
  879. package/script/types/2_business_connection.d.ts.map +1 -1
  880. package/script/types/2_chat.d.ts +6 -6
  881. package/script/types/2_chat.d.ts.map +1 -1
  882. package/script/types/2_chat.js +3 -3
  883. package/script/types/2_chat_member.d.ts +4 -4
  884. package/script/types/2_chat_member.d.ts.map +1 -1
  885. package/script/types/2_chat_member.js +1 -1
  886. package/script/types/2_chat_settings.d.ts +1 -1
  887. package/script/types/2_chat_settings.d.ts.map +1 -1
  888. package/script/types/2_chat_settings.js +1 -1
  889. package/script/types/2_chosen_inline_result.d.ts +3 -3
  890. package/script/types/2_chosen_inline_result.d.ts.map +1 -1
  891. package/script/types/2_forward_header.d.ts +4 -4
  892. package/script/types/2_forward_header.d.ts.map +1 -1
  893. package/script/types/2_forward_header.js +6 -6
  894. package/script/types/2_game.d.ts +3 -3
  895. package/script/types/2_game.d.ts.map +1 -1
  896. package/script/types/2_gift_upgraded_component.d.ts +2 -2
  897. package/script/types/2_gift_upgraded_component.d.ts.map +1 -1
  898. package/script/types/2_inactive_chat.d.ts +1 -1
  899. package/script/types/2_inactive_chat.d.ts.map +1 -1
  900. package/script/types/2_inline_query.d.ts +3 -3
  901. package/script/types/2_inline_query.d.ts.map +1 -1
  902. package/script/types/2_inline_query.js +1 -1
  903. package/script/types/2_invite_link.d.ts +3 -3
  904. package/script/types/2_invite_link.d.ts.map +1 -1
  905. package/script/types/2_message_interactions.d.ts +1 -1
  906. package/script/types/2_message_interactions.d.ts.map +1 -1
  907. package/script/types/2_message_reaction_count.d.ts +4 -4
  908. package/script/types/2_message_reaction_count.d.ts.map +1 -1
  909. package/script/types/2_message_reactions.d.ts +4 -4
  910. package/script/types/2_message_reactions.d.ts.map +1 -1
  911. package/script/types/2_poll.d.ts +3 -3
  912. package/script/types/2_poll.d.ts.map +1 -1
  913. package/script/types/2_poll.js +3 -3
  914. package/script/types/2_poll_answer.d.ts +22 -3
  915. package/script/types/2_poll_answer.d.ts.map +1 -1
  916. package/script/types/2_poll_answer.js +19 -0
  917. package/script/types/2_pre_checkout_query.d.ts +4 -4
  918. package/script/types/2_pre_checkout_query.d.ts.map +1 -1
  919. package/script/types/2_reply_markup.d.ts +3 -3
  920. package/script/types/2_reply_markup.d.ts.map +1 -1
  921. package/script/types/2_reply_to.d.ts +2 -2
  922. package/script/types/2_reply_to.d.ts.map +1 -1
  923. package/script/types/2_sticker_set.d.ts +51 -0
  924. package/script/types/2_sticker_set.d.ts.map +1 -0
  925. package/script/types/2_sticker_set.js +94 -0
  926. package/script/types/2_story_content.d.ts +2 -2
  927. package/script/types/2_story_content.d.ts.map +1 -1
  928. package/script/types/2_story_interactions.d.ts +2 -2
  929. package/script/types/2_story_interactions.d.ts.map +1 -1
  930. package/script/types/2_story_interactive_area.d.ts +5 -5
  931. package/script/types/2_story_interactive_area.d.ts.map +1 -1
  932. package/script/types/2_successful_payment.d.ts +2 -2
  933. package/script/types/2_successful_payment.d.ts.map +1 -1
  934. package/script/types/3_chat_member_updated.d.ts +5 -5
  935. package/script/types/3_chat_member_updated.d.ts.map +1 -1
  936. package/script/types/3_gift.d.ts +4 -4
  937. package/script/types/3_gift.d.ts.map +1 -1
  938. package/script/types/3_join_request.d.ts +4 -4
  939. package/script/types/3_join_request.d.ts.map +1 -1
  940. package/script/types/3_story.d.ts +8 -8
  941. package/script/types/3_story.d.ts.map +1 -1
  942. package/script/types/4_claimed_gift.d.ts +4 -4
  943. package/script/types/4_claimed_gift.d.ts.map +1 -1
  944. package/script/types/4_link_preview.d.ts +5 -5
  945. package/script/types/4_link_preview.d.ts.map +1 -1
  946. package/script/types/5_claimed_gifts.d.ts +2 -2
  947. package/script/types/5_claimed_gifts.d.ts.map +1 -1
  948. package/script/types/5_claimed_gifts.js +3 -3
  949. package/script/types/5_message.d.ts +29 -29
  950. package/script/types/5_message.d.ts.map +1 -1
  951. package/script/types/5_message.js +8 -8
  952. package/script/types/5_message_content.d.ts +4 -4
  953. package/script/types/5_message_content.d.ts.map +1 -1
  954. package/script/types/6_callback_query.d.ts +3 -3
  955. package/script/types/6_callback_query.d.ts.map +1 -1
  956. package/script/types/6_callback_query.js +2 -2
  957. package/script/types/6_chat_list_item.d.ts +4 -4
  958. package/script/types/6_chat_list_item.d.ts.map +1 -1
  959. package/script/types/6_chat_list_item.js +6 -6
  960. package/script/types/6_inline_query_result.d.ts +6 -6
  961. package/script/types/6_inline_query_result.d.ts.map +1 -1
  962. package/script/types/6_inline_query_result.js +16 -16
  963. package/script/types/6_saved_chat.d.ts +36 -0
  964. package/script/types/6_saved_chat.d.ts.map +1 -0
  965. package/script/types/6_saved_chat.js +46 -0
  966. package/script/types/6_topic.d.ts +2 -2
  967. package/script/types/6_topic.d.ts.map +1 -1
  968. package/script/types/6_topic.js +1 -1
  969. package/script/types/7_inline_query_answer.d.ts +2 -2
  970. package/script/types/7_inline_query_answer.d.ts.map +1 -1
  971. package/script/types/7_saved_chats.d.ts +33 -0
  972. package/script/types/7_saved_chats.d.ts.map +1 -0
  973. package/script/types/7_saved_chats.js +39 -0
  974. package/script/types/7_update.d.ts +44 -25
  975. package/script/types/7_update.d.ts.map +1 -1
  976. package/script/types/_file_id.d.ts +60 -49
  977. package/script/types/_file_id.d.ts.map +1 -1
  978. package/script/types/_file_id.js +155 -136
  979. package/script/types/_getters.d.ts +3 -3
  980. package/script/types/_getters.d.ts.map +1 -1
  981. package/script/utilities/0_bigint.js +22 -12
  982. package/script/utilities/0_bigint_test.d.ts.map +1 -1
  983. package/script/utilities/0_buffer.d.ts +1 -1
  984. package/script/utilities/0_buffer.d.ts.map +1 -1
  985. package/script/utilities/0_buffer.js +3 -3
  986. package/script/utilities/0_buffer_test.d.ts.map +1 -1
  987. package/script/utilities/0_env.js +18 -8
  988. package/script/utilities/0_hash.d.ts +2 -2
  989. package/script/utilities/0_hash.d.ts.map +1 -1
  990. package/script/utilities/0_hash.js +17 -7
  991. package/script/utilities/0_misc.d.ts.map +1 -1
  992. package/script/utilities/0_misc.js +21 -10
  993. package/script/utilities/0_mutex.js +4 -19
  994. package/script/utilities/0_part_stream.js +11 -25
  995. package/script/utilities/0_part_stream_test.d.ts.map +1 -1
  996. package/script/utilities/0_rle.d.ts +2 -2
  997. package/script/utilities/0_rle.d.ts.map +1 -1
  998. package/script/utilities/0_rle.js +1 -1
  999. package/script/utilities/0_rle_test.d.ts.map +1 -1
  1000. package/script/utilities/0_text.d.ts +20 -1
  1001. package/script/utilities/0_text.d.ts.map +1 -1
  1002. package/script/utilities/0_text.js +19 -0
  1003. package/script/utilities/1_auth.d.ts +1 -1
  1004. package/script/utilities/1_auth.d.ts.map +1 -1
  1005. package/script/utilities/1_auth.js +18 -8
  1006. package/script/utilities/1_base64.d.ts +1 -1
  1007. package/script/utilities/1_base64.d.ts.map +1 -1
  1008. package/script/utilities/1_base64.js +1 -1
  1009. package/script/utilities/1_base64_test.d.ts.map +1 -1
  1010. package/script/utilities/1_crypto.js +60 -61
  1011. package/script/utilities/1_crypto_test.d.ts.map +1 -1
  1012. package/script/utilities/1_logger.d.ts +2 -2
  1013. package/script/utilities/1_logger.js +2 -2
  1014. package/script/utilities/1_math.js +2 -2
  1015. package/script/utilities/1_math_test.d.ts.map +1 -1
  1016. package/script/utilities/2_queue.js +30 -48
  1017. package/esm/deps/jsr.io/@std/async/1.0.13/tee.js +0 -102
  1018. package/esm/deps/jsr.io/@std/path/1.1.0/_os.d.ts +0 -2
  1019. package/esm/deps/jsr.io/@std/path/1.1.0/_os.d.ts.map +0 -1
  1020. package/esm/deps/jsr.io/@std/path/1.1.0/_os.js +0 -9
  1021. package/script/deps/jsr.io/@std/async/1.0.13/tee.js +0 -105
  1022. package/script/deps/jsr.io/@std/path/1.1.0/_os.d.ts +0 -2
  1023. package/script/deps/jsr.io/@std/path/1.1.0/_os.d.ts.map +0 -1
  1024. package/script/deps/jsr.io/@std/path/1.1.0/_os.js +0 -35
  1025. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.d.ts +0 -0
  1026. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.js +0 -0
  1027. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts +0 -0
  1028. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.js +0 -0
  1029. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts +0 -0
  1030. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.js +0 -0
  1031. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts +0 -0
  1032. /package/esm/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.js +0 -0
  1033. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts +0 -0
  1034. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.js +0 -0
  1035. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts +0 -0
  1036. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.js +0 -0
  1037. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts +0 -0
  1038. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.js +0 -0
  1039. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts +0 -0
  1040. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.js +0 -0
  1041. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts +0 -0
  1042. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts +0 -0
  1043. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.js +0 -0
  1044. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts +0 -0
  1045. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts +0 -0
  1046. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.js +0 -0
  1047. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts +0 -0
  1048. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.js +0 -0
  1049. /package/esm/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts +0 -0
  1050. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts +0 -0
  1051. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.js +0 -0
  1052. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts +0 -0
  1053. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.js +0 -0
  1054. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts +0 -0
  1055. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.js +0 -0
  1056. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts +0 -0
  1057. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.js +0 -0
  1058. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts +0 -0
  1059. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.js +0 -0
  1060. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts +0 -0
  1061. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.js +0 -0
  1062. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts +0 -0
  1063. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.js +0 -0
  1064. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts +0 -0
  1065. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.js +0 -0
  1066. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.d.ts +0 -0
  1067. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts +0 -0
  1068. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts +0 -0
  1069. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts +0 -0
  1070. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts +0 -0
  1071. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.js +0 -0
  1072. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.d.ts +0 -0
  1073. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.js +0 -0
  1074. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.d.ts +0 -0
  1075. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.js +0 -0
  1076. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts +0 -0
  1077. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.js +0 -0
  1078. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts +0 -0
  1079. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.js +0 -0
  1080. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.d.ts +0 -0
  1081. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.js +0 -0
  1082. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.d.ts +0 -0
  1083. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.js +0 -0
  1084. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.d.ts +0 -0
  1085. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.js +0 -0
  1086. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.d.ts +0 -0
  1087. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.d.ts +0 -0
  1088. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.js +0 -0
  1089. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.d.ts +0 -0
  1090. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.js +0 -0
  1091. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.d.ts +0 -0
  1092. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.js +0 -0
  1093. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.d.ts +0 -0
  1094. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.js +0 -0
  1095. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.d.ts +0 -0
  1096. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.js +0 -0
  1097. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.d.ts +0 -0
  1098. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.js +0 -0
  1099. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.d.ts +0 -0
  1100. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.js +0 -0
  1101. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.d.ts +0 -0
  1102. /package/esm/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.js +0 -0
  1103. /package/esm/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts +0 -0
  1104. /package/esm/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.js +0 -0
  1105. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.d.ts +0 -0
  1106. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/assert.js +0 -0
  1107. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equal.d.ts +0 -0
  1108. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.d.ts +0 -0
  1109. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/equals.js +0 -0
  1110. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.d.ts +0 -0
  1111. /package/script/deps/jsr.io/@std/assert/{1.0.13 → 1.0.14}/false.js +0 -0
  1112. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.d.ts +0 -0
  1113. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/_util.js +0 -0
  1114. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.d.ts +0 -0
  1115. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/abortable.js +0 -0
  1116. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.d.ts +0 -0
  1117. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/deadline.js +0 -0
  1118. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.d.ts +0 -0
  1119. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/debounce.js +0 -0
  1120. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/delay.d.ts +0 -0
  1121. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.d.ts +0 -0
  1122. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mod.js +0 -0
  1123. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/mux_async_iterator.d.ts +0 -0
  1124. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.d.ts +0 -0
  1125. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/pool.js +0 -0
  1126. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.d.ts +0 -0
  1127. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/retry.js +0 -0
  1128. /package/script/deps/jsr.io/@std/async/{1.0.13 → 1.0.14}/tee.d.ts +0 -0
  1129. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.d.ts +0 -0
  1130. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/assert_path.js +0 -0
  1131. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.d.ts +0 -0
  1132. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/basename.js +0 -0
  1133. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.d.ts +0 -0
  1134. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/constants.js +0 -0
  1135. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.d.ts +0 -0
  1136. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/from_file_url.js +0 -0
  1137. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.d.ts +0 -0
  1138. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize.js +0 -0
  1139. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.d.ts +0 -0
  1140. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/normalize_string.js +0 -0
  1141. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.d.ts +0 -0
  1142. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/strip_trailing_separators.js +0 -0
  1143. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.d.ts +0 -0
  1144. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/_common/to_file_url.js +0 -0
  1145. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/basename.d.ts +0 -0
  1146. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/extname.d.ts +0 -0
  1147. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/is_absolute.d.ts +0 -0
  1148. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/join.d.ts +0 -0
  1149. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.d.ts +0 -0
  1150. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/_util.js +0 -0
  1151. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.d.ts +0 -0
  1152. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/basename.js +0 -0
  1153. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.d.ts +0 -0
  1154. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/extname.js +0 -0
  1155. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.d.ts +0 -0
  1156. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/from_file_url.js +0 -0
  1157. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.d.ts +0 -0
  1158. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/is_absolute.js +0 -0
  1159. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.d.ts +0 -0
  1160. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/join.js +0 -0
  1161. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.d.ts +0 -0
  1162. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/normalize.js +0 -0
  1163. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.d.ts +0 -0
  1164. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/posix/to_file_url.js +0 -0
  1165. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/to_file_url.d.ts +0 -0
  1166. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.d.ts +0 -0
  1167. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/_util.js +0 -0
  1168. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.d.ts +0 -0
  1169. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/basename.js +0 -0
  1170. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.d.ts +0 -0
  1171. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/extname.js +0 -0
  1172. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.d.ts +0 -0
  1173. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/from_file_url.js +0 -0
  1174. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.d.ts +0 -0
  1175. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/is_absolute.js +0 -0
  1176. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.d.ts +0 -0
  1177. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/join.js +0 -0
  1178. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.d.ts +0 -0
  1179. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/normalize.js +0 -0
  1180. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.d.ts +0 -0
  1181. /package/script/deps/jsr.io/@std/path/{1.1.0 → 1.1.2}/windows/to_file_url.js +0 -0
  1182. /package/script/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.d.ts +0 -0
  1183. /package/script/deps/jsr.io/@std/streams/{1.0.10 → 1.0.11}/to_array_buffer.js +0 -0
@@ -18,24 +18,13 @@
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 _MessageManager_instances, _a, _MessageManager_c, _MessageManager_LresolveFileId, _MessageManager_checkParams, _MessageManager_constructReplyMarkup, _MessageManager_resolveSendAs, _MessageManager_constructReplyTo, _MessageManager_sendDocumentInner, _MessageManager_sendMedia, _MessageManager_CAPTIONABLE_MESSAGE_TYPES, _MessageManager_editInlineMessageTextInner, _MessageManager_resolveInputMediaInner, _MessageManager_resolveInputMedia, _MessageManager_sendReaction, _MessageManager_getCachedVoiceTranscription, _MessageManager_cacheVoiceTranscription;
33
21
  Object.defineProperty(exports, "__esModule", { value: true });
34
22
  exports.MessageManager = void 0;
35
23
  const _0_deps_js_1 = require("../0_deps.js");
36
24
  const _0_errors_js_1 = require("../0_errors.js");
37
25
  const _1_utilities_js_1 = require("../1_utilities.js");
38
26
  const _2_tl_js_1 = require("../2_tl.js");
27
+ const _3_errors_js_1 = require("../3_errors.js");
39
28
  const _3_transport_js_1 = require("../3_transport.js");
40
29
  const _3_types_js_1 = require("../3_types.js");
41
30
  const _3_types_js_2 = require("../3_types.js");
@@ -60,32 +49,22 @@ const messageManagerUpdates = [
60
49
  "updateTranscribedAudio",
61
50
  ];
62
51
  class MessageManager {
52
+ #c;
53
+ #LresolveFileId;
63
54
  constructor(c) {
64
- _MessageManager_instances.add(this);
65
- _MessageManager_c.set(this, void 0);
66
- _MessageManager_LresolveFileId.set(this, void 0);
67
- Object.defineProperty(this, "usernameResolver", {
68
- enumerable: true,
69
- configurable: true,
70
- writable: true,
71
- value: async (v) => {
72
- const inputPeer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(v).then((v) => _2_tl_js_1.Api.as("inputPeerUser", v));
73
- return { ...inputPeer, _: "inputUser" };
74
- }
75
- });
76
- __classPrivateFieldSet(this, _MessageManager_c, c, "f");
55
+ this.#c = c;
77
56
  const L = (0, _1_utilities_js_1.getLogger)("MessageManager").client(c.id);
78
- __classPrivateFieldSet(this, _MessageManager_LresolveFileId, L.branch("resolveFileId"), "f");
57
+ this.#LresolveFileId = L.branch("resolveFileId");
79
58
  }
80
59
  async getMessages(chatId, messageIds) {
81
60
  (0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
82
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
61
+ const peer = await this.#c.getInputPeer(chatId);
83
62
  let messages_ = new Array();
84
- const chatId_ = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeerChatId(peer);
63
+ const chatId_ = await this.#c.getInputPeerChatId(peer);
85
64
  let shouldFetch = false;
86
65
  for (const messageId of messageIds) {
87
- const message = await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.getMessage(chatId_, messageId);
88
- if (message == null) {
66
+ const message = await this.#c.messageStorage.getMessage(chatId_, messageId);
67
+ if (message === null) {
89
68
  messages_ = [];
90
69
  shouldFetch = true;
91
70
  break;
@@ -96,10 +75,10 @@ class MessageManager {
96
75
  }
97
76
  if (shouldFetch) {
98
77
  if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
99
- messages_ = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.getMessages", channel: (0, _0_utilities_js_1.toInputChannel)(peer), id: messageIds.map((v) => ({ _: "inputMessageID", id: v })) }).then((v) => _2_tl_js_1.Api.as("messages.channelMessages", v).messages);
78
+ messages_ = await this.#c.invoke({ _: "channels.getMessages", channel: (0, _0_utilities_js_1.toInputChannel)(peer), id: messageIds.map((v) => ({ _: "inputMessageID", id: v })) }).then((v) => _2_tl_js_1.Api.as("messages.channelMessages", v).messages);
100
79
  }
101
80
  else {
102
- messages_ = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
81
+ messages_ = await this.#c.invoke({
103
82
  _: "messages.getMessages",
104
83
  id: messageIds.map((v) => ({ _: "inputMessageID", id: v })),
105
84
  }).then((v) => _2_tl_js_1.Api.as("messages.messages", v).messages);
@@ -111,7 +90,7 @@ class MessageManager {
111
90
  continue;
112
91
  }
113
92
  const message = await this.constructMessage(message_);
114
- if (message.chat.id == chatId_) {
93
+ if (message.chat.id === chatId_) {
115
94
  messages.push(message);
116
95
  }
117
96
  }
@@ -119,7 +98,7 @@ class MessageManager {
119
98
  }
120
99
  async getMessageWithReply(chatId, messageId) {
121
100
  const message = await this.getMessage(chatId, messageId);
122
- if (message != null && message.replyToMessageId) {
101
+ if (message !== null && message.replyToMessageId) {
123
102
  message.replyToMessage = await this.getMessage(chatId, message.replyToMessageId) ?? undefined;
124
103
  }
125
104
  return message;
@@ -162,9 +141,23 @@ class MessageManager {
162
141
  }
163
142
  return [text, entities];
164
143
  }
144
+ #checkParams(params) {
145
+ if (params && "replyMarkup" in params && params.replyMarkup !== undefined) {
146
+ this.#c.storage.assertBot("replyMarkup");
147
+ }
148
+ if (params && "businessConnectionId" in params && params.businessConnectionId !== undefined) {
149
+ this.#c.storage.assertBot("businessConnectionId");
150
+ }
151
+ if (params && "sendAs" in params && params.sendAs !== undefined) {
152
+ this.#c.storage.assertUser("sendAs");
153
+ }
154
+ if (params && "sendAt" in params && params.sendAt !== undefined) {
155
+ this.#c.storage.assertUser("businessConsendAtnectionId");
156
+ }
157
+ }
165
158
  async parseText(text_, params) {
166
- const [text, entities_] = _a.parseText(text_, params?.entities ?? [], params?.parseMode ?? __classPrivateFieldGet(this, _MessageManager_c, "f").parseMode);
167
- const entities = entities_?.length > 0 ? await Promise.all(entities_.map((v) => (0, _3_types_js_2.messageEntityToTlObject)(v, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity))) : undefined;
159
+ const [text, entities_] = MessageManager.parseText(text_, params?.entities ?? [], params?.parseMode ?? this.#c.parseMode);
160
+ const entities = entities_?.length > 0 ? await Promise.all(entities_.map((v) => (0, _3_types_js_2.messageEntityToTlObject)(v, this.#c.getEntity))) : undefined;
168
161
  return [text, entities];
169
162
  }
170
163
  async updatesToMessages(chatId, updates, businessConnectionId) {
@@ -194,7 +187,7 @@ class MessageManager {
194
187
  }
195
188
  else if (_2_tl_js_1.Api.is("updateShortSentMessage", updates)) {
196
189
  const message = await this.getMessage(chatId, updates.id);
197
- if (message != null) {
190
+ if (message !== null) {
198
191
  messages.push(message);
199
192
  }
200
193
  }
@@ -206,35 +199,49 @@ class MessageManager {
206
199
  let poll = null;
207
200
  let pollResults = null;
208
201
  if (pollId) {
209
- [poll, pollResults] = await Promise.all([__classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.getPoll(pollId), __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.getPollResults(pollId)]);
202
+ [poll, pollResults] = await Promise.all([this.#c.messageStorage.getPoll(pollId), this.#c.messageStorage.getPollResults(pollId)]);
210
203
  }
211
- const message = await (0, _3_types_js_2.constructMessage)(message_, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity, this.getMessage.bind(this), __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.getStickerSetName.bind(__classPrivateFieldGet(this, _MessageManager_c, "f").fileManager), r, business, poll ?? undefined, pollResults ?? undefined);
204
+ const message = await (0, _3_types_js_2.constructMessage)(message_, this.#c.getEntity, this.getMessage.bind(this), this.#c.fileManager.getStickerSetName.bind(this.#c.fileManager), r, business, poll ?? undefined, pollResults ?? undefined);
212
205
  if (!poll && mediaPoll) {
213
- await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.setPoll(mediaPoll.poll.id, mediaPoll.poll);
206
+ await this.#c.storage.setPoll(mediaPoll.poll.id, mediaPoll.poll);
214
207
  }
215
208
  if (!pollResults && mediaPoll) {
216
- await __classPrivateFieldGet(this, _MessageManager_c, "f").storage.setPollResults(mediaPoll.poll.id, mediaPoll.results);
209
+ await this.#c.storage.setPollResults(mediaPoll.poll.id, mediaPoll.results);
217
210
  }
218
211
  return message;
219
212
  }
220
213
  async forwardMessages(from, to, messageIds, params) {
221
214
  (0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
222
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.forwardMessages", from_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(from), to_peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(to), id: messageIds, random_id: messageIds.map(() => (0, _1_utilities_js_1.getRandomId)()), silent: params?.disableNotification || undefined, top_msg_id: params?.messageThreadId, noforwards: params?.disableNotification || undefined, send_as: params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined, drop_author: params?.dropSenderName || undefined, drop_media_captions: params?.dropCaption || undefined });
215
+ const result = await this.#c.invoke({ _: "messages.forwardMessages", from_peer: await this.#c.getInputPeer(from), to_peer: await this.#c.getInputPeer(to), id: messageIds, random_id: messageIds.map(() => (0, _1_utilities_js_1.getRandomId)()), silent: params?.disableNotification || undefined, top_msg_id: params?.messageThreadId, noforwards: params?.disableNotification || undefined, send_as: params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined, drop_author: params?.dropSenderName || undefined, drop_media_captions: params?.dropCaption || undefined });
223
216
  return await this.updatesToMessages(to, result);
224
217
  }
225
218
  async getHistory(chatId, params) {
226
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("getHistory");
219
+ this.#c.storage.assertUser("getHistory");
227
220
  const limit = (0, _0_utilities_js_1.getLimit)(params?.limit);
228
- let offsetId = params?.fromMessageId ?? 0;
221
+ let offsetId = params?.offsetId ?? 0;
229
222
  if (offsetId < 0) {
230
223
  offsetId = 0;
231
224
  }
232
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
225
+ let offsetDate = params?.offsetDate ?? 0;
226
+ if (offsetDate < 0) {
227
+ offsetDate = 0;
228
+ }
229
+ const peer = await this.#c.getInputPeer(chatId);
233
230
  const messages = new Array();
234
231
  if (messages.length > 0) {
235
232
  offsetId = messages[messages.length - 1].id; // TODO: track id of oldest message and don't send requests for it
236
233
  }
237
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.getHistory", peer: peer, offset_id: offsetId, offset_date: 0, add_offset: 0, limit, max_id: 0, min_id: 0, hash: 0n });
234
+ const result = await this.#c.invoke({
235
+ _: "messages.getHistory",
236
+ peer: peer,
237
+ offset_id: offsetId,
238
+ offset_date: offsetDate,
239
+ add_offset: params?.addOffset ?? 0,
240
+ limit,
241
+ max_id: 0,
242
+ min_id: 0,
243
+ hash: 0n,
244
+ });
238
245
  if (!("messages" in result)) {
239
246
  (0, _0_deps_js_1.unreachable)();
240
247
  }
@@ -244,23 +251,40 @@ class MessageManager {
244
251
  }
245
252
  return messages;
246
253
  }
254
+ usernameResolver = async (v) => {
255
+ const inputPeer = await this.#c.getInputPeer(v).then((v) => _2_tl_js_1.Api.as("inputPeerUser", v));
256
+ return { ...inputPeer, _: "inputUser" };
257
+ };
258
+ async #constructReplyMarkup(params) {
259
+ if (params?.replyMarkup) {
260
+ this.#c.storage.assertBot("replyMarkup");
261
+ return await (0, _3_types_js_2.replyMarkupToTlObject)(params.replyMarkup, this.usernameResolver.bind(this));
262
+ }
263
+ }
264
+ async #resolveSendAs(params) {
265
+ const sendAs = params?.sendAs;
266
+ if (sendAs !== undefined) {
267
+ this.#c.storage.assertUser("sendAs");
268
+ return sendAs ? await this.#c.getInputPeer(sendAs) : undefined;
269
+ }
270
+ }
247
271
  async sendMessage(chatId, text, params) {
248
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
272
+ this.#checkParams(params);
249
273
  const [message, entities] = await this.parseText(text, params);
250
- const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
251
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
274
+ const replyMarkup = await this.#constructReplyMarkup(params);
275
+ const peer = await this.#c.getInputPeer(chatId);
252
276
  const randomId = (0, _1_utilities_js_1.getRandomId)();
253
277
  const noWebpage = params?.linkPreview?.disable ? true : undefined;
254
278
  const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
255
279
  const silent = params?.disableNotification ? true : undefined;
256
280
  const noforwards = params?.protectContent ? true : undefined;
257
- const sendAs = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveSendAs).call(this, params);
281
+ const sendAs = await this.#resolveSendAs(params);
258
282
  const effect = params?.effectId ? BigInt(params.effectId) : undefined;
259
283
  const schedule_date = params?.sendAt;
260
284
  const allow_paid_floodskip = params?.paidBroadcast ? true : undefined;
261
285
  let result;
262
286
  if (!noWebpage && params?.linkPreview?.url) {
263
- result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
287
+ result = await this.#c.invoke({
264
288
  _: "messages.sendMedia",
265
289
  peer,
266
290
  random_id: randomId,
@@ -275,7 +299,7 @@ class MessageManager {
275
299
  invert_media: invertMedia,
276
300
  silent,
277
301
  noforwards,
278
- reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
302
+ reply_to: await this.#constructReplyTo(params),
279
303
  send_as: sendAs,
280
304
  entities,
281
305
  reply_markup: replyMarkup,
@@ -285,7 +309,7 @@ class MessageManager {
285
309
  }, { businessConnectionId: params?.businessConnectionId });
286
310
  }
287
311
  else {
288
- result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
312
+ result = await this.#c.invoke({
289
313
  _: "messages.sendMessage",
290
314
  peer,
291
315
  random_id: randomId,
@@ -294,7 +318,7 @@ class MessageManager {
294
318
  invert_media: invertMedia,
295
319
  silent,
296
320
  noforwards,
297
- reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
321
+ reply_to: await this.#constructReplyTo(params),
298
322
  send_as: sendAs,
299
323
  entities,
300
324
  reply_markup: replyMarkup,
@@ -306,21 +330,38 @@ class MessageManager {
306
330
  const message_ = (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
307
331
  return (0, _3_types_js_2.assertMessageType)(message_, "text");
308
332
  }
333
+ async #constructReplyTo(params) {
334
+ const topMsgId = params?.messageThreadId;
335
+ if (!params?.replyTo) {
336
+ if (topMsgId) {
337
+ return { _: "inputReplyToMessage", reply_to_msg_id: topMsgId };
338
+ }
339
+ else {
340
+ return undefined;
341
+ }
342
+ }
343
+ if ("messageId" in params.replyTo) {
344
+ return { _: "inputReplyToMessage", reply_to_msg_id: params.replyTo.messageId, top_msg_id: topMsgId, quote_text: params.replyTo.quote?.text, quote_entities: await Promise.all(params.replyTo.quote?.entities.map((v) => (0, _3_types_js_2.messageEntityToTlObject)(v, this.#c.getEntity)) ?? []), quote_offset: params.replyTo.quote?.offset };
345
+ }
346
+ else {
347
+ return { _: "inputReplyToStory", peer: await this.#c.getInputPeer(params.replyTo.chatId), story_id: params.replyTo.storyId };
348
+ }
349
+ }
309
350
  async sendVenue(chatId, latitude, longitude, title, address, params) {
310
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
311
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
351
+ this.#checkParams(params);
352
+ const peer = await this.#c.getInputPeer(chatId);
312
353
  const randomId = (0, _1_utilities_js_1.getRandomId)();
313
354
  const silent = params?.disableNotification ? true : undefined;
314
355
  const noforwards = params?.protectContent ? true : undefined;
315
- const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
316
- const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
317
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
356
+ const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
357
+ const replyMarkup = await this.#constructReplyMarkup(params);
358
+ const result = await this.#c.invoke({
318
359
  _: "messages.sendMedia",
319
360
  peer,
320
361
  random_id: randomId,
321
362
  silent,
322
363
  noforwards,
323
- reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
364
+ reply_to: await this.#constructReplyTo(params),
324
365
  send_as: sendAs,
325
366
  reply_markup: replyMarkup,
326
367
  media: ({
@@ -345,20 +386,20 @@ class MessageManager {
345
386
  return (0, _3_types_js_2.assertMessageType)(message, "venue");
346
387
  }
347
388
  async sendContact(chatId, firstName, number, params) {
348
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
349
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
389
+ this.#checkParams(params);
390
+ const peer = await this.#c.getInputPeer(chatId);
350
391
  const randomId = (0, _1_utilities_js_1.getRandomId)();
351
392
  const silent = params?.disableNotification ? true : undefined;
352
393
  const noforwards = params?.protectContent ? true : undefined;
353
- const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
354
- const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
355
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
394
+ const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
395
+ const replyMarkup = await this.#constructReplyMarkup(params);
396
+ const result = await this.#c.invoke({
356
397
  _: "messages.sendMedia",
357
398
  peer,
358
399
  random_id: randomId,
359
400
  silent,
360
401
  noforwards,
361
- reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
402
+ reply_to: await this.#constructReplyTo(params),
362
403
  send_as: sendAs,
363
404
  reply_markup: replyMarkup,
364
405
  media: ({
@@ -377,20 +418,20 @@ class MessageManager {
377
418
  return (0, _3_types_js_2.assertMessageType)(message, "contact");
378
419
  }
379
420
  async sendDice(chatId, params) {
380
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
381
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
421
+ this.#checkParams(params);
422
+ const peer = await this.#c.getInputPeer(chatId);
382
423
  const randomId = (0, _1_utilities_js_1.getRandomId)();
383
424
  const silent = params?.disableNotification ? true : undefined;
384
425
  const noforwards = params?.protectContent ? true : undefined;
385
- const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
386
- const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
387
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
426
+ const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
427
+ const replyMarkup = await this.#constructReplyMarkup(params);
428
+ const result = await this.#c.invoke({
388
429
  _: "messages.sendMedia",
389
430
  peer,
390
431
  random_id: randomId,
391
432
  silent,
392
433
  noforwards,
393
- reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
434
+ reply_to: await this.#constructReplyTo(params),
394
435
  send_as: sendAs,
395
436
  reply_markup: replyMarkup,
396
437
  media: ({
@@ -406,20 +447,20 @@ class MessageManager {
406
447
  return (0, _3_types_js_2.assertMessageType)(message, "dice");
407
448
  }
408
449
  async sendLocation(chatId, latitude, longitude, params) {
409
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
410
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
450
+ this.#checkParams(params);
451
+ const peer = await this.#c.getInputPeer(chatId);
411
452
  const randomId = (0, _1_utilities_js_1.getRandomId)();
412
453
  const silent = params?.disableNotification ? true : undefined;
413
454
  const noforwards = params?.protectContent ? true : undefined;
414
- const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
415
- const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
416
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
455
+ const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
456
+ const replyMarkup = await this.#constructReplyMarkup(params);
457
+ const result = await this.#c.invoke({
417
458
  _: "messages.sendMedia",
418
459
  peer,
419
460
  random_id: randomId,
420
461
  silent,
421
462
  noforwards,
422
- reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
463
+ reply_to: await this.#constructReplyTo(params),
423
464
  send_as: sendAs,
424
465
  reply_markup: replyMarkup,
425
466
  media: params?.livePeriod !== undefined
@@ -453,74 +494,151 @@ class MessageManager {
453
494
  return (0, _3_types_js_2.assertMessageType)(message, "location");
454
495
  }
455
496
  async sendVideoNote(chatId, audio, params) {
456
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
457
- const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, audio, params, _3_types_js_2.FileType.VideoNote, [
497
+ this.#checkParams(params);
498
+ const message = await this.#sendDocumentInner(chatId, audio, params, _3_types_js_2.FileType.VideoNote, [
458
499
  { _: "documentAttributeVideo", round_message: true, w: params?.length ?? 0, h: params?.length ?? 0, duration: params?.duration ?? 0 },
459
500
  ], false);
460
501
  return (0, _3_types_js_2.assertMessageType)(message, "videoNote");
461
502
  }
462
503
  async sendAudio(chatId, audio, params) {
463
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
464
- const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, audio, params, _3_types_js_2.FileType.Audio, [
504
+ this.#checkParams(params);
505
+ const message = await this.#sendDocumentInner(chatId, audio, params, _3_types_js_2.FileType.Audio, [
465
506
  { _: "documentAttributeAudio", duration: params?.duration ?? 0, performer: params?.performer, title: params?.title },
466
507
  ]);
467
508
  return (0, _3_types_js_2.assertMessageType)(message, "audio");
468
509
  }
469
510
  async sendVoice(chatId, voice, params) {
470
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
471
- const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, voice, params, _3_types_js_2.FileType.VoiceNote, [
511
+ this.#checkParams(params);
512
+ const message = await this.#sendDocumentInner(chatId, voice, params, _3_types_js_2.FileType.VoiceNote, [
472
513
  { _: "documentAttributeAudio", voice: true, duration: params?.duration ?? 0 },
473
514
  ]);
474
515
  return (0, _3_types_js_2.assertMessageType)(message, "voice");
475
516
  }
476
517
  async sendAnimation(chatId, animation, params) {
477
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
478
- const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, animation, params, _3_types_js_2.FileType.Animation, [
518
+ this.#checkParams(params);
519
+ const message = await this.#sendDocumentInner(chatId, animation, params, _3_types_js_2.FileType.Animation, [
479
520
  { _: "documentAttributeAnimated" },
480
521
  { _: "documentAttributeVideo", supports_streaming: true, w: params?.width ?? 0, h: params?.height ?? 0, duration: params?.duration ?? 0 },
481
522
  ]);
482
523
  return (0, _3_types_js_2.assertMessageType)(message, "animation");
483
524
  }
484
525
  async sendVideo(chatId, video, params) {
485
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
486
- const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, video, params, _3_types_js_2.FileType.Video, [
526
+ this.#checkParams(params);
527
+ const message = await this.#sendDocumentInner(chatId, video, params, _3_types_js_2.FileType.Video, [
487
528
  { _: "documentAttributeVideo", supports_streaming: params?.supportsStreaming ? true : undefined, w: params?.width ?? 0, h: params?.height ?? 0, duration: params?.duration ?? 0 },
488
529
  ]);
489
530
  return (0, _3_types_js_2.assertMessageType)(message, "video");
490
531
  }
532
+ async #sendDocumentInner(chatId, document, params, fileType, otherAttribs, urlSupported = true, expectedMimeTypes) {
533
+ let media = null;
534
+ const spoiler = params?.hasSpoiler ? true : undefined;
535
+ const ttl_seconds = params && "selfDestruct" in params && typeof params.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined;
536
+ if (typeof document === "string") {
537
+ const fileId = this.resolveFileId(document, fileType);
538
+ if (fileId !== null) {
539
+ media = { _: "inputMediaDocument", id: { ...fileId, _: "inputDocument" }, spoiler, query: otherAttribs.find((v) => _2_tl_js_1.Api.is("documentAttributeSticker", v))?.alt || undefined, ttl_seconds };
540
+ }
541
+ }
542
+ if (media === null) {
543
+ if (typeof document === "string" && (0, _0_utilities_js_1.isHttpUrl)(document)) {
544
+ if (!urlSupported) {
545
+ throw new _0_errors_js_1.InputError("URL not supported.");
546
+ }
547
+ media = { _: "inputMediaDocumentExternal", url: document, spoiler, ttl_seconds };
548
+ }
549
+ else {
550
+ let mimeType;
551
+ const file = await this.#c.fileManager.upload(document, params, (name) => {
552
+ mimeType = params?.mimeType ?? (0, _0_deps_js_1.contentType)(name.split(".").slice(-1)[0]) ?? FALLBACK_MIME_TYPE;
553
+ if (expectedMimeTypes && !expectedMimeTypes.includes(mimeType)) {
554
+ (0, _0_deps_js_1.unreachable)();
555
+ }
556
+ if (name.endsWith(".tgs") && fileType === _3_types_js_2.FileType.Document) {
557
+ name += "-";
558
+ }
559
+ return name;
560
+ });
561
+ if (_2_tl_js_1.Api.is("inputFileStoryDocument", file)) {
562
+ (0, _0_deps_js_1.unreachable)();
563
+ }
564
+ let thumb = undefined;
565
+ if (params?.thumbnail) {
566
+ thumb = await this.#c.fileManager.upload(params.thumbnail, { chunkSize: params?.chunkSize, signal: params?.signal });
567
+ }
568
+ media = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType === _3_types_js_2.FileType.Document ? true : undefined, ttl_seconds };
569
+ }
570
+ }
571
+ const message = await this.#sendMedia(chatId, media, params);
572
+ return message;
573
+ }
491
574
  async sendDocument(chatId, document, params) {
492
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
493
- const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, document, params, _3_types_js_2.FileType.Document, []);
575
+ this.#checkParams(params);
576
+ const message = await this.#sendDocumentInner(chatId, document, params, _3_types_js_2.FileType.Document, []);
494
577
  return (0, _3_types_js_2.assertMessageType)(message, "document");
495
578
  }
496
579
  async sendSticker(chatId, sticker, params) {
497
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
498
- const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendDocumentInner).call(this, chatId, sticker, params, _3_types_js_2.FileType.Sticker, [{ _: "documentAttributeSticker", alt: params?.emoji || "", stickerset: { _: "inputStickerSetEmpty" } }], undefined, STICKER_MIME_TYPES);
580
+ this.#checkParams(params);
581
+ const message = await this.#sendDocumentInner(chatId, sticker, params, _3_types_js_2.FileType.Sticker, [{ _: "documentAttributeSticker", alt: params?.emoji || "", stickerset: { _: "inputStickerSetEmpty" } }], undefined, STICKER_MIME_TYPES);
499
582
  return (0, _3_types_js_2.assertMessageType)(message, "sticker");
500
583
  }
501
584
  async sendPhoto(chatId, photo, params) {
502
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
585
+ this.#checkParams(params);
503
586
  let media = null;
504
587
  const spoiler = params?.hasSpoiler ? true : undefined;
505
588
  const ttl_seconds = params && "selfDestruct" in params && params.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined;
506
589
  if (typeof photo === "string") {
507
590
  const fileId = this.resolveFileId(photo, [_3_types_js_2.FileType.Photo, _3_types_js_2.FileType.ProfilePhoto]);
508
- if (fileId != null) {
591
+ if (fileId !== null) {
509
592
  media = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds };
510
593
  }
511
594
  }
512
- if (media == null) {
595
+ if (media === null) {
513
596
  if (typeof photo === "string" && (0, _0_utilities_js_1.isHttpUrl)(photo)) {
514
597
  media = { _: "inputMediaPhotoExternal", url: photo, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined };
515
598
  }
516
599
  else {
517
- const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(photo, params, null, false);
600
+ const file = await this.#c.fileManager.upload(photo, params, null, false);
518
601
  media = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds: (params && "selfDestruct" in params && params.selfDestruct !== undefined) ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined };
519
602
  }
520
603
  }
521
- const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendMedia).call(this, chatId, media, params);
604
+ const message = await this.#sendMedia(chatId, media, params);
522
605
  return (0, _3_types_js_2.assertMessageType)(message, "photo");
523
606
  }
607
+ async #sendMedia(chatId, media, params) {
608
+ if (params?.starCount !== undefined) {
609
+ if (params.starCount <= 0) {
610
+ throw new _0_errors_js_1.InputError("starCount cannot be zero or negative");
611
+ }
612
+ media = { _: "inputMediaPaidMedia", stars_amount: BigInt(params.starCount), extended_media: [media] };
613
+ }
614
+ const peer = await this.#c.getInputPeer(chatId);
615
+ const randomId = (0, _1_utilities_js_1.getRandomId)();
616
+ const silent = params?.disableNotification ? true : undefined;
617
+ const noforwards = params?.protectContent ? true : undefined;
618
+ const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
619
+ const replyMarkup = await this.#constructReplyMarkup(params);
620
+ const caption_ = params?.caption;
621
+ const parseResult = caption_ !== undefined ? await this.parseText(caption_, { parseMode: params?.parseMode, entities: params?.captionEntities }) : undefined;
622
+ const caption = parseResult === undefined ? undefined : parseResult[0];
623
+ const captionEntities = parseResult === undefined ? undefined : parseResult[1];
624
+ const result = await this.#c.invoke({
625
+ _: "messages.sendMedia",
626
+ peer,
627
+ random_id: randomId,
628
+ silent,
629
+ noforwards,
630
+ reply_markup: replyMarkup,
631
+ reply_to: await this.#constructReplyTo(params),
632
+ send_as: sendAs,
633
+ media,
634
+ message: caption ?? "",
635
+ entities: captionEntities,
636
+ effect: params?.effectId ? BigInt(params.effectId) : undefined,
637
+ schedule_date: params?.sendAt,
638
+ allow_paid_floodskip: params?.paidBroadcast ? true : undefined,
639
+ }, { businessConnectionId: params?.businessConnectionId });
640
+ return (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
641
+ }
524
642
  resolveFileId(maybeFileId, expectedFileType) {
525
643
  expectedFileType = Array.isArray(expectedFileType) ? expectedFileType : [expectedFileType];
526
644
  let fileId = null;
@@ -528,9 +646,9 @@ class MessageManager {
528
646
  fileId = (0, _3_types_js_1.deserializeFileId)(maybeFileId);
529
647
  }
530
648
  catch (err) {
531
- __classPrivateFieldGet(this, _MessageManager_LresolveFileId, "f").warning(err);
649
+ this.#LresolveFileId.warning(err);
532
650
  }
533
- if (fileId != null) {
651
+ if (fileId !== null) {
534
652
  if (!expectedFileType.includes(fileId.type)) {
535
653
  (0, _0_deps_js_1.unreachable)();
536
654
  }
@@ -543,7 +661,7 @@ class MessageManager {
543
661
  return null;
544
662
  }
545
663
  async sendPoll(chatId, question, options, params) {
546
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
664
+ this.#checkParams(params);
547
665
  question = question?.trim();
548
666
  if (!question) {
549
667
  throw new Error("Question must not be empty.");
@@ -551,12 +669,12 @@ class MessageManager {
551
669
  if (!Array.isArray(options) || options.length < 2) {
552
670
  throw new Error("There must be at least two options.");
553
671
  }
554
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
672
+ const peer = await this.#c.getInputPeer(chatId);
555
673
  const randomId = (0, _1_utilities_js_1.getRandomId)();
556
674
  const silent = params?.disableNotification ? true : undefined;
557
675
  const noforwards = params?.protectContent ? true : undefined;
558
- const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
559
- const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
676
+ const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
677
+ const replyMarkup = await this.#constructReplyMarkup(params);
560
678
  const explanation = params?.explanation;
561
679
  const parseResult = explanation !== undefined ? await this.parseText(explanation, { parseMode: params?.explanationParseMode, entities: params?.explanationEntities }) : undefined;
562
680
  const solution = parseResult === undefined ? undefined : parseResult[0];
@@ -568,16 +686,16 @@ class MessageManager {
568
686
  return ({ _: "pollAnswer", option: (0, _1_utilities_js_1.encodeText)(String(i)), text: { _: "textWithEntities", text: parseResult[0], entities: parseResult[1] ?? [] } });
569
687
  }));
570
688
  const questionParseResult = await this.parseText(question, { parseMode: params?.questionParseMode, entities: params?.questionEntities });
571
- const poll = { _: "poll", id: (0, _1_utilities_js_1.getRandomId)(), answers, question: { _: "textWithEntities", text: questionParseResult[0], entities: questionParseResult[1] ?? [] }, closed: params?.isClosed ? true : undefined, close_date: params?.closeDate, close_period: params?.openPeriod ? params.openPeriod : undefined, multiple_choice: params?.allowMultipleAnswers ? true : undefined, public_voters: params?.isAnonymous === false ? true : undefined, quiz: params?.type == "quiz" ? true : undefined };
689
+ const poll = { _: "poll", id: (0, _1_utilities_js_1.getRandomId)(), answers, question: { _: "textWithEntities", text: questionParseResult[0], entities: questionParseResult[1] ?? [] }, closed: params?.isClosed ? true : undefined, close_date: params?.closeDate, close_period: params?.openPeriod ? params.openPeriod : undefined, multiple_choice: params?.allowMultipleAnswers ? true : undefined, public_voters: params?.isAnonymous === false ? true : undefined, quiz: params?.type === "quiz" ? true : undefined };
572
690
  const media = { _: "inputMediaPoll", poll, correct_answers: params?.correctOptionIndex !== undefined ? [(0, _1_utilities_js_1.encodeText)(String(params.correctOptionIndex))] : undefined, solution, solution_entities: solutionEntities };
573
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
691
+ const result = await this.#c.invoke({
574
692
  _: "messages.sendMedia",
575
693
  peer,
576
694
  random_id: randomId,
577
695
  silent,
578
696
  noforwards,
579
697
  reply_markup: replyMarkup,
580
- reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
698
+ reply_to: await this.#constructReplyTo(params),
581
699
  send_as: sendAs,
582
700
  media,
583
701
  message: "",
@@ -589,26 +707,26 @@ class MessageManager {
589
707
  return (0, _3_types_js_2.assertMessageType)(message, "poll");
590
708
  }
591
709
  async editMessageReplyMarkup(chatId, messageId, params) {
592
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
593
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
710
+ this.#checkParams(params);
711
+ const result = await this.#c.invoke({
594
712
  _: "messages.editMessage",
595
713
  id: (0, _0_utilities_js_1.checkMessageId)(messageId),
596
- peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
597
- reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
714
+ peer: await this.#c.getInputPeer(chatId),
715
+ reply_markup: await this.#constructReplyMarkup(params),
598
716
  }, { businessConnectionId: params?.businessConnectionId });
599
717
  const message_ = (await this.updatesToMessages(chatId, result))[0];
600
718
  return message_;
601
719
  }
602
720
  async editInlineMessageReplyMarkup(inlineMessageId, params) {
603
721
  const id = await (0, _3_types_js_2.deserializeInlineMessageId)(inlineMessageId);
604
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
722
+ await this.#c.invoke({
605
723
  _: "messages.editInlineBotMessage",
606
724
  id,
607
- reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
725
+ reply_markup: await this.#constructReplyMarkup(params),
608
726
  }, { dc: (0, _3_transport_js_1.getDc)(id.dc_id) });
609
727
  }
610
728
  async editMessageText(chatId, messageId, text, params) {
611
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
729
+ this.#checkParams(params);
612
730
  {
613
731
  const message = await this.getMessage(chatId, messageId);
614
732
  if (!message) {
@@ -622,36 +740,37 @@ class MessageManager {
622
740
  if (!message) {
623
741
  throw new _0_errors_js_1.InputError("Message text cannot be empty.");
624
742
  }
625
- if (params?.linkPreview && params.linkPreview.type != "input") {
743
+ if (params?.linkPreview && params.linkPreview.type !== "input") {
626
744
  throw new _0_errors_js_1.InputError("Expected link preview of type input.");
627
745
  }
628
- const noWebpage = params?.linkPreview && params.linkPreview.type == "input" && params.linkPreview.disable ? true : undefined;
746
+ const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.disable ? true : undefined;
629
747
  const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
630
748
  let media = undefined;
631
749
  if (!noWebpage && params?.linkPreview?.url) {
632
750
  media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.largeMedia ? true : undefined, force_small_media: params.linkPreview.smallMedia ? true : undefined, optional: message.length ? undefined : true };
633
751
  }
634
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
752
+ const result = await this.#c.invoke({
635
753
  _: "messages.editMessage",
636
754
  id: (0, _0_utilities_js_1.checkMessageId)(messageId),
637
- peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
755
+ peer: await this.#c.getInputPeer(chatId),
638
756
  entities,
639
757
  message,
640
758
  media,
641
759
  no_webpage: noWebpage,
642
760
  invert_media: invertMedia,
643
- reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
761
+ reply_markup: await this.#constructReplyMarkup(params),
644
762
  }, { businessConnectionId: params?.businessConnectionId });
645
763
  const message_ = (await this.updatesToMessages(chatId, result))[0];
646
764
  return (0, _3_types_js_2.assertMessageType)(message_, "text");
647
765
  }
766
+ static #CAPTIONABLE_MESSAGE_TYPES = ["photo", "document", "video", "animation", "voice", "audio", "video"];
648
767
  async editMessageCaption(chatId, messageId, params) {
649
768
  let canHaveCaption = false;
650
769
  const message_ = await this.getMessage(chatId, messageId);
651
770
  if (!message_) {
652
771
  throw new _0_errors_js_1.InputError("Message not found.");
653
772
  }
654
- for (const type of __classPrivateFieldGet(_a, _a, "f", _MessageManager_CAPTIONABLE_MESSAGE_TYPES)) {
773
+ for (const type of MessageManager.#CAPTIONABLE_MESSAGE_TYPES) {
655
774
  if ((0, _3_types_js_1.isMessageType)(message_, type)) {
656
775
  canHaveCaption = true;
657
776
  }
@@ -660,24 +779,133 @@ class MessageManager {
660
779
  throw new _0_errors_js_1.InputError("The referenced message cannot have a caption.");
661
780
  }
662
781
  const [message, entities] = await this.parseText(params?.caption ?? "", params);
663
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
782
+ const result = await this.#c.invoke({
664
783
  _: "messages.editMessage",
665
784
  id: (0, _0_utilities_js_1.checkMessageId)(messageId),
666
- peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
785
+ peer: await this.#c.getInputPeer(chatId),
667
786
  entities: message ? entities : [],
668
787
  message,
669
- reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
788
+ reply_markup: await this.#constructReplyMarkup(params),
670
789
  }, { businessConnectionId: params?.businessConnectionId });
671
790
  return (await this.updatesToMessages(chatId, result))[0];
672
791
  }
792
+ async #editInlineMessageTextInner(inlineMessageId, text, params, allowEmpty = true) {
793
+ this.#checkParams(params);
794
+ const [message, entities] = await this.parseText(text, params);
795
+ if (!allowEmpty && !message) {
796
+ throw new _0_errors_js_1.InputError("Message text cannot be empty.");
797
+ }
798
+ const id = await (0, _3_types_js_2.deserializeInlineMessageId)(inlineMessageId);
799
+ if (params?.linkPreview && params.linkPreview.type !== "input") {
800
+ throw new _0_errors_js_1.InputError("Expected link preview of type input.");
801
+ }
802
+ const noWebpage = params?.linkPreview && params.linkPreview.type === "input" && params.linkPreview.disable ? true : undefined;
803
+ const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
804
+ let media = undefined;
805
+ if (!noWebpage && params?.linkPreview?.url) {
806
+ media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.largeMedia ? true : undefined, force_small_media: params.linkPreview.smallMedia ? true : undefined, optional: message.length ? undefined : true };
807
+ }
808
+ await this.#c.invoke({
809
+ _: "messages.editInlineBotMessage",
810
+ id,
811
+ entities,
812
+ message,
813
+ media,
814
+ no_webpage: noWebpage,
815
+ invert_media: invertMedia,
816
+ reply_markup: await this.#constructReplyMarkup(params),
817
+ }, { dc: (0, _3_transport_js_1.getDc)(id.dc_id) });
818
+ }
673
819
  async editInlineMessageText(inlineMessageId, text, params) {
674
- await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_editInlineMessageTextInner).call(this, inlineMessageId, text, params, false);
820
+ await this.#editInlineMessageTextInner(inlineMessageId, text, params, false);
675
821
  }
676
822
  async editInlineMessageCaption(inlineMessageId, params) {
677
- await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_editInlineMessageTextInner).call(this, inlineMessageId, params?.caption ?? "", params);
823
+ await this.#editInlineMessageTextInner(inlineMessageId, params?.caption ?? "", params);
824
+ }
825
+ async #resolveInputMediaInner(document, media, fileType, otherAttribs) {
826
+ let media_ = null;
827
+ const spoiler = "hasSpoiler" in media && media.hasSpoiler ? true : undefined;
828
+ if (typeof document === "string") {
829
+ const fileId = this.resolveFileId(document, fileType);
830
+ if (fileId !== null) {
831
+ media_ = { _: "inputMediaDocument", id: { ...fileId, _: "inputDocument" }, spoiler, query: otherAttribs.find((v) => _2_tl_js_1.Api.is("documentAttributeSticker", v))?.alt || undefined };
832
+ }
833
+ }
834
+ if (media_ === null) {
835
+ if (typeof document === "string" && (0, _0_utilities_js_1.isHttpUrl)(document)) {
836
+ media_ = { _: "inputMediaDocumentExternal", url: document, spoiler };
837
+ }
838
+ else {
839
+ let mimeType;
840
+ const file = await this.#c.fileManager.upload(document, media, (name) => {
841
+ mimeType = media?.mimeType ?? (0, _0_deps_js_1.contentType)(name.split(".").slice(-1)[0]) ?? FALLBACK_MIME_TYPE;
842
+ if (name.endsWith(".tgs") && fileType === _3_types_js_2.FileType.Document) {
843
+ name += "-";
844
+ }
845
+ return name;
846
+ });
847
+ if (_2_tl_js_1.Api.is("inputFileStoryDocument", file)) {
848
+ (0, _0_deps_js_1.unreachable)();
849
+ }
850
+ let thumb = undefined;
851
+ if ("thumbnail" in media && media.thumbnail) {
852
+ thumb = await this.#c.fileManager.upload(media.thumbnail, { chunkSize: media?.chunkSize, signal: media?.signal });
853
+ }
854
+ media_ = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType === _3_types_js_2.FileType.Document ? true : undefined };
855
+ }
856
+ }
857
+ return media_;
858
+ }
859
+ async #resolveInputMedia(media) {
860
+ if ("animation" in media) {
861
+ return await this.#resolveInputMediaInner(media.animation, media, _3_types_js_2.FileType.Animation, [
862
+ { _: "documentAttributeAnimated" },
863
+ { _: "documentAttributeVideo", supports_streaming: true, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
864
+ ]);
865
+ }
866
+ else if ("audio" in media) {
867
+ return await this.#resolveInputMediaInner(media.audio, media, _3_types_js_2.FileType.Audio, [
868
+ { _: "documentAttributeAudio", duration: media?.duration ?? 0, performer: media?.performer, title: media?.title },
869
+ ]);
870
+ }
871
+ else if ("document" in media) {
872
+ return await this.#resolveInputMediaInner(media.document, media, _3_types_js_2.FileType.Document, []);
873
+ }
874
+ else if ("photo" in media) {
875
+ let media_ = null;
876
+ const spoiler = media.hasSpoiler ? true : undefined;
877
+ const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(media.selfDestruct) : undefined;
878
+ if (typeof media.photo === "string") {
879
+ const fileId = this.resolveFileId(media.photo, [_3_types_js_2.FileType.Photo, _3_types_js_2.FileType.ProfilePhoto]);
880
+ if (fileId !== null) {
881
+ media_ = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds };
882
+ }
883
+ }
884
+ if (media_ === null) {
885
+ if (typeof media.photo === "string" && (0, _0_utilities_js_1.isHttpUrl)(media.photo)) {
886
+ media_ = { _: "inputMediaPhotoExternal", url: media.photo, spoiler };
887
+ }
888
+ else {
889
+ const file = await this.#c.fileManager.upload(media.photo, media, null, false);
890
+ media_ = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds };
891
+ }
892
+ }
893
+ return media_;
894
+ }
895
+ else if ("video" in media) {
896
+ const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(media.selfDestruct) : undefined;
897
+ const media_ = await this.#resolveInputMediaInner(media.video, media, _3_types_js_2.FileType.Video, [
898
+ { _: "documentAttributeVideo", supports_streaming: media?.supportsStreaming ? true : undefined, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
899
+ ]);
900
+ media_.ttl_seconds = ttl_seconds;
901
+ return media_;
902
+ }
903
+ else {
904
+ (0, _0_deps_js_1.unreachable)();
905
+ }
678
906
  }
679
907
  async editMessageMedia(chatId, messageId, media, params) {
680
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
908
+ this.#checkParams(params);
681
909
  const message = await this.getMessage(chatId, messageId);
682
910
  if (!message) {
683
911
  throw new _0_errors_js_1.InputError("Message not found.");
@@ -686,12 +914,12 @@ class MessageManager {
686
914
  throw new _0_errors_js_1.InputError("Unexpected message type.");
687
915
  }
688
916
  const [text, entities] = media.caption !== undefined ? await this.parseText(media.caption, { entities: media.captionEntities, parseMode: media.parseMode }) : ["", []];
689
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
917
+ const result = await this.#c.invoke({
690
918
  _: "messages.editMessage",
691
- peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
919
+ peer: await this.#c.getInputPeer(chatId),
692
920
  id: messageId,
693
- media: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMedia).call(this, media),
694
- reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
921
+ media: await this.#resolveInputMedia(media),
922
+ reply_markup: await this.#constructReplyMarkup(params),
695
923
  message: text,
696
924
  entities,
697
925
  }, { businessConnectionId: params?.businessConnectionId });
@@ -699,66 +927,69 @@ class MessageManager {
699
927
  return message_;
700
928
  }
701
929
  async editInlineMessageMedia(inlineMessageId, media, params) {
702
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
703
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("editInlineMessageMedia");
930
+ this.#checkParams(params);
931
+ this.#c.storage.assertBot("editInlineMessageMedia");
704
932
  const id = await (0, _3_types_js_2.deserializeInlineMessageId)(inlineMessageId);
705
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
933
+ await this.#c.invoke({
706
934
  _: "messages.editInlineBotMessage",
707
935
  id,
708
- media: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMedia).call(this, media),
709
- reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
936
+ media: await this.#resolveInputMedia(media),
937
+ reply_markup: await this.#constructReplyMarkup(params),
710
938
  }, { dc: (0, _3_transport_js_1.getDc)(id.dc_id) });
711
939
  }
712
940
  async deleteMessages(chatId, messageIds, params) {
713
941
  (0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
714
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
942
+ const peer = await this.#c.getInputPeer(chatId);
715
943
  if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
716
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.deleteMessages", channel: (0, _0_utilities_js_1.toInputChannel)(peer), id: messageIds });
944
+ await this.#c.invoke({ _: "channels.deleteMessages", channel: (0, _0_utilities_js_1.toInputChannel)(peer), id: messageIds });
717
945
  }
718
946
  else {
719
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.deleteMessages", id: messageIds, revoke: params?.onlyForMe ? undefined : true });
947
+ await this.#c.invoke({ _: "messages.deleteMessages", id: messageIds, revoke: params?.onlyForMe ? undefined : true });
720
948
  }
721
949
  }
722
950
  async deleteScheduledMessages(chatId, messageIds) {
723
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("sendScheduledMessage");
951
+ this.#c.storage.assertUser("sendScheduledMessage");
724
952
  (0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
725
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
726
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.deleteScheduledMessages", peer, id: messageIds });
953
+ const peer = await this.#c.getInputPeer(chatId);
954
+ await this.#c.invoke({ _: "messages.deleteScheduledMessages", peer, id: messageIds });
727
955
  }
728
956
  async deleteScheduledMessage(chatId, messageId) {
729
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("deleteScheduledMessage");
957
+ this.#c.storage.assertUser("deleteScheduledMessage");
730
958
  return await this.deleteScheduledMessages(chatId, [messageId]);
731
959
  }
732
960
  async sendScheduledMessages(chatId, messageIds) {
733
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("sendScheduledMessages");
961
+ this.#c.storage.assertUser("sendScheduledMessages");
734
962
  (0, _0_utilities_js_1.checkArray)(messageIds, _0_utilities_js_1.checkMessageId);
735
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
736
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.sendScheduledMessages", peer, id: messageIds });
963
+ const peer = await this.#c.getInputPeer(chatId);
964
+ const result = await this.#c.invoke({ _: "messages.sendScheduledMessages", peer, id: messageIds });
737
965
  return await this.updatesToMessages(chatId, result);
738
966
  }
739
967
  async sendScheduledMessage(chatId, messageId) {
740
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("sendScheduledMessage");
968
+ this.#c.storage.assertUser("sendScheduledMessage");
741
969
  return (await this.sendScheduledMessages(chatId, [messageId]))[0];
742
970
  }
743
971
  async deleteChatMemberMessages(chatId, memberId) {
744
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("deleteChatMemberMessages");
745
- const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
746
- const participant = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(memberId);
747
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.deleteParticipantHistory", channel, participant });
972
+ this.#c.storage.assertUser("deleteChatMemberMessages");
973
+ const channel = await this.#c.getInputChannel(chatId);
974
+ const participant = await this.#c.getInputPeer(memberId);
975
+ await this.#c.invoke({ _: "channels.deleteParticipantHistory", channel, participant });
748
976
  }
749
977
  async pinMessage(chatId, messageId, params) {
750
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
751
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.updatePinnedMessage", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), silent: params?.disableNotification ? true : undefined, pm_oneside: params?.bothSides ? undefined : true });
978
+ this.#checkParams(params);
979
+ await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), silent: params?.disableNotification ? true : undefined, pm_oneside: params?.bothSides ? undefined : true });
752
980
  }
753
981
  async unpinMessage(chatId, messageId, params) {
754
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
755
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.updatePinnedMessage", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), unpin: true }, { businessConnectionId: params?.businessConnectionId });
982
+ this.#checkParams(params);
983
+ await this.#c.invoke({ _: "messages.updatePinnedMessage", peer: await this.#c.getInputPeer(chatId), id: (0, _0_utilities_js_1.checkMessageId)(messageId), unpin: true }, { businessConnectionId: params?.businessConnectionId });
756
984
  }
757
985
  async unpinMessages(chatId) {
758
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.unpinAllMessages", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId) });
986
+ await this.#c.invoke({ _: "messages.unpinAllMessages", peer: await this.#c.getInputPeer(chatId) });
987
+ }
988
+ async #sendReaction(chatId, messageId, reactions, params) {
989
+ await this.#c.invoke({ _: "messages.sendReaction", peer: await this.#c.getInputPeer(chatId), msg_id: (0, _0_utilities_js_1.checkMessageId)(messageId), reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)), big: params?.big ? true : undefined, add_to_recent: params?.addToRecents ? true : undefined });
759
990
  }
760
991
  async setReactions(chatId, messageId, reactions, params) {
761
- await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendReaction).call(this, chatId, messageId, reactions, params);
992
+ await this.#sendReaction(chatId, messageId, reactions, params);
762
993
  }
763
994
  async addReaction(chatId, messageId, reaction, params) {
764
995
  const message = await this.getMessage(chatId, messageId);
@@ -782,7 +1013,7 @@ class MessageManager {
782
1013
  const chosenReactions = (message.reactions ?? []).filter((v) => v.chosen);
783
1014
  for (const r of chosenReactions) {
784
1015
  if ((0, _3_types_js_2.reactionEqual)(r.reaction, reaction)) {
785
- const reactions = chosenReactions.filter((v) => v != r).map((v) => v.reaction);
1016
+ const reactions = chosenReactions.filter((v) => v !== r).map((v) => v.reaction);
786
1017
  await this.setReactions(chatId, messageId, reactions);
787
1018
  break;
788
1019
  }
@@ -795,7 +1026,7 @@ class MessageManager {
795
1026
  if (_2_tl_js_1.Api.is("updateNewMessage", update) || _2_tl_js_1.Api.is("updateNewChannelMessage", update) || _2_tl_js_1.Api.is("updateEditMessage", update) || _2_tl_js_1.Api.is("updateEditChannelMessage", update)) {
796
1027
  if (_2_tl_js_1.Api.is("message", update.message) || _2_tl_js_1.Api.is("messageService", update.message)) {
797
1028
  const chatId = _2_tl_js_1.Api.peerToChatId(update.message.peer_id);
798
- await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.setMessage(chatId, update.message.id, update.message);
1029
+ await this.#c.messageStorage.setMessage(chatId, update.message.id, update.message);
799
1030
  }
800
1031
  }
801
1032
  if (_2_tl_js_1.Api.isOneOf([
@@ -811,13 +1042,13 @@ class MessageManager {
811
1042
  const isOutgoing = update.message.out;
812
1043
  let shouldIgnore = false;
813
1044
  if (isOutgoing) {
814
- if (__classPrivateFieldGet(this, _MessageManager_c, "f").outgoingMessages == null) {
815
- __classPrivateFieldGet(this, _MessageManager_c, "f").outgoingMessages = __classPrivateFieldGet(this, _MessageManager_c, "f").storage.accountType == "user" ? "all" : "business";
1045
+ if (this.#c.outgoingMessages === null) {
1046
+ this.#c.outgoingMessages = this.#c.storage.accountType === "user" ? "all" : "business";
816
1047
  }
817
- if (__classPrivateFieldGet(this, _MessageManager_c, "f").outgoingMessages == "none") {
1048
+ if (this.#c.outgoingMessages === "none") {
818
1049
  shouldIgnore = true;
819
1050
  }
820
- else if (__classPrivateFieldGet(this, _MessageManager_c, "f").outgoingMessages == "business") {
1051
+ else if (this.#c.outgoingMessages === "business") {
821
1052
  if (!_2_tl_js_1.Api.is("updateBotNewBusinessMessage", update) && !_2_tl_js_1.Api.is("updateBotEditBusinessMessage", update)) {
822
1053
  shouldIgnore = true;
823
1054
  }
@@ -842,7 +1073,7 @@ class MessageManager {
842
1073
  if (_2_tl_js_1.Api.is("updateDeleteMessages", update)) {
843
1074
  const deletedMessages = new Array();
844
1075
  for (const messageId of update.messages) {
845
- const chatId = await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.getMessageChat(messageId);
1076
+ const chatId = await this.#c.messageStorage.getMessageChat(messageId);
846
1077
  if (chatId) {
847
1078
  deletedMessages.push({ chatId, messageId });
848
1079
  }
@@ -855,8 +1086,8 @@ class MessageManager {
855
1086
  const chatId = _2_tl_js_1.Api.getChannelChatId(update.channel_id);
856
1087
  const deletedMessages = new Array();
857
1088
  for (const messageId of update.messages) {
858
- const message = await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.getMessage(chatId, messageId);
859
- if (message != null) {
1089
+ const message = await this.#c.messageStorage.getMessage(chatId, messageId);
1090
+ if (message !== null) {
860
1091
  deletedMessages.push({ chatId, messageId });
861
1092
  }
862
1093
  }
@@ -874,13 +1105,13 @@ class MessageManager {
874
1105
  }
875
1106
  if (_2_tl_js_1.Api.is("updateTranscribedAudio", update)) {
876
1107
  const voiceTranscription = (0, _3_types_js_1.constructVoiceTranscription)(update);
877
- await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.setVoiceTranscription(voiceTranscription);
1108
+ await this.#c.messageStorage.setVoiceTranscription(voiceTranscription);
878
1109
  return { voiceTranscription };
879
1110
  }
880
1111
  return null;
881
1112
  }
882
1113
  async sendChatAction(chatId, action, params) {
883
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
1114
+ this.#checkParams(params);
884
1115
  let action_;
885
1116
  switch (action) {
886
1117
  case "type":
@@ -919,11 +1150,27 @@ class MessageManager {
919
1150
  default:
920
1151
  throw new _0_errors_js_1.InputError(`Invalid chat action: ${action}`);
921
1152
  }
922
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.setTyping", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), action: action_, top_msg_id: params?.messageThreadId }, { businessConnectionId: params?.businessConnectionId });
1153
+ await this.#c.invoke({ _: "messages.setTyping", peer: await this.#c.getInputPeer(chatId), action: action_, top_msg_id: params?.messageThreadId }, { businessConnectionId: params?.businessConnectionId });
923
1154
  }
924
- async searchMessages(chatId, query, params) {
925
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("searchMessages");
926
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.search", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), q: query, add_offset: 0, filter: (0, _0_message_search_filter_js_1.messageSearchFilterToTlObject)(params?.filter ?? "empty"), hash: 0n, limit: (0, _0_utilities_js_1.getLimit)(params?.limit), max_date: 0, max_id: 0, min_date: 0, min_id: 0, offset_id: params?.after ? params.after : 0, from_id: params?.from ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.from) : undefined });
1155
+ async searchMessages(params) {
1156
+ this.#c.storage.assertUser("searchMessages");
1157
+ const peer = params?.chatId === undefined ? { _: "inputPeerEmpty" } : await this.#c.getInputPeer(params.chatId);
1158
+ const query = params?.query ?? "";
1159
+ const result = await this.#c.invoke({
1160
+ _: "messages.search",
1161
+ peer,
1162
+ q: query,
1163
+ add_offset: params?.addOffset ?? 0,
1164
+ filter: (0, _0_message_search_filter_js_1.messageSearchFilterToTlObject)(params?.filter ?? "empty"),
1165
+ hash: 0n,
1166
+ limit: (0, _0_utilities_js_1.getLimit)(params?.limit),
1167
+ max_date: 0,
1168
+ max_id: 0,
1169
+ min_date: 0,
1170
+ min_id: 0,
1171
+ offset_id: params?.offset ? params.offset : 0,
1172
+ from_id: params?.from ? await this.#c.getInputPeer(params.from) : undefined,
1173
+ });
927
1174
  if (!("messages" in result)) {
928
1175
  (0, _0_deps_js_1.unreachable)();
929
1176
  }
@@ -935,25 +1182,25 @@ class MessageManager {
935
1182
  return messages;
936
1183
  }
937
1184
  async blockUser(userId) {
938
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("blockUser");
939
- const id = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(userId);
940
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "contacts.block", id });
1185
+ this.#c.storage.assertUser("blockUser");
1186
+ const id = await this.#c.getInputPeer(userId);
1187
+ await this.#c.invoke({ _: "contacts.block", id });
941
1188
  }
942
1189
  async unblockUser(userId) {
943
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("unblockUser");
944
- const id = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(userId);
945
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "contacts.unblock", id });
1190
+ this.#c.storage.assertUser("unblockUser");
1191
+ const id = await this.#c.getInputPeer(userId);
1192
+ await this.#c.invoke({ _: "contacts.unblock", id });
946
1193
  }
947
1194
  async setChatStickerSet(chatId, setName) {
948
- const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
949
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetShortName", short_name: setName } });
1195
+ const channel = await this.#c.getInputChannel(chatId);
1196
+ await this.#c.invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetShortName", short_name: setName } });
950
1197
  }
951
1198
  async deleteChatStickerSet(chatId) {
952
- const channel = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputChannel(chatId);
953
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetEmpty" } });
1199
+ const channel = await this.#c.getInputChannel(chatId);
1200
+ await this.#c.invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetEmpty" } });
954
1201
  }
955
1202
  async stopPoll(chatId, messageId, params) {
956
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
1203
+ this.#checkParams(params);
957
1204
  const message = await this.getMessage(chatId, messageId);
958
1205
  if (!message) {
959
1206
  throw new _0_errors_js_1.InputError("Message not found.");
@@ -964,26 +1211,26 @@ class MessageManager {
964
1211
  if (message.poll.isClosed) {
965
1212
  throw new _0_errors_js_1.InputError("Poll is already stopped.");
966
1213
  }
967
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
1214
+ const result = await this.#c.invoke({
968
1215
  _: "messages.editMessage",
969
- peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
1216
+ peer: await this.#c.getInputPeer(chatId),
970
1217
  id: messageId,
971
1218
  media: ({ _: "inputMediaPoll", poll: ({ _: "poll", id: BigInt(message.poll.id), closed: true, question: { _: "textWithEntities", text: "", entities: [] }, answers: [] }) }),
972
- reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
1219
+ reply_markup: await this.#constructReplyMarkup(params),
973
1220
  }, { businessConnectionId: params?.businessConnectionId });
974
1221
  const message_ = (await this.updatesToMessages(chatId, result))[0];
975
1222
  return (0, _3_types_js_2.assertMessageType)(message_, "poll").poll;
976
1223
  }
977
1224
  async editMessageLiveLocation(chatId, messageId, latitude, longitude, params) {
978
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
1225
+ this.#checkParams(params);
979
1226
  const message = await this.getMessage(chatId, messageId);
980
1227
  if (message && "location" in message && message.location.livePeriod) {
981
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
1228
+ const result = await this.#c.invoke({
982
1229
  _: "messages.editMessage",
983
- peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId),
1230
+ peer: await this.#c.getInputPeer(chatId),
984
1231
  id: messageId,
985
1232
  media: ({ _: "inputMediaGeoLive", geo_point: ({ _: "inputGeoPoint", lat: latitude, long: longitude, accuracy_radius: params?.horizontalAccuracy }), heading: params?.heading, proximity_notification_radius: params?.proximityAlertRadius }),
986
- reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
1233
+ reply_markup: await this.#constructReplyMarkup(params),
987
1234
  }, { businessConnectionId: params?.businessConnectionId });
988
1235
  const message = (await this.updatesToMessages(chatId, result))[0];
989
1236
  return (0, _3_types_js_2.assertMessageType)(message, "location");
@@ -991,19 +1238,19 @@ class MessageManager {
991
1238
  (0, _0_deps_js_1.unreachable)();
992
1239
  }
993
1240
  async editInlineMessageLiveLocation(inlineMessageId, latitude, longitude, params) {
994
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
995
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("editInlineMessageLiveLocation");
1241
+ this.#checkParams(params);
1242
+ this.#c.storage.assertBot("editInlineMessageLiveLocation");
996
1243
  const id = await (0, _3_types_js_2.deserializeInlineMessageId)(inlineMessageId);
997
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
1244
+ await this.#c.invoke({
998
1245
  _: "messages.editInlineBotMessage",
999
1246
  id,
1000
1247
  media: ({ _: "inputMediaGeoLive", geo_point: ({ _: "inputGeoPoint", lat: latitude, long: longitude, accuracy_radius: params?.horizontalAccuracy }), heading: params?.heading, proximity_notification_radius: params?.proximityAlertRadius }),
1001
- reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
1248
+ reply_markup: await this.#constructReplyMarkup(params),
1002
1249
  }, { dc: (0, _3_transport_js_1.getDc)(id.dc_id) });
1003
1250
  }
1004
1251
  async sendInvoice(chatId, title, description, payload, currency, prices, params) {
1005
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("sendInvoice");
1006
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
1252
+ this.#c.storage.assertBot("sendInvoice");
1253
+ this.#checkParams(params);
1007
1254
  if (title.length < 1) {
1008
1255
  throw new _0_errors_js_1.InputError("Invoice title cannot be empty.");
1009
1256
  }
@@ -1030,7 +1277,7 @@ class MessageManager {
1030
1277
  phone_to_provider: params?.sendPhoneNumberToProvider || undefined,
1031
1278
  flexible: params?.flexible || undefined,
1032
1279
  };
1033
- const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendMedia).call(this, chatId, {
1280
+ const message = await this.#sendMedia(chatId, {
1034
1281
  _: "inputMediaInvoice",
1035
1282
  title,
1036
1283
  description,
@@ -1056,7 +1303,7 @@ class MessageManager {
1056
1303
  return (0, _3_types_js_2.assertMessageType)(message, "invoice");
1057
1304
  }
1058
1305
  async sendMediaGroup(chatId, media, params) {
1059
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
1306
+ this.#checkParams(params);
1060
1307
  {
1061
1308
  if (!Array.isArray(media) || !media.length) {
1062
1309
  throw new _0_errors_js_1.InputError("Media group must not be empty.");
@@ -1067,13 +1314,13 @@ class MessageManager {
1067
1314
  for (const media_ of media) {
1068
1315
  // deno-lint-ignore no-explicit-any
1069
1316
  const thisMediaType = media_?.animation !== undefined ? "animation" : media_?.audio !== undefined ? "audio" : media_?.photo !== undefined ? "photo" : media_?.video !== undefined ? "video" : "document";
1070
- if (thisMediaType == "animation") {
1317
+ if (thisMediaType === "animation") {
1071
1318
  throw new _0_errors_js_1.InputError("Media groups cannot consist of animations.");
1072
1319
  }
1073
- if ((firstMediaType == "video" || firstMediaType == "photo") && (thisMediaType != "video" && thisMediaType != "photo")) {
1320
+ if ((firstMediaType === "video" || firstMediaType === "photo") && (thisMediaType !== "video" && thisMediaType !== "photo")) {
1074
1321
  throw new _0_errors_js_1.InputError(`Media of the type ${firstMediaType} cannot be mixed with those of the type ${thisMediaType}.`);
1075
1322
  }
1076
- if (firstMediaType != "video" && firstMediaType != "photo" && firstMediaType != thisMediaType) {
1323
+ if (firstMediaType !== "video" && firstMediaType !== "photo" && firstMediaType !== thisMediaType) {
1077
1324
  throw new _0_errors_js_1.InputError(`Media of the type ${firstMediaType} cannot be mixed with other types.`);
1078
1325
  }
1079
1326
  }
@@ -1082,25 +1329,25 @@ class MessageManager {
1082
1329
  for (const v of media) {
1083
1330
  const randomId = (0, _1_utilities_js_1.getRandomId)();
1084
1331
  const [message, entities] = v.caption !== undefined ? await this.parseText(v.caption, { entities: v.captionEntities, parseMode: v.parseMode }) : ["", []];
1085
- multiMedia.push({ _: "inputSingleMedia", message, entities, random_id: randomId, media: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMedia).call(this, v) });
1332
+ multiMedia.push({ _: "inputSingleMedia", message, entities, random_id: randomId, media: await this.#resolveInputMedia(v) });
1086
1333
  }
1087
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
1334
+ const peer = await this.#c.getInputPeer(chatId);
1088
1335
  for (const [i, media_] of multiMedia.entries()) {
1089
1336
  if (_2_tl_js_1.Api.is("inputMediaUploadedPhoto", media_.media)) {
1090
- const result = _2_tl_js_1.Api.as("messageMediaPhoto", await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.uploadMedia", media: media_.media, peer }));
1337
+ const result = _2_tl_js_1.Api.as("messageMediaPhoto", await this.#c.invoke({ _: "messages.uploadMedia", media: media_.media, peer }));
1091
1338
  const photo = _2_tl_js_1.Api.as("photo", result.photo);
1092
1339
  multiMedia[i] = { ...media_, media: { _: "inputMediaPhoto", id: { ...photo, _: "inputPhoto" } } };
1093
1340
  }
1094
1341
  else if (_2_tl_js_1.Api.is("inputMediaUploadedDocument", media_.media)) {
1095
- const result = _2_tl_js_1.Api.as("messageMediaDocument", await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.uploadMedia", media: media_.media, peer }));
1342
+ const result = _2_tl_js_1.Api.as("messageMediaDocument", await this.#c.invoke({ _: "messages.uploadMedia", media: media_.media, peer }));
1096
1343
  const document = _2_tl_js_1.Api.as("document", result.document);
1097
1344
  multiMedia[i] = { ...media_, media: { _: "inputMediaDocument", id: { ...document, _: "inputDocument" } } };
1098
1345
  }
1099
1346
  }
1100
1347
  const silent = params?.disableNotification ? true : undefined;
1101
1348
  const noforwards = params?.protectContent ? true : undefined;
1102
- const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
1103
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
1349
+ const sendAs = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
1350
+ const result = await this.#c.invoke({
1104
1351
  _: "messages.sendMultiMedia",
1105
1352
  peer,
1106
1353
  multi_media: multiMedia,
@@ -1108,19 +1355,19 @@ class MessageManager {
1108
1355
  noforwards,
1109
1356
  silent,
1110
1357
  send_as: sendAs,
1111
- reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
1358
+ reply_to: await this.#constructReplyTo(params),
1112
1359
  allow_paid_floodskip: params?.paidBroadcast ? true : undefined,
1113
1360
  });
1114
1361
  return await this.updatesToMessages(chatId, result);
1115
1362
  }
1116
1363
  async readMessages(chatId, untilMessageId) {
1117
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("readMessages");
1118
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
1364
+ this.#c.storage.assertUser("readMessages");
1365
+ const peer = await this.#c.getInputPeer(chatId);
1119
1366
  const max_id = untilMessageId;
1120
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.readHistory", peer, max_id });
1367
+ await this.#c.invoke({ _: "messages.readHistory", peer, max_id });
1121
1368
  }
1122
1369
  async startBot(botId, params) {
1123
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("startBot");
1370
+ this.#c.storage.assertUser("startBot");
1124
1371
  const start_param = params?.deeplink?.trim() || "";
1125
1372
  if (params?.chatId !== undefined && !start_param) {
1126
1373
  throw new _0_errors_js_1.InputError("deeplink cannot be unspecified while chatId is specified.");
@@ -1128,31 +1375,47 @@ class MessageManager {
1128
1375
  if (!params?.deeplink) {
1129
1376
  return await this.sendMessage(botId, "/start");
1130
1377
  }
1131
- const bot = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(botId);
1132
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params?.chatId || botId);
1133
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.startBot", bot, peer, random_id: (0, _1_utilities_js_1.getRandomId)(), start_param });
1378
+ const bot = await this.#c.getInputUser(botId);
1379
+ const peer = await this.#c.getInputPeer(params?.chatId || botId);
1380
+ const result = await this.#c.invoke({ _: "messages.startBot", bot, peer, random_id: (0, _1_utilities_js_1.getRandomId)(), start_param });
1134
1381
  return (await this.updatesToMessages(botId, result))[0];
1135
1382
  }
1136
1383
  async transcribeVoice(chatId, messageId) {
1137
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("transcribeVoice");
1384
+ this.#c.storage.assertUser("transcribeVoice");
1138
1385
  const message = await this.getMessage(chatId, messageId);
1139
- if (message == null) {
1386
+ if (message === null) {
1140
1387
  throw new _0_errors_js_1.InputError("Message not found.");
1141
1388
  }
1142
1389
  if (!(0, _3_types_js_1.isMessageType)(message, "voice")) {
1143
1390
  throw new _0_errors_js_1.InputError("Message not voice.");
1144
1391
  }
1145
- const cachedTranscription = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_getCachedVoiceTranscription).call(this, message);
1392
+ const cachedTranscription = await this.#getCachedVoiceTranscription(message);
1146
1393
  if (cachedTranscription) {
1147
1394
  return cachedTranscription;
1148
1395
  }
1149
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
1150
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.transcribeAudio", peer, msg_id: messageId });
1151
- return await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_cacheVoiceTranscription).call(this, message, (0, _3_types_js_1.constructVoiceTranscription)(result));
1396
+ const peer = await this.#c.getInputPeer(chatId);
1397
+ const result = await this.#c.invoke({ _: "messages.transcribeAudio", peer, msg_id: messageId });
1398
+ return await this.#cacheVoiceTranscription(message, (0, _3_types_js_1.constructVoiceTranscription)(result));
1399
+ }
1400
+ async #getCachedVoiceTranscription(message) {
1401
+ const reference = await this.#c.messageStorage.getVoiceTranscriptionReference(message.chat.id, message.id, (0, _1_utilities_js_1.fromUnixTimestamp)(message.editDate ?? message.date));
1402
+ if (!reference) {
1403
+ return null;
1404
+ }
1405
+ const voiceTranscription = await this.#c.messageStorage.getVoiceTranscription(reference);
1406
+ if (!voiceTranscription || !voiceTranscription.done) {
1407
+ return null;
1408
+ }
1409
+ return voiceTranscription;
1410
+ }
1411
+ async #cacheVoiceTranscription(message, voiceTranscription) {
1412
+ await this.#c.messageStorage.setVoiceTranscriptionReference(message.chat.id, message.id, (0, _1_utilities_js_1.fromUnixTimestamp)(message.editDate ?? message.date), BigInt(voiceTranscription.id));
1413
+ await this.#c.messageStorage.setVoiceTranscription(voiceTranscription);
1414
+ return voiceTranscription;
1152
1415
  }
1153
1416
  async resolveMessageLink(link) {
1154
- const parseResult = _a.parseMessageLink(link);
1155
- if (parseResult == null) {
1417
+ const parseResult = MessageManager.parseMessageLink(link);
1418
+ if (parseResult === null) {
1156
1419
  throw new _0_errors_js_1.InputError("Invalid messsage link.");
1157
1420
  }
1158
1421
  const [chatId, messageId] = parseResult;
@@ -1181,10 +1444,10 @@ class MessageManager {
1181
1444
  throw err;
1182
1445
  }
1183
1446
  }
1184
- if (url.protocol != "http:" && url.protocol != "https:") {
1447
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
1185
1448
  return null;
1186
1449
  }
1187
- if (url.host != "t.me") {
1450
+ if (url.host !== "t.me") {
1188
1451
  return null;
1189
1452
  }
1190
1453
  const parts = url.pathname.split("/").filter((v) => v);
@@ -1195,7 +1458,7 @@ class MessageManager {
1195
1458
  return null;
1196
1459
  }
1197
1460
  let peer, id;
1198
- if (parts[0] == "c") {
1461
+ if (parts[0] === "c") {
1199
1462
  if (parts.length < 3 || parts.length > 4) {
1200
1463
  return null;
1201
1464
  }
@@ -1222,7 +1485,7 @@ class MessageManager {
1222
1485
  }
1223
1486
  if (typeof peer === "string") {
1224
1487
  try {
1225
- if ((0, _0_utilities_js_1.getUsername)(peer) != peer) {
1488
+ if ((0, _0_utilities_js_1.getUsername)(peer) !== peer) {
1226
1489
  return null;
1227
1490
  }
1228
1491
  }
@@ -1237,21 +1500,53 @@ class MessageManager {
1237
1500
  }
1238
1501
  return [peer, id];
1239
1502
  }
1503
+ async getStickerSet(name) {
1504
+ if (name.includes("/")) {
1505
+ let valid = false;
1506
+ try {
1507
+ const url = new URL(name);
1508
+ const pathname = "/addstickers/";
1509
+ valid = (url.protocol === "http:" || url.protocol === "https:") && url.hostname === "t.me" && url.pathname.startsWith(pathname) && url.pathname.length > _3_errors_js_1.PackShortNameInvalid.length;
1510
+ if (valid) {
1511
+ name = url.pathname.slice(pathname.length);
1512
+ if (name.endsWith("/")) {
1513
+ name = name.slice(0, -1);
1514
+ if (name === "") {
1515
+ valid = false;
1516
+ }
1517
+ }
1518
+ }
1519
+ }
1520
+ catch (err) {
1521
+ if (err instanceof TypeError) {
1522
+ valid = false;
1523
+ }
1524
+ else {
1525
+ throw err;
1526
+ }
1527
+ }
1528
+ if (!valid) {
1529
+ throw new _0_errors_js_1.InputError("Invalid sticker set name or link.");
1530
+ }
1531
+ }
1532
+ const result = await this.#c.invoke({ _: "messages.getStickerSet", hash: 0, stickerset: { _: "inputStickerSetShortName", short_name: name } });
1533
+ return (0, _3_types_js_1.constructStickerSet)(result);
1534
+ }
1240
1535
  async openMiniApp(botId, chatId, params) {
1241
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("openMiniApp");
1536
+ this.#c.storage.assertUser("openMiniApp");
1242
1537
  const from_bot_menu = params?.fromMenu ? true : undefined;
1243
1538
  const silent = params?.disableNotification ? true : undefined;
1244
1539
  const compact = params?.mode === "compact" ? true : undefined;
1245
1540
  const fullscreen = params?.mode === "fullscreen" ? true : undefined;
1246
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
1247
- const bot = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputUser(botId);
1541
+ const peer = await this.#c.getInputPeer(chatId);
1542
+ const bot = await this.#c.getInputUser(botId);
1248
1543
  const url = params?.url;
1249
1544
  const start_param = params?.startParameter;
1250
1545
  const theme_params = params?.themeParameters ? { _: "dataJSON", data: params.themeParameters } : undefined;
1251
- const platform = __classPrivateFieldGet(this, _MessageManager_c, "f").langPack ?? "";
1252
- const reply_to = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params);
1253
- const send_as = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
1254
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
1546
+ const platform = this.#c.langPack ?? "";
1547
+ const reply_to = await this.#constructReplyTo(params);
1548
+ const send_as = params?.sendAs ? await this.#c.getInputPeer(params.sendAs) : undefined;
1549
+ const result = await this.#c.invoke({
1255
1550
  _: "messages.requestWebView",
1256
1551
  from_bot_menu,
1257
1552
  silent,
@@ -1268,244 +1563,63 @@ class MessageManager {
1268
1563
  });
1269
1564
  return (0, _3_types_js_1.constructMiniAppInfo)(result);
1270
1565
  }
1271
- }
1272
- exports.MessageManager = MessageManager;
1273
- _a = MessageManager, _MessageManager_c = new WeakMap(), _MessageManager_LresolveFileId = new WeakMap(), _MessageManager_instances = new WeakSet(), _MessageManager_checkParams = function _MessageManager_checkParams(params) {
1274
- if (params && "replyMarkup" in params && params.replyMarkup !== undefined) {
1275
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("replyMarkup");
1276
- }
1277
- if (params && "businessConnectionId" in params && params.businessConnectionId !== undefined) {
1278
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("businessConnectionId");
1279
- }
1280
- if (params && "sendAs" in params && params.sendAs !== undefined) {
1281
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("sendAs");
1282
- }
1283
- if (params && "sendAt" in params && params.sendAt !== undefined) {
1284
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("businessConsendAtnectionId");
1285
- }
1286
- }, _MessageManager_constructReplyMarkup = async function _MessageManager_constructReplyMarkup(params) {
1287
- if (params?.replyMarkup) {
1288
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertBot("replyMarkup");
1289
- return await (0, _3_types_js_2.replyMarkupToTlObject)(params.replyMarkup, this.usernameResolver.bind(this));
1290
- }
1291
- }, _MessageManager_resolveSendAs = async function _MessageManager_resolveSendAs(params) {
1292
- const sendAs = params?.sendAs;
1293
- if (sendAs !== undefined) {
1294
- __classPrivateFieldGet(this, _MessageManager_c, "f").storage.assertUser("sendAs");
1295
- return sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(sendAs) : undefined;
1296
- }
1297
- }, _MessageManager_constructReplyTo = async function _MessageManager_constructReplyTo(params) {
1298
- const topMsgId = params?.messageThreadId;
1299
- if (!params?.replyTo) {
1300
- if (topMsgId) {
1301
- return { _: "inputReplyToMessage", reply_to_msg_id: topMsgId };
1302
- }
1303
- else {
1304
- return undefined;
1305
- }
1306
- }
1307
- if ("messageId" in params.replyTo) {
1308
- return { _: "inputReplyToMessage", reply_to_msg_id: params.replyTo.messageId, top_msg_id: topMsgId, quote_text: params.replyTo.quote?.text, quote_entities: await Promise.all(params.replyTo.quote?.entities.map((v) => (0, _3_types_js_2.messageEntityToTlObject)(v, __classPrivateFieldGet(this, _MessageManager_c, "f").getEntity)) ?? []), quote_offset: params.replyTo.quote?.offset };
1309
- }
1310
- else {
1311
- return { _: "inputReplyToStory", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.replyTo.chatId), story_id: params.replyTo.storyId };
1312
- }
1313
- }, _MessageManager_sendDocumentInner = async function _MessageManager_sendDocumentInner(chatId, document, params, fileType, otherAttribs, urlSupported = true, expectedMimeTypes) {
1314
- let media = null;
1315
- const spoiler = params?.hasSpoiler ? true : undefined;
1316
- const ttl_seconds = params && "selfDestruct" in params && typeof params.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(params.selfDestruct) : undefined;
1317
- if (typeof document === "string") {
1318
- const fileId = this.resolveFileId(document, fileType);
1319
- if (fileId != null) {
1320
- media = { _: "inputMediaDocument", id: { ...fileId, _: "inputDocument" }, spoiler, query: otherAttribs.find((v) => _2_tl_js_1.Api.is("documentAttributeSticker", v))?.alt || undefined, ttl_seconds };
1566
+ async getSavedMessages(chatId, params) {
1567
+ this.#c.storage.assertUser("getSavedMessages");
1568
+ const peer = await this.#c.getInputPeer(chatId);
1569
+ const limit = (0, _0_utilities_js_1.getLimit)(params?.limit);
1570
+ let offsetId = params?.offsetId ?? 0;
1571
+ if (offsetId < 0) {
1572
+ offsetId = 0;
1321
1573
  }
1322
- }
1323
- if (media == null) {
1324
- if (typeof document === "string" && (0, _0_utilities_js_1.isHttpUrl)(document)) {
1325
- if (!urlSupported) {
1326
- throw new _0_errors_js_1.InputError("URL not supported.");
1327
- }
1328
- media = { _: "inputMediaDocumentExternal", url: document, spoiler, ttl_seconds };
1574
+ let offsetDate = params?.offsetDate ?? 0;
1575
+ if (offsetDate < 0) {
1576
+ offsetDate = 0;
1329
1577
  }
1330
- else {
1331
- let mimeType;
1332
- const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(document, params, (name) => {
1333
- mimeType = params?.mimeType ?? (0, _0_deps_js_1.contentType)(name.split(".").slice(-1)[0]) ?? FALLBACK_MIME_TYPE;
1334
- if (expectedMimeTypes && !expectedMimeTypes.includes(mimeType)) {
1335
- (0, _0_deps_js_1.unreachable)();
1336
- }
1337
- if (name.endsWith(".tgs") && fileType == _3_types_js_2.FileType.Document) {
1338
- name += "-";
1339
- }
1340
- return name;
1341
- });
1342
- if (_2_tl_js_1.Api.is("inputFileStoryDocument", file)) {
1343
- (0, _0_deps_js_1.unreachable)();
1344
- }
1345
- let thumb = undefined;
1346
- if (params?.thumbnail) {
1347
- thumb = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(params.thumbnail, { chunkSize: params?.chunkSize, signal: params?.signal });
1348
- }
1349
- media = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType == _3_types_js_2.FileType.Document ? true : undefined, ttl_seconds };
1350
- }
1351
- }
1352
- const message = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_sendMedia).call(this, chatId, media, params);
1353
- return message;
1354
- }, _MessageManager_sendMedia = async function _MessageManager_sendMedia(chatId, media, params) {
1355
- if (params?.starCount !== undefined) {
1356
- if (params.starCount <= 0) {
1357
- throw new _0_errors_js_1.InputError("starCount cannot be zero or negative");
1358
- }
1359
- media = { _: "inputMediaPaidMedia", stars_amount: BigInt(params.starCount), extended_media: [media] };
1360
- }
1361
- const peer = await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId);
1362
- const randomId = (0, _1_utilities_js_1.getRandomId)();
1363
- const silent = params?.disableNotification ? true : undefined;
1364
- const noforwards = params?.protectContent ? true : undefined;
1365
- const sendAs = params?.sendAs ? await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(params.sendAs) : undefined;
1366
- const replyMarkup = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params);
1367
- const caption_ = params?.caption;
1368
- const parseResult = caption_ !== undefined ? await this.parseText(caption_, { parseMode: params?.parseMode, entities: params?.captionEntities }) : undefined;
1369
- const caption = parseResult === undefined ? undefined : parseResult[0];
1370
- const captionEntities = parseResult === undefined ? undefined : parseResult[1];
1371
- const result = await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
1372
- _: "messages.sendMedia",
1373
- peer,
1374
- random_id: randomId,
1375
- silent,
1376
- noforwards,
1377
- reply_markup: replyMarkup,
1378
- reply_to: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyTo).call(this, params),
1379
- send_as: sendAs,
1380
- media,
1381
- message: caption ?? "",
1382
- entities: captionEntities,
1383
- effect: params?.effectId ? BigInt(params.effectId) : undefined,
1384
- schedule_date: params?.sendAt,
1385
- allow_paid_floodskip: params?.paidBroadcast ? true : undefined,
1386
- }, { businessConnectionId: params?.businessConnectionId });
1387
- return (await this.updatesToMessages(chatId, result, params?.businessConnectionId))[0];
1388
- }, _MessageManager_editInlineMessageTextInner = async function _MessageManager_editInlineMessageTextInner(inlineMessageId, text, params, allowEmpty = true) {
1389
- __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_checkParams).call(this, params);
1390
- const [message, entities] = await this.parseText(text, params);
1391
- if (!allowEmpty && !message) {
1392
- throw new _0_errors_js_1.InputError("Message text cannot be empty.");
1393
- }
1394
- const id = await (0, _3_types_js_2.deserializeInlineMessageId)(inlineMessageId);
1395
- if (params?.linkPreview && params.linkPreview.type != "input") {
1396
- throw new _0_errors_js_1.InputError("Expected link preview of type input.");
1397
- }
1398
- const noWebpage = params?.linkPreview && params.linkPreview.type == "input" && params.linkPreview.disable ? true : undefined;
1399
- const invertMedia = params?.linkPreview?.aboveText ? true : undefined;
1400
- let media = undefined;
1401
- if (!noWebpage && params?.linkPreview?.url) {
1402
- media = { _: "inputMediaWebPage", url: params.linkPreview.url, force_large_media: params.linkPreview.largeMedia ? true : undefined, force_small_media: params.linkPreview.smallMedia ? true : undefined, optional: message.length ? undefined : true };
1403
- }
1404
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({
1405
- _: "messages.editInlineBotMessage",
1406
- id,
1407
- entities,
1408
- message,
1409
- media,
1410
- no_webpage: noWebpage,
1411
- invert_media: invertMedia,
1412
- reply_markup: await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_constructReplyMarkup).call(this, params),
1413
- }, { dc: (0, _3_transport_js_1.getDc)(id.dc_id) });
1414
- }, _MessageManager_resolveInputMediaInner = async function _MessageManager_resolveInputMediaInner(document, media, fileType, otherAttribs) {
1415
- let media_ = null;
1416
- const spoiler = "hasSpoiler" in media && media.hasSpoiler ? true : undefined;
1417
- if (typeof document === "string") {
1418
- const fileId = this.resolveFileId(document, fileType);
1419
- if (fileId != null) {
1420
- media_ = { _: "inputMediaDocument", id: { ...fileId, _: "inputDocument" }, spoiler, query: otherAttribs.find((v) => _2_tl_js_1.Api.is("documentAttributeSticker", v))?.alt || undefined };
1421
- }
1422
- }
1423
- if (media_ == null) {
1424
- if (typeof document === "string" && (0, _0_utilities_js_1.isHttpUrl)(document)) {
1425
- media_ = { _: "inputMediaDocumentExternal", url: document, spoiler };
1578
+ const result = await this.#c.invoke({
1579
+ _: "messages.getSavedHistory",
1580
+ peer,
1581
+ limit,
1582
+ offset_id: offsetId,
1583
+ offset_date: offsetDate,
1584
+ add_offset: params?.addOffset ?? 0,
1585
+ hash: 0n,
1586
+ max_id: 0,
1587
+ min_id: 0,
1588
+ });
1589
+ if (!("messages" in result)) {
1590
+ (0, _0_deps_js_1.unreachable)();
1426
1591
  }
1427
- else {
1428
- let mimeType;
1429
- const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(document, media, (name) => {
1430
- mimeType = media?.mimeType ?? (0, _0_deps_js_1.contentType)(name.split(".").slice(-1)[0]) ?? FALLBACK_MIME_TYPE;
1431
- if (name.endsWith(".tgs") && fileType == _3_types_js_2.FileType.Document) {
1432
- name += "-";
1433
- }
1434
- return name;
1435
- });
1436
- if (_2_tl_js_1.Api.is("inputFileStoryDocument", file)) {
1437
- (0, _0_deps_js_1.unreachable)();
1438
- }
1439
- let thumb = undefined;
1440
- if ("thumbnail" in media && media.thumbnail) {
1441
- thumb = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(media.thumbnail, { chunkSize: media?.chunkSize, signal: media?.signal });
1442
- }
1443
- media_ = { _: "inputMediaUploadedDocument", file, thumb, spoiler, attributes: [{ _: "documentAttributeFilename", file_name: file.name }, ...otherAttribs], mime_type: mimeType, force_file: fileType == _3_types_js_2.FileType.Document ? true : undefined };
1592
+ const messages = new Array();
1593
+ for (const message_ of result.messages) {
1594
+ const message = await this.constructMessage(message_, false);
1595
+ messages.push(message);
1444
1596
  }
1597
+ return messages;
1445
1598
  }
1446
- return media_;
1447
- }, _MessageManager_resolveInputMedia = async function _MessageManager_resolveInputMedia(media) {
1448
- if ("animation" in media) {
1449
- return await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMediaInner).call(this, media.animation, media, _3_types_js_2.FileType.Animation, [
1450
- { _: "documentAttributeAnimated" },
1451
- { _: "documentAttributeVideo", supports_streaming: true, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
1452
- ]);
1453
- }
1454
- else if ("audio" in media) {
1455
- return await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMediaInner).call(this, media.audio, media, _3_types_js_2.FileType.Audio, [
1456
- { _: "documentAttributeAudio", duration: media?.duration ?? 0, performer: media?.performer, title: media?.title },
1457
- ]);
1458
- }
1459
- else if ("document" in media) {
1460
- return await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMediaInner).call(this, media.document, media, _3_types_js_2.FileType.Document, []);
1461
- }
1462
- else if ("photo" in media) {
1463
- let media_ = null;
1464
- const spoiler = media.hasSpoiler ? true : undefined;
1465
- const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(media.selfDestruct) : undefined;
1466
- if (typeof media.photo === "string") {
1467
- const fileId = this.resolveFileId(media.photo, [_3_types_js_2.FileType.Photo, _3_types_js_2.FileType.ProfilePhoto]);
1468
- if (fileId != null) {
1469
- media_ = { _: "inputMediaPhoto", id: { ...fileId, _: "inputPhoto" }, spoiler, ttl_seconds };
1470
- }
1471
- }
1472
- if (media_ == null) {
1473
- if (typeof media.photo === "string" && (0, _0_utilities_js_1.isHttpUrl)(media.photo)) {
1474
- media_ = { _: "inputMediaPhotoExternal", url: media.photo, spoiler };
1475
- }
1476
- else {
1477
- const file = await __classPrivateFieldGet(this, _MessageManager_c, "f").fileManager.upload(media.photo, media, null, false);
1478
- media_ = { _: "inputMediaUploadedPhoto", file, spoiler, ttl_seconds };
1479
- }
1599
+ async getSavedChats(params) {
1600
+ const limit = (0, _0_utilities_js_1.getLimit)(params?.limit);
1601
+ let offsetId = params?.offsetId ?? 0;
1602
+ if (offsetId < 0) {
1603
+ offsetId = 0;
1480
1604
  }
1481
- return media_;
1482
- }
1483
- else if ("video" in media) {
1484
- const ttl_seconds = "selfDestruct" in media && media.selfDestruct !== undefined ? (0, _3_types_js_1.selfDestructOptionToInt)(media.selfDestruct) : undefined;
1485
- const media_ = await __classPrivateFieldGet(this, _MessageManager_instances, "m", _MessageManager_resolveInputMediaInner).call(this, media.video, media, _3_types_js_2.FileType.Video, [
1486
- { _: "documentAttributeVideo", supports_streaming: media?.supportsStreaming ? true : undefined, w: media?.width ?? 0, h: media?.height ?? 0, duration: media?.duration ?? 0 },
1487
- ]);
1488
- media_.ttl_seconds = ttl_seconds;
1489
- return media_;
1490
- }
1491
- else {
1492
- (0, _0_deps_js_1.unreachable)();
1493
- }
1494
- }, _MessageManager_sendReaction = async function _MessageManager_sendReaction(chatId, messageId, reactions, params) {
1495
- await __classPrivateFieldGet(this, _MessageManager_c, "f").invoke({ _: "messages.sendReaction", peer: await __classPrivateFieldGet(this, _MessageManager_c, "f").getInputPeer(chatId), msg_id: (0, _0_utilities_js_1.checkMessageId)(messageId), reaction: reactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)), big: params?.big ? true : undefined, add_to_recent: params?.addToRecents ? true : undefined });
1496
- }, _MessageManager_getCachedVoiceTranscription = async function _MessageManager_getCachedVoiceTranscription(message) {
1497
- const reference = await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.getVoiceTranscriptionReference(message.chat.id, message.id, (0, _1_utilities_js_1.fromUnixTimestamp)(message.editDate ?? message.date));
1498
- if (!reference) {
1499
- return null;
1500
- }
1501
- const voiceTranscription = await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.getVoiceTranscription(reference);
1502
- if (!voiceTranscription || !voiceTranscription.done) {
1503
- return null;
1605
+ let offsetDate = params?.offsetDate ?? 0;
1606
+ if (offsetDate < 0) {
1607
+ offsetDate = 0;
1608
+ }
1609
+ let offsetPeer = { _: "inputPeerEmpty" };
1610
+ if (params?.offsetChatId !== undefined) {
1611
+ offsetPeer = await this.#c.getInputPeer(params.offsetChatId);
1612
+ }
1613
+ const result = await this.#c.invoke({
1614
+ _: "messages.getSavedDialogs",
1615
+ hash: 0n,
1616
+ limit,
1617
+ offset_date: offsetDate,
1618
+ offset_id: offsetId,
1619
+ offset_peer: offsetPeer,
1620
+ exclude_pinned: params?.excludePinned || undefined,
1621
+ });
1622
+ return (0, _3_types_js_1.constructSavedChats)(result, this.#c.getEntity, this.getMessage.bind(this), this.#c.fileManager.getStickerSetName.bind(this.#c.fileManager));
1504
1623
  }
1505
- return voiceTranscription;
1506
- }, _MessageManager_cacheVoiceTranscription = async function _MessageManager_cacheVoiceTranscription(message, voiceTranscription) {
1507
- await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.setVoiceTranscriptionReference(message.chat.id, message.id, (0, _1_utilities_js_1.fromUnixTimestamp)(message.editDate ?? message.date), BigInt(voiceTranscription.id));
1508
- await __classPrivateFieldGet(this, _MessageManager_c, "f").messageStorage.setVoiceTranscription(voiceTranscription);
1509
- return voiceTranscription;
1510
- };
1511
- _MessageManager_CAPTIONABLE_MESSAGE_TYPES = { value: ["photo", "document", "video", "animation", "voice", "audio", "video"] };
1624
+ }
1625
+ exports.MessageManager = MessageManager;