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