@mtkruto/node 0.67.1 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/esm/0_errors.js +2 -6
  2. package/esm/3_errors.js +2 -12
  3. package/esm/3_transport.d.ts +3 -3
  4. package/esm/3_transport.js +3 -3
  5. package/esm/3_types.d.ts +8 -7
  6. package/esm/3_types.d.ts.map +1 -1
  7. package/esm/3_types.js +8 -7
  8. package/esm/4_errors.js +2 -12
  9. package/esm/_dnt.polyfills.d.ts +99 -0
  10. package/esm/_dnt.polyfills.d.ts.map +1 -1
  11. package/esm/_dnt.polyfills.js +127 -1
  12. package/esm/_dnt.test_polyfills.d.ts.map +1 -0
  13. package/esm/client/0_filters_test.d.ts.map +1 -1
  14. package/esm/client/0_markdown_test.d.ts.map +1 -1
  15. package/esm/client/0_params.d.ts +2 -0
  16. package/esm/client/0_params.d.ts.map +1 -1
  17. package/esm/client/0_password.d.ts +5 -5
  18. package/esm/client/0_password.d.ts.map +1 -1
  19. package/esm/client/0_password_test.d.ts.map +1 -1
  20. package/esm/client/0_storage_operations.js +143 -155
  21. package/esm/client/0_storage_operations_test.d.ts.map +1 -1
  22. package/esm/client/0_utilities.d.ts +1 -1
  23. package/esm/client/0_utilities_test.d.ts.map +1 -1
  24. package/esm/client/1_client_plain.js +4 -22
  25. package/esm/client/1_composer.js +8 -21
  26. package/esm/client/2_account_manager.js +85 -97
  27. package/esm/client/2_bot_info_manager.js +26 -38
  28. package/esm/client/2_business_connection_manager.js +10 -23
  29. package/esm/client/2_client_encrypted.js +194 -211
  30. package/esm/client/2_file_manager.d.ts +4 -3
  31. package/esm/client/2_file_manager.d.ts.map +1 -1
  32. package/esm/client/2_file_manager.js +268 -224
  33. package/esm/client/2_file_manager_test.d.ts.map +1 -1
  34. package/esm/client/2_network_statistics_manager.js +8 -21
  35. package/esm/client/2_payment_manager.js +7 -20
  36. package/esm/client/2_reaction_manager.js +7 -20
  37. package/esm/client/2_translations_manager.js +97 -107
  38. package/esm/client/2_update_manager.js +764 -759
  39. package/esm/client/3_client_encrypted_pool.js +10 -26
  40. package/esm/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  41. package/esm/client/3_message_manager.d.ts +1 -1
  42. package/esm/client/3_message_manager.js +441 -448
  43. package/esm/client/3_message_manager_test.d.ts.map +1 -1
  44. package/esm/client/3_video_chat_manager.d.ts +1 -1
  45. package/esm/client/3_video_chat_manager.js +57 -68
  46. package/esm/client/4_callback_query_manager.js +18 -30
  47. package/esm/client/4_chat_list_manager.js +322 -318
  48. package/esm/client/4_chat_manager.js +118 -131
  49. package/esm/client/4_forum_manager.js +67 -73
  50. package/esm/client/4_gift_manager.js +16 -29
  51. package/esm/client/4_inline_query_manager.js +16 -28
  52. package/esm/client/4_link_preview_manager.js +6 -19
  53. package/esm/client/4_poll_manager.js +44 -57
  54. package/esm/client/4_story_manager.js +41 -53
  55. package/esm/client/5_client.d.ts +7 -0
  56. package/esm/client/5_client.d.ts.map +1 -1
  57. package/esm/client/5_client.js +1271 -1290
  58. package/esm/connection/1_connection_tcp.node.js +48 -65
  59. package/esm/connection/1_connection_web_socket.js +75 -91
  60. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  61. package/esm/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
  62. package/esm/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
  63. package/esm/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
  64. package/esm/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  65. package/esm/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
  66. package/esm/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
  68. package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
  69. package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
  70. package/esm/deps/jsr.io/@std/internal/1.0.10/format.js +70 -0
  71. package/esm/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
  73. package/esm/mod.js +2 -12
  74. package/esm/session/0_session_state.js +12 -38
  75. package/esm/session/1_session.js +49 -72
  76. package/esm/session/2_session_encrypted.js +324 -320
  77. package/esm/storage/1_utilities_test.d.ts.map +1 -1
  78. package/esm/storage/2_storage_indexed_db.js +26 -44
  79. package/esm/storage/2_storage_local_storage.node.js +12 -25
  80. package/esm/storage/2_storage_memory.js +24 -41
  81. package/esm/storage/2_storage_session_storage.js +3 -16
  82. package/esm/tl/0_utilities_test.d.ts.map +1 -1
  83. package/esm/tl/1_tl_reader.js +80 -88
  84. package/esm/tl/1_tl_reader_test.d.ts.map +1 -1
  85. package/esm/tl/1_tl_writer.js +155 -164
  86. package/esm/tl/1_tl_writer_test.d.ts.map +1 -1
  87. package/esm/tl/2_telegram.d.ts +9 -10
  88. package/esm/tl/2_telegram.d.ts.map +1 -1
  89. package/esm/tl/2_telegram.js +10 -10
  90. package/esm/transport/0_transport.js +1 -8
  91. package/esm/transport/1_transport_abridged.js +11 -24
  92. package/esm/transport/1_transport_intermediate.js +10 -23
  93. package/{script/transport/2_transport_provider.d.ts → esm/transport/1_transport_provider.d.ts} +1 -1
  94. package/esm/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
  95. package/{script/transport/3_transport_provider_tcp.d.ts → esm/transport/2_transport_provider_tcp.d.ts} +2 -2
  96. package/esm/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
  97. package/esm/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +1 -1
  98. package/esm/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
  99. package/esm/transport/2_transport_provider_web_socket.d.ts.map +1 -0
  100. package/esm/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +1 -1
  101. package/esm/types/0_upload_progress.d.ts +29 -0
  102. package/esm/types/0_upload_progress.d.ts.map +1 -0
  103. package/esm/types/0_upload_progress.js +20 -0
  104. package/esm/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
  105. package/esm/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
  106. package/esm/types/1_sticker.d.ts +1 -1
  107. package/esm/types/1_sticker.d.ts.map +1 -1
  108. package/esm/types/2_chat.d.ts.map +1 -1
  109. package/esm/types/2_poll_answer.d.ts +19 -0
  110. package/esm/types/2_poll_answer.d.ts.map +1 -1
  111. package/esm/types/2_poll_answer.js +19 -0
  112. package/esm/types/2_pre_checkout_query.d.ts.map +1 -1
  113. package/esm/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
  114. package/esm/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
  115. package/esm/types/{3_reply_markup.js → 2_reply_markup.js} +1 -1
  116. package/esm/types/2_story_interactive_area.d.ts.map +1 -1
  117. package/esm/types/3_chat_member_updated.d.ts.map +1 -1
  118. package/esm/types/3_story.d.ts.map +1 -1
  119. package/esm/types/5_message.d.ts +1 -1
  120. package/esm/types/5_message.d.ts.map +1 -1
  121. package/esm/types/5_message.js +1 -1
  122. package/esm/types/6_inline_query_result.d.ts +1 -1
  123. package/esm/types/6_inline_query_result.js +1 -1
  124. package/esm/types/7_update.d.ts +21 -2
  125. package/esm/types/7_update.d.ts.map +1 -1
  126. package/esm/utilities/0_bigint_test.d.ts.map +1 -1
  127. package/esm/utilities/0_buffer.d.ts +1 -1
  128. package/esm/utilities/0_buffer.d.ts.map +1 -1
  129. package/esm/utilities/0_buffer_test.d.ts.map +1 -1
  130. package/esm/utilities/0_hash.d.ts +2 -2
  131. package/esm/utilities/0_hash.d.ts.map +1 -1
  132. package/esm/utilities/0_mutex.js +4 -19
  133. package/esm/utilities/0_part_stream.js +11 -25
  134. package/esm/utilities/0_part_stream_test.d.ts.map +1 -1
  135. package/esm/utilities/0_rle.d.ts +2 -2
  136. package/esm/utilities/0_rle.d.ts.map +1 -1
  137. package/esm/utilities/0_rle_test.d.ts.map +1 -1
  138. package/esm/utilities/0_text.d.ts +20 -1
  139. package/esm/utilities/0_text.d.ts.map +1 -1
  140. package/esm/utilities/0_text.js +19 -0
  141. package/esm/utilities/1_auth.d.ts +1 -1
  142. package/esm/utilities/1_auth.d.ts.map +1 -1
  143. package/esm/utilities/1_base64.d.ts +1 -1
  144. package/esm/utilities/1_base64.d.ts.map +1 -1
  145. package/esm/utilities/1_base64_test.d.ts.map +1 -1
  146. package/esm/utilities/1_crypto.js +42 -53
  147. package/esm/utilities/1_crypto_test.d.ts.map +1 -1
  148. package/esm/utilities/1_logger.d.ts +2 -2
  149. package/esm/utilities/1_math_test.d.ts.map +1 -1
  150. package/esm/utilities/2_queue.js +29 -47
  151. package/package.json +1 -1
  152. package/script/0_errors.js +2 -6
  153. package/script/2_tl.js +17 -7
  154. package/script/3_errors.js +2 -12
  155. package/script/3_transport.d.ts +3 -3
  156. package/script/3_transport.js +3 -3
  157. package/script/3_types.d.ts +8 -7
  158. package/script/3_types.d.ts.map +1 -1
  159. package/script/3_types.js +8 -7
  160. package/script/4_constants.js +17 -7
  161. package/script/4_errors.js +2 -12
  162. package/script/_dnt.polyfills.d.ts +99 -0
  163. package/script/_dnt.polyfills.d.ts.map +1 -1
  164. package/script/_dnt.polyfills.js +128 -0
  165. package/script/_dnt.test_polyfills.d.ts.map +1 -0
  166. package/script/client/0_filters_test.d.ts.map +1 -1
  167. package/script/client/0_markdown_test.d.ts.map +1 -1
  168. package/script/client/0_params.d.ts +2 -0
  169. package/script/client/0_params.d.ts.map +1 -1
  170. package/script/client/0_password.d.ts +5 -5
  171. package/script/client/0_password.d.ts.map +1 -1
  172. package/script/client/0_password.js +17 -7
  173. package/script/client/0_password_test.d.ts.map +1 -1
  174. package/script/client/0_storage_operations.js +143 -155
  175. package/script/client/0_storage_operations_test.d.ts.map +1 -1
  176. package/script/client/0_utilities.d.ts +1 -1
  177. package/script/client/0_utilities_test.d.ts.map +1 -1
  178. package/script/client/1_client_plain.js +4 -22
  179. package/script/client/1_composer.js +8 -21
  180. package/script/client/2_account_manager.js +85 -97
  181. package/script/client/2_bot_info_manager.js +26 -38
  182. package/script/client/2_business_connection_manager.js +10 -23
  183. package/script/client/2_client_encrypted.js +195 -212
  184. package/script/client/2_file_manager.d.ts +4 -3
  185. package/script/client/2_file_manager.d.ts.map +1 -1
  186. package/script/client/2_file_manager.js +285 -231
  187. package/script/client/2_file_manager_test.d.ts.map +1 -1
  188. package/script/client/2_network_statistics_manager.js +8 -21
  189. package/script/client/2_payment_manager.js +7 -20
  190. package/script/client/2_reaction_manager.js +7 -20
  191. package/script/client/2_translations_manager.js +98 -108
  192. package/script/client/2_update_manager.js +764 -759
  193. package/script/client/3_client_encrypted_pool.js +10 -26
  194. package/script/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  195. package/script/client/3_message_manager.d.ts +1 -1
  196. package/script/client/3_message_manager.js +441 -448
  197. package/script/client/3_message_manager_test.d.ts.map +1 -1
  198. package/script/client/3_video_chat_manager.d.ts +1 -1
  199. package/script/client/3_video_chat_manager.js +57 -68
  200. package/script/client/4_callback_query_manager.js +18 -30
  201. package/script/client/4_chat_list_manager.js +322 -318
  202. package/script/client/4_chat_manager.js +118 -131
  203. package/script/client/4_forum_manager.js +67 -73
  204. package/script/client/4_gift_manager.js +16 -29
  205. package/script/client/4_inline_query_manager.js +16 -28
  206. package/script/client/4_link_preview_manager.js +6 -19
  207. package/script/client/4_poll_manager.js +44 -57
  208. package/script/client/4_story_manager.js +41 -53
  209. package/script/client/5_client.d.ts +7 -0
  210. package/script/client/5_client.d.ts.map +1 -1
  211. package/script/client/5_client.js +1271 -1290
  212. package/script/connection/1_connection_tcp.node.js +48 -65
  213. package/script/connection/1_connection_web_socket.js +92 -98
  214. package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  215. package/script/deps/jsr.io/@std/assert/1.0.13/equal.js +17 -7
  216. package/script/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
  217. package/script/deps/jsr.io/@std/async/1.0.13/delay.js +17 -7
  218. package/script/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
  219. package/script/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
  220. package/script/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  221. package/script/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
  222. package/script/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
  223. package/script/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
  224. package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
  225. package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
  226. package/script/deps/jsr.io/@std/internal/1.0.10/format.js +106 -0
  227. package/script/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
  228. package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +17 -7
  229. package/script/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
  230. package/script/deps/jsr.io/@std/path/1.1.0/_os.js +17 -7
  231. package/script/mod.js +19 -19
  232. package/script/session/0_session_state.js +12 -38
  233. package/script/session/1_session.js +66 -79
  234. package/script/session/2_session_encrypted.js +325 -321
  235. package/script/storage/1_utilities_test.d.ts.map +1 -1
  236. package/script/storage/2_storage_indexed_db.js +26 -44
  237. package/script/storage/2_storage_local_storage.node.js +12 -25
  238. package/script/storage/2_storage_memory.js +24 -41
  239. package/script/storage/2_storage_session_storage.js +3 -16
  240. package/script/tl/0_utilities_test.d.ts.map +1 -1
  241. package/script/tl/1_tl_reader.js +81 -89
  242. package/script/tl/1_tl_reader_test.d.ts.map +1 -1
  243. package/script/tl/1_tl_writer.js +156 -165
  244. package/script/tl/1_tl_writer_test.d.ts.map +1 -1
  245. package/script/tl/2_telegram.d.ts +9 -10
  246. package/script/tl/2_telegram.d.ts.map +1 -1
  247. package/script/tl/2_telegram.js +32 -10
  248. package/script/transport/0_obfuscation.js +17 -7
  249. package/script/transport/0_transport.js +1 -8
  250. package/script/transport/1_transport_abridged.js +11 -24
  251. package/script/transport/1_transport_intermediate.js +10 -23
  252. package/{esm/transport/2_transport_provider.d.ts → script/transport/1_transport_provider.d.ts} +1 -1
  253. package/script/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
  254. package/{esm/transport/3_transport_provider_tcp.d.ts → script/transport/2_transport_provider_tcp.d.ts} +2 -2
  255. package/script/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
  256. package/script/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +3 -3
  257. package/script/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
  258. package/script/transport/2_transport_provider_web_socket.d.ts.map +1 -0
  259. package/script/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +2 -2
  260. package/script/types/0_upload_progress.d.ts +29 -0
  261. package/script/types/0_upload_progress.d.ts.map +1 -0
  262. package/script/types/0_upload_progress.js +21 -0
  263. package/script/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
  264. package/script/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
  265. package/script/types/1_sticker.d.ts +1 -1
  266. package/script/types/1_sticker.d.ts.map +1 -1
  267. package/script/types/2_chat.d.ts.map +1 -1
  268. package/script/types/2_poll_answer.d.ts +19 -0
  269. package/script/types/2_poll_answer.d.ts.map +1 -1
  270. package/script/types/2_poll_answer.js +19 -0
  271. package/script/types/2_pre_checkout_query.d.ts.map +1 -1
  272. package/script/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
  273. package/script/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
  274. package/script/types/{3_reply_markup.js → 2_reply_markup.js} +3 -3
  275. package/script/types/2_story_interactive_area.d.ts.map +1 -1
  276. package/script/types/3_chat_member_updated.d.ts.map +1 -1
  277. package/script/types/3_story.d.ts.map +1 -1
  278. package/script/types/5_message.d.ts +1 -1
  279. package/script/types/5_message.d.ts.map +1 -1
  280. package/script/types/5_message.js +2 -2
  281. package/script/types/6_inline_query_result.d.ts +1 -1
  282. package/script/types/6_inline_query_result.js +4 -4
  283. package/script/types/7_update.d.ts +21 -2
  284. package/script/types/7_update.d.ts.map +1 -1
  285. package/script/utilities/0_bigint.js +17 -7
  286. package/script/utilities/0_bigint_test.d.ts.map +1 -1
  287. package/script/utilities/0_buffer.d.ts +1 -1
  288. package/script/utilities/0_buffer.d.ts.map +1 -1
  289. package/script/utilities/0_buffer_test.d.ts.map +1 -1
  290. package/script/utilities/0_env.js +17 -7
  291. package/script/utilities/0_hash.d.ts +2 -2
  292. package/script/utilities/0_hash.d.ts.map +1 -1
  293. package/script/utilities/0_hash.js +17 -7
  294. package/script/utilities/0_misc.js +17 -7
  295. package/script/utilities/0_mutex.js +4 -19
  296. package/script/utilities/0_part_stream.js +11 -25
  297. package/script/utilities/0_part_stream_test.d.ts.map +1 -1
  298. package/script/utilities/0_rle.d.ts +2 -2
  299. package/script/utilities/0_rle.d.ts.map +1 -1
  300. package/script/utilities/0_rle_test.d.ts.map +1 -1
  301. package/script/utilities/0_text.d.ts +20 -1
  302. package/script/utilities/0_text.d.ts.map +1 -1
  303. package/script/utilities/0_text.js +19 -0
  304. package/script/utilities/1_auth.d.ts +1 -1
  305. package/script/utilities/1_auth.d.ts.map +1 -1
  306. package/script/utilities/1_auth.js +17 -7
  307. package/script/utilities/1_base64.d.ts +1 -1
  308. package/script/utilities/1_base64.d.ts.map +1 -1
  309. package/script/utilities/1_base64_test.d.ts.map +1 -1
  310. package/script/utilities/1_crypto.js +60 -61
  311. package/script/utilities/1_crypto_test.d.ts.map +1 -1
  312. package/script/utilities/1_logger.d.ts +2 -2
  313. package/script/utilities/1_math_test.d.ts.map +1 -1
  314. package/script/utilities/2_queue.js +30 -48
  315. package/esm/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
  316. package/esm/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
  317. package/esm/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
  318. package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
  319. package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
  320. package/esm/deps/jsr.io/@std/internal/1.0.9/format.js +0 -37
  321. package/esm/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
  322. package/esm/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
  323. package/esm/transport/3_transport_provider_web_socket.d.ts.map +0 -1
  324. package/script/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
  325. package/script/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
  326. package/script/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
  327. package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
  328. package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
  329. package/script/deps/jsr.io/@std/internal/1.0.9/format.js +0 -63
  330. package/script/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
  331. package/script/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
  332. package/script/transport/3_transport_provider_web_socket.d.ts.map +0 -1
  333. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
  334. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
  335. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
  336. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
  337. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
  338. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
  339. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
  340. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +0 -0
  341. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
  342. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
  343. /package/esm/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
  344. /package/esm/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
  345. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
  346. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
  347. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
  348. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
  349. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
  350. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
  351. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
  352. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
  353. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
  354. /package/script/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
  355. /package/script/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
@@ -17,97 +17,90 @@
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 _ConnectionTCP_instances, _ConnectionTCP_hostname, _ConnectionTCP_port, _ConnectionTCP_socket, _ConnectionTCP_rMutex, _ConnectionTCP_wMutex, _ConnectionTCP_buffer, _ConnectionTCP_nextResolve, _ConnectionTCP_rejectRead, _ConnectionTCP_assertConnected;
32
20
  import { Socket } from "node:net";
33
21
  import { ConnectionError } from "../0_errors.js";
34
22
  import { getLogger, Mutex } from "../1_utilities.js";
35
23
  const L = getLogger("ConnectionTCP");
36
24
  const errConnectionNotOpen = new ConnectionError("Connection not open");
37
25
  export class ConnectionTCP {
26
+ #hostname;
27
+ #port;
28
+ #socket;
29
+ #rMutex = new Mutex();
30
+ #wMutex = new Mutex();
31
+ #buffer = new Array();
32
+ #nextResolve = null;
33
+ stateChangeHandler;
38
34
  constructor(hostname, port) {
39
- _ConnectionTCP_instances.add(this);
40
- _ConnectionTCP_hostname.set(this, void 0);
41
- _ConnectionTCP_port.set(this, void 0);
42
- _ConnectionTCP_socket.set(this, void 0);
43
- _ConnectionTCP_rMutex.set(this, new Mutex());
44
- _ConnectionTCP_wMutex.set(this, new Mutex());
45
- _ConnectionTCP_buffer.set(this, new Array());
46
- _ConnectionTCP_nextResolve.set(this, null);
47
- Object.defineProperty(this, "stateChangeHandler", {
48
- enumerable: true,
49
- configurable: true,
50
- writable: true,
51
- value: void 0
52
- });
53
- __classPrivateFieldSet(this, _ConnectionTCP_hostname, hostname, "f");
54
- __classPrivateFieldSet(this, _ConnectionTCP_port, port, "f");
35
+ this.#hostname = hostname;
36
+ this.#port = port;
37
+ }
38
+ #rejectRead() {
39
+ if (this.#nextResolve != null) {
40
+ this.#nextResolve[1].reject(errConnectionNotOpen);
41
+ this.#nextResolve = null;
42
+ }
55
43
  }
56
44
  open() {
57
- __classPrivateFieldSet(this, _ConnectionTCP_socket, new Socket(), "f");
58
- __classPrivateFieldGet(this, _ConnectionTCP_socket, "f").on("close", () => {
59
- __classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_rejectRead).call(this);
45
+ this.#socket = new Socket();
46
+ this.#socket.on("close", () => {
47
+ this.#rejectRead();
60
48
  this.stateChangeHandler?.(false);
61
49
  });
62
50
  const mutex = new Mutex();
63
- __classPrivateFieldGet(this, _ConnectionTCP_socket, "f").on("data", async (data) => {
51
+ this.#socket.on("data", async (data) => {
64
52
  const unlock = await mutex.lock();
65
53
  for (const byte of data) {
66
- __classPrivateFieldGet(this, _ConnectionTCP_buffer, "f").push(byte);
54
+ this.#buffer.push(byte);
67
55
  }
68
- if (__classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f") != null && __classPrivateFieldGet(this, _ConnectionTCP_buffer, "f").length >= __classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f")[0]) {
69
- const resolve = __classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f")[1].resolve;
70
- __classPrivateFieldSet(this, _ConnectionTCP_nextResolve, null, "f");
56
+ if (this.#nextResolve != null && this.#buffer.length >= this.#nextResolve[0]) {
57
+ const resolve = this.#nextResolve[1].resolve;
58
+ this.#nextResolve = null;
71
59
  resolve();
72
60
  }
73
61
  unlock();
74
62
  });
75
63
  return new Promise((resolve, reject) => {
76
- __classPrivateFieldGet(this, _ConnectionTCP_socket, "f").connect(__classPrivateFieldGet(this, _ConnectionTCP_port, "f"), __classPrivateFieldGet(this, _ConnectionTCP_hostname, "f"));
77
- __classPrivateFieldGet(this, _ConnectionTCP_socket, "f").once("error", reject);
78
- __classPrivateFieldGet(this, _ConnectionTCP_socket, "f").once("connect", () => {
79
- __classPrivateFieldGet(this, _ConnectionTCP_socket, "f").off("error", reject);
64
+ this.#socket.connect(this.#port, this.#hostname);
65
+ this.#socket.once("error", reject);
66
+ this.#socket.once("connect", () => {
67
+ this.#socket.off("error", reject);
80
68
  resolve();
81
69
  this.stateChangeHandler?.(true);
82
- L.debug("connected to", __classPrivateFieldGet(this, _ConnectionTCP_hostname, "f"), "port", __classPrivateFieldGet(this, _ConnectionTCP_port, "f"));
70
+ L.debug("connected to", this.#hostname, "port", this.#port);
83
71
  });
84
72
  });
85
73
  }
86
74
  get connected() {
87
- return __classPrivateFieldGet(this, _ConnectionTCP_socket, "f")?.readyState == "open";
75
+ return this.#socket?.readyState == "open";
76
+ }
77
+ #assertConnected() {
78
+ if (!this.connected) {
79
+ throw errConnectionNotOpen;
80
+ }
88
81
  }
89
82
  async read(p) {
90
- __classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_assertConnected).call(this);
91
- const unlock = await __classPrivateFieldGet(this, _ConnectionTCP_rMutex, "f").lock();
83
+ this.#assertConnected();
84
+ const unlock = await this.#rMutex.lock();
92
85
  try {
93
- __classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_assertConnected).call(this);
94
- if (__classPrivateFieldGet(this, _ConnectionTCP_buffer, "f").length < p.length) {
95
- await new Promise((resolve, reject) => __classPrivateFieldSet(this, _ConnectionTCP_nextResolve, [p.length, { resolve, reject }], "f"));
86
+ this.#assertConnected();
87
+ if (this.#buffer.length < p.length) {
88
+ await new Promise((resolve, reject) => this.#nextResolve = [p.length, { resolve, reject }]);
96
89
  }
97
- p.set(__classPrivateFieldGet(this, _ConnectionTCP_buffer, "f").splice(0, p.length));
90
+ p.set(this.#buffer.splice(0, p.length));
98
91
  }
99
92
  finally {
100
93
  unlock();
101
94
  }
102
95
  }
103
96
  async write(p) {
104
- __classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_assertConnected).call(this);
105
- const unlock = await __classPrivateFieldGet(this, _ConnectionTCP_wMutex, "f").lock();
97
+ this.#assertConnected();
98
+ const unlock = await this.#wMutex.lock();
106
99
  try {
107
- __classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_assertConnected).call(this);
100
+ this.#assertConnected();
108
101
  try {
109
102
  await new Promise((resolve, reject) => {
110
- __classPrivateFieldGet(this, _ConnectionTCP_socket, "f").write(p, (err) => {
103
+ this.#socket.write(p, (err) => {
111
104
  (err === undefined || err == null) ? resolve() : reject(err);
112
105
  });
113
106
  });
@@ -126,18 +119,8 @@ export class ConnectionTCP {
126
119
  }
127
120
  }
128
121
  close() {
129
- __classPrivateFieldGet(this, _ConnectionTCP_instances, "m", _ConnectionTCP_assertConnected).call(this);
130
- __classPrivateFieldGet(this, _ConnectionTCP_socket, "f").destroy();
131
- __classPrivateFieldSet(this, _ConnectionTCP_socket, undefined, "f");
122
+ this.#assertConnected();
123
+ this.#socket.destroy();
124
+ this.#socket = undefined;
132
125
  }
133
126
  }
134
- _ConnectionTCP_hostname = new WeakMap(), _ConnectionTCP_port = new WeakMap(), _ConnectionTCP_socket = new WeakMap(), _ConnectionTCP_rMutex = new WeakMap(), _ConnectionTCP_wMutex = new WeakMap(), _ConnectionTCP_buffer = new WeakMap(), _ConnectionTCP_nextResolve = new WeakMap(), _ConnectionTCP_instances = new WeakSet(), _ConnectionTCP_rejectRead = function _ConnectionTCP_rejectRead() {
135
- if (__classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f") != null) {
136
- __classPrivateFieldGet(this, _ConnectionTCP_nextResolve, "f")[1].reject(errConnectionNotOpen);
137
- __classPrivateFieldSet(this, _ConnectionTCP_nextResolve, null, "f");
138
- }
139
- }, _ConnectionTCP_assertConnected = function _ConnectionTCP_assertConnected() {
140
- if (!this.connected) {
141
- throw errConnectionNotOpen;
142
- }
143
- };
@@ -1,15 +1,3 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- 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");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- 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");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _ConnectionWebSocket_instances, _ConnectionWebSocket_url, _ConnectionWebSocket_webSocket, _ConnectionWebSocket_rMutex, _ConnectionWebSocket_wMutex, _ConnectionWebSocket_buffer, _ConnectionWebSocket_nextResolve, _ConnectionWebSocket_initWs, _ConnectionWebSocket_isConnecting, _ConnectionWebSocket_assertConnected, _ConnectionWebSocket_rejectRead;
13
1
  /**
14
2
  * MTKruto - Cross-runtime JavaScript library for building Telegram clients
15
3
  * Copyright (C) 2023-2025 Roj <https://roj.im/>
@@ -36,117 +24,113 @@ import { getLogger, Mutex } from "../1_utilities.js";
36
24
  const L = getLogger("ConnectionWebSocket");
37
25
  const errConnectionNotOpen = new ConnectionError("Connection not open");
38
26
  export class ConnectionWebSocket {
27
+ #url;
28
+ #webSocket;
29
+ #rMutex = new Mutex();
30
+ #wMutex = new Mutex();
31
+ #buffer = new Uint8Array();
32
+ #nextResolve = null;
33
+ stateChangeHandler;
39
34
  constructor(url) {
40
- _ConnectionWebSocket_instances.add(this);
41
- _ConnectionWebSocket_url.set(this, void 0);
42
- _ConnectionWebSocket_webSocket.set(this, void 0);
43
- _ConnectionWebSocket_rMutex.set(this, new Mutex());
44
- _ConnectionWebSocket_wMutex.set(this, new Mutex());
45
- _ConnectionWebSocket_buffer.set(this, new Uint8Array());
46
- _ConnectionWebSocket_nextResolve.set(this, null);
47
- Object.defineProperty(this, "stateChangeHandler", {
48
- enumerable: true,
49
- configurable: true,
50
- writable: true,
51
- value: void 0
35
+ this.#url = url;
36
+ }
37
+ #initWs() {
38
+ return new Promise((resolve, reject) => {
39
+ const webSocket = new dntShim.WebSocket(this.#url, "binary");
40
+ const mutex = new Mutex();
41
+ webSocket.addEventListener("close", () => {
42
+ this.#rejectRead();
43
+ this.stateChangeHandler?.(false);
44
+ });
45
+ webSocket.addEventListener("open", () => {
46
+ this.stateChangeHandler?.(true);
47
+ resolve(webSocket);
48
+ L.debug("connected to", this.#url);
49
+ });
50
+ webSocket.addEventListener("message", async (e) => {
51
+ if (typeof e.data === "string") {
52
+ return;
53
+ }
54
+ const unlock = await mutex.lock();
55
+ const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : unreachable())).arrayBuffer());
56
+ this.#buffer = concat([this.#buffer, data]);
57
+ if (this.#nextResolve != null && this.#buffer.length >= this.#nextResolve[0]) {
58
+ this.#nextResolve[1].resolve();
59
+ this.#nextResolve = null;
60
+ }
61
+ unlock();
62
+ });
63
+ webSocket.addEventListener("error", (err) => {
64
+ if (this.#isConnecting) {
65
+ reject("message" in err ? new ConnectionError(err.message) : new ConnectionError("Connection failed"));
66
+ }
67
+ if (this.connected) {
68
+ L.error(err);
69
+ }
70
+ });
52
71
  });
53
- _ConnectionWebSocket_isConnecting.set(this, false);
54
- __classPrivateFieldSet(this, _ConnectionWebSocket_url, url, "f");
55
72
  }
56
73
  get connected() {
57
- return !!__classPrivateFieldGet(this, _ConnectionWebSocket_webSocket, "f") && __classPrivateFieldGet(this, _ConnectionWebSocket_webSocket, "f").readyState == dntShim.WebSocket.OPEN;
74
+ return !!this.#webSocket && this.#webSocket.readyState == dntShim.WebSocket.OPEN;
58
75
  }
76
+ #isConnecting = false;
59
77
  async open() {
60
- if (__classPrivateFieldGet(this, _ConnectionWebSocket_isConnecting, "f")) {
78
+ if (this.#isConnecting) {
61
79
  throw new ConnectionError("Already connecting");
62
80
  }
63
- __classPrivateFieldSet(this, _ConnectionWebSocket_isConnecting, true, "f");
81
+ this.#isConnecting = true;
64
82
  if (this.connected) {
65
83
  throw new ConnectionError("Already connected");
66
84
  }
67
85
  try {
68
- __classPrivateFieldSet(this, _ConnectionWebSocket_webSocket, await __classPrivateFieldGet(this, _ConnectionWebSocket_instances, "m", _ConnectionWebSocket_initWs).call(this), "f");
86
+ this.#webSocket = await this.#initWs();
69
87
  }
70
88
  finally {
71
- __classPrivateFieldSet(this, _ConnectionWebSocket_isConnecting, false, "f");
89
+ this.#isConnecting = false;
90
+ }
91
+ }
92
+ #assertConnected() {
93
+ if (!this.connected) {
94
+ throw errConnectionNotOpen;
72
95
  }
73
96
  }
74
97
  async read(p) {
75
- __classPrivateFieldGet(this, _ConnectionWebSocket_instances, "m", _ConnectionWebSocket_assertConnected).call(this);
76
- const unlock = await __classPrivateFieldGet(this, _ConnectionWebSocket_rMutex, "f").lock();
98
+ this.#assertConnected();
99
+ const unlock = await this.#rMutex.lock();
77
100
  try {
78
- __classPrivateFieldGet(this, _ConnectionWebSocket_instances, "m", _ConnectionWebSocket_assertConnected).call(this);
79
- if (__classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").length < p.length) {
80
- await new Promise((resolve, reject) => __classPrivateFieldSet(this, _ConnectionWebSocket_nextResolve, [p.length, { resolve, reject }], "f"));
101
+ this.#assertConnected();
102
+ if (this.#buffer.length < p.length) {
103
+ await new Promise((resolve, reject) => this.#nextResolve = [p.length, { resolve, reject }]);
81
104
  }
82
- const slice = __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").slice(0, p.length);
105
+ const slice = this.#buffer.slice(0, p.length);
83
106
  p.set(slice);
84
- __classPrivateFieldSet(this, _ConnectionWebSocket_buffer, __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").slice(slice.length), "f");
107
+ this.#buffer = this.#buffer.slice(slice.length);
85
108
  }
86
109
  finally {
87
110
  unlock();
88
111
  }
89
112
  }
90
113
  async write(p) {
91
- __classPrivateFieldGet(this, _ConnectionWebSocket_instances, "m", _ConnectionWebSocket_assertConnected).call(this);
92
- const unlock = await __classPrivateFieldGet(this, _ConnectionWebSocket_wMutex, "f").lock();
114
+ this.#assertConnected();
115
+ const unlock = await this.#wMutex.lock();
93
116
  try {
94
- __classPrivateFieldGet(this, _ConnectionWebSocket_instances, "m", _ConnectionWebSocket_assertConnected).call(this);
95
- __classPrivateFieldGet(this, _ConnectionWebSocket_webSocket, "f").send(p);
117
+ this.#assertConnected();
118
+ this.#webSocket.send(p);
96
119
  }
97
120
  finally {
98
121
  unlock();
99
122
  }
100
123
  }
124
+ #rejectRead() {
125
+ if (this.#nextResolve != null) {
126
+ this.#nextResolve[1].reject(errConnectionNotOpen);
127
+ this.#nextResolve = null;
128
+ }
129
+ }
101
130
  close() {
102
- __classPrivateFieldGet(this, _ConnectionWebSocket_instances, "m", _ConnectionWebSocket_assertConnected).call(this);
103
- __classPrivateFieldGet(this, _ConnectionWebSocket_webSocket, "f").close(1000, "method");
104
- __classPrivateFieldSet(this, _ConnectionWebSocket_webSocket, undefined, "f");
105
- __classPrivateFieldGet(this, _ConnectionWebSocket_instances, "m", _ConnectionWebSocket_rejectRead).call(this);
131
+ this.#assertConnected();
132
+ this.#webSocket.close(1000, "method");
133
+ this.#webSocket = undefined;
134
+ this.#rejectRead();
106
135
  }
107
136
  }
108
- _ConnectionWebSocket_url = new WeakMap(), _ConnectionWebSocket_webSocket = new WeakMap(), _ConnectionWebSocket_rMutex = new WeakMap(), _ConnectionWebSocket_wMutex = new WeakMap(), _ConnectionWebSocket_buffer = new WeakMap(), _ConnectionWebSocket_nextResolve = new WeakMap(), _ConnectionWebSocket_isConnecting = new WeakMap(), _ConnectionWebSocket_instances = new WeakSet(), _ConnectionWebSocket_initWs = function _ConnectionWebSocket_initWs() {
109
- return new Promise((resolve, reject) => {
110
- const webSocket = new dntShim.WebSocket(__classPrivateFieldGet(this, _ConnectionWebSocket_url, "f"), "binary");
111
- const mutex = new Mutex();
112
- webSocket.addEventListener("close", () => {
113
- __classPrivateFieldGet(this, _ConnectionWebSocket_instances, "m", _ConnectionWebSocket_rejectRead).call(this);
114
- this.stateChangeHandler?.(false);
115
- });
116
- webSocket.addEventListener("open", () => {
117
- this.stateChangeHandler?.(true);
118
- resolve(webSocket);
119
- L.debug("connected to", __classPrivateFieldGet(this, _ConnectionWebSocket_url, "f"));
120
- });
121
- webSocket.addEventListener("message", async (e) => {
122
- if (typeof e.data === "string") {
123
- return;
124
- }
125
- const unlock = await mutex.lock();
126
- const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : unreachable())).arrayBuffer());
127
- __classPrivateFieldSet(this, _ConnectionWebSocket_buffer, concat([__classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f"), data]), "f");
128
- if (__classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f") != null && __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").length >= __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[0]) {
129
- __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[1].resolve();
130
- __classPrivateFieldSet(this, _ConnectionWebSocket_nextResolve, null, "f");
131
- }
132
- unlock();
133
- });
134
- webSocket.addEventListener("error", (err) => {
135
- if (__classPrivateFieldGet(this, _ConnectionWebSocket_isConnecting, "f")) {
136
- reject("message" in err ? new ConnectionError(err.message) : new ConnectionError("Connection failed"));
137
- }
138
- if (this.connected) {
139
- L.error(err);
140
- }
141
- });
142
- });
143
- }, _ConnectionWebSocket_assertConnected = function _ConnectionWebSocket_assertConnected() {
144
- if (!this.connected) {
145
- throw errConnectionNotOpen;
146
- }
147
- }, _ConnectionWebSocket_rejectRead = function _ConnectionWebSocket_rejectRead() {
148
- if (__classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f") != null) {
149
- __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[1].reject(errConnectionNotOpen);
150
- __classPrivateFieldSet(this, _ConnectionWebSocket_nextResolve, null, "f");
151
- }
152
- };
@@ -1,5 +1,5 @@
1
1
  var Module = (() => {
2
- var _scriptName = import.meta.url;
2
+ var _scriptName = globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).url;
3
3
  return (function (moduleArg = {}) {
4
4
  var moduleRtn;
5
5
  var Module = moduleArg;
@@ -117,16 +117,8 @@ var Module = (() => {
117
117
  }
118
118
  } wasmBinaryFile ??= findWasmBinary(); instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult).catch(readyPromiseReject); return {}; }
119
119
  class ExitStatus {
120
- constructor(status) {
121
- Object.defineProperty(this, "name", {
122
- enumerable: true,
123
- configurable: true,
124
- writable: true,
125
- value: "ExitStatus"
126
- });
127
- this.message = `Program terminated with exit(${status})`;
128
- this.status = status;
129
- }
120
+ name = "ExitStatus";
121
+ constructor(status) { this.message = `Program terminated with exit(${status})`; this.status = status; }
130
122
  }
131
123
  var callRuntimeCallbacks = callbacks => { while (callbacks.length > 0) {
132
124
  callbacks.shift()(Module);
@@ -1,10 +1,10 @@
1
1
  // Copyright 2018-2025 the Deno authors. MIT license.
2
2
  // This module is browser compatible.
3
3
  import { equal } from "./equal.js";
4
- import { buildMessage } from "../../internal/1.0.9/build_message.js";
5
- import { diff } from "../../internal/1.0.9/diff.js";
6
- import { diffStr } from "../../internal/1.0.9/diff_str.js";
7
- import { format } from "../../internal/1.0.9/format.js";
4
+ import { buildMessage } from "../../internal/1.0.10/build_message.js";
5
+ import { diff } from "../../internal/1.0.10/diff.js";
6
+ import { diffStr } from "../../internal/1.0.10/diff_str.js";
7
+ import { format } from "../../internal/1.0.10/format.js";
8
8
  import { AssertionError } from "./assertion_error.js";
9
9
  /**
10
10
  * Make an assertion that `actual` and `expected` are equal, deeply. If not
@@ -1,17 +1,5 @@
1
1
  // Copyright 2018-2025 the Deno authors. MIT license.
2
2
  // This module is browser compatible.
3
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5
- 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");
6
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7
- };
8
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9
- if (kind === "m") throw new TypeError("Private method is not writable");
10
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
11
- 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");
12
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
13
- };
14
- var _MuxAsyncIterator_instances, _MuxAsyncIterator_iteratorCount, _MuxAsyncIterator_yields, _MuxAsyncIterator_throws, _MuxAsyncIterator_signal, _MuxAsyncIterator_callIteratorNext;
15
3
  /**
16
4
  * Multiplexes multiple async iterators into a single stream. It currently
17
5
  * makes an assumption that the final result (the value returned and not
@@ -47,14 +35,11 @@ var _MuxAsyncIterator_instances, _MuxAsyncIterator_iteratorCount, _MuxAsyncItera
47
35
  * @typeParam T The type of the provided async iterables and generated async iterable.
48
36
  */
49
37
  export class MuxAsyncIterator {
50
- constructor() {
51
- _MuxAsyncIterator_instances.add(this);
52
- _MuxAsyncIterator_iteratorCount.set(this, 0);
53
- _MuxAsyncIterator_yields.set(this, []);
54
- // deno-lint-ignore no-explicit-any
55
- _MuxAsyncIterator_throws.set(this, []);
56
- _MuxAsyncIterator_signal.set(this, Promise.withResolvers());
57
- }
38
+ #iteratorCount = 0;
39
+ #yields = [];
40
+ // deno-lint-ignore no-explicit-any
41
+ #throws = [];
42
+ #signal = Promise.withResolvers();
58
43
  /**
59
44
  * Add an async iterable to the stream.
60
45
  *
@@ -80,9 +65,23 @@ export class MuxAsyncIterator {
80
65
  * ```
81
66
  */
82
67
  add(iterable) {
83
- var _a;
84
- __classPrivateFieldSet(this, _MuxAsyncIterator_iteratorCount, (_a = __classPrivateFieldGet(this, _MuxAsyncIterator_iteratorCount, "f"), ++_a), "f");
85
- __classPrivateFieldGet(this, _MuxAsyncIterator_instances, "m", _MuxAsyncIterator_callIteratorNext).call(this, iterable[Symbol.asyncIterator]());
68
+ ++this.#iteratorCount;
69
+ this.#callIteratorNext(iterable[Symbol.asyncIterator]());
70
+ }
71
+ async #callIteratorNext(iterator) {
72
+ try {
73
+ const { value, done } = await iterator.next();
74
+ if (done) {
75
+ --this.#iteratorCount;
76
+ }
77
+ else {
78
+ this.#yields.push({ iterator, value });
79
+ }
80
+ }
81
+ catch (e) {
82
+ this.#throws.push(e);
83
+ }
84
+ this.#signal.resolve();
86
85
  }
87
86
  /**
88
87
  * Returns an async iterator of the stream.
@@ -108,22 +107,22 @@ export class MuxAsyncIterator {
108
107
  * ```
109
108
  */
110
109
  async *iterate() {
111
- while (__classPrivateFieldGet(this, _MuxAsyncIterator_iteratorCount, "f") > 0) {
110
+ while (this.#iteratorCount > 0) {
112
111
  // Sleep until any of the wrapped iterators yields.
113
- await __classPrivateFieldGet(this, _MuxAsyncIterator_signal, "f").promise;
112
+ await this.#signal.promise;
114
113
  // Note that while we're looping over `yields`, new items may be added.
115
- for (const { iterator, value } of __classPrivateFieldGet(this, _MuxAsyncIterator_yields, "f")) {
114
+ for (const { iterator, value } of this.#yields) {
116
115
  yield value;
117
- __classPrivateFieldGet(this, _MuxAsyncIterator_instances, "m", _MuxAsyncIterator_callIteratorNext).call(this, iterator);
116
+ this.#callIteratorNext(iterator);
118
117
  }
119
- if (__classPrivateFieldGet(this, _MuxAsyncIterator_throws, "f").length) {
120
- for (const e of __classPrivateFieldGet(this, _MuxAsyncIterator_throws, "f")) {
118
+ if (this.#throws.length) {
119
+ for (const e of this.#throws) {
121
120
  throw e;
122
121
  }
123
122
  }
124
123
  // Clear the `yields` list and reset the `signal` promise.
125
- __classPrivateFieldGet(this, _MuxAsyncIterator_yields, "f").length = 0;
126
- __classPrivateFieldSet(this, _MuxAsyncIterator_signal, Promise.withResolvers(), "f");
124
+ this.#yields.length = 0;
125
+ this.#signal = Promise.withResolvers();
127
126
  }
128
127
  }
129
128
  /**
@@ -149,22 +148,7 @@ export class MuxAsyncIterator {
149
148
  * assertEquals(result, [1, 2, 3]);
150
149
  * ```
151
150
  */
152
- [(_MuxAsyncIterator_iteratorCount = new WeakMap(), _MuxAsyncIterator_yields = new WeakMap(), _MuxAsyncIterator_throws = new WeakMap(), _MuxAsyncIterator_signal = new WeakMap(), _MuxAsyncIterator_instances = new WeakSet(), _MuxAsyncIterator_callIteratorNext = async function _MuxAsyncIterator_callIteratorNext(iterator) {
153
- var _a;
154
- try {
155
- const { value, done } = await iterator.next();
156
- if (done) {
157
- __classPrivateFieldSet(this, _MuxAsyncIterator_iteratorCount, (_a = __classPrivateFieldGet(this, _MuxAsyncIterator_iteratorCount, "f"), --_a), "f");
158
- }
159
- else {
160
- __classPrivateFieldGet(this, _MuxAsyncIterator_yields, "f").push({ iterator, value });
161
- }
162
- }
163
- catch (e) {
164
- __classPrivateFieldGet(this, _MuxAsyncIterator_throws, "f").push(e);
165
- }
166
- __classPrivateFieldGet(this, _MuxAsyncIterator_signal, "f").resolve();
167
- }, Symbol.asyncIterator)]() {
151
+ [Symbol.asyncIterator]() {
168
152
  return this.iterate();
169
153
  }
170
154
  }
@@ -1,57 +1,34 @@
1
1
  // Copyright 2018-2025 the Deno authors. MIT license.
2
2
  // This module is browser compatible.
3
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4
- if (kind === "m") throw new TypeError("Private method is not writable");
5
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
6
- 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");
7
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
8
- };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
11
- 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");
12
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
13
- };
14
- var _Queue_source, _Queue_queue;
15
3
  class Queue {
4
+ #source;
5
+ #queue;
6
+ head;
7
+ done;
16
8
  constructor(iterable) {
17
- _Queue_source.set(this, void 0);
18
- _Queue_queue.set(this, void 0);
19
- Object.defineProperty(this, "head", {
20
- enumerable: true,
21
- configurable: true,
22
- writable: true,
23
- value: void 0
24
- });
25
- Object.defineProperty(this, "done", {
26
- enumerable: true,
27
- configurable: true,
28
- writable: true,
29
- value: void 0
30
- });
31
- __classPrivateFieldSet(this, _Queue_source, iterable[Symbol.asyncIterator](), "f");
32
- __classPrivateFieldSet(this, _Queue_queue, {
9
+ this.#source = iterable[Symbol.asyncIterator]();
10
+ this.#queue = {
33
11
  value: undefined,
34
12
  next: undefined,
35
- }, "f");
36
- this.head = __classPrivateFieldGet(this, _Queue_queue, "f");
13
+ };
14
+ this.head = this.#queue;
37
15
  this.done = false;
38
16
  }
39
17
  async next() {
40
- const result = await __classPrivateFieldGet(this, _Queue_source, "f").next();
18
+ const result = await this.#source.next();
41
19
  if (!result.done) {
42
20
  const nextNode = {
43
21
  value: result.value,
44
22
  next: undefined,
45
23
  };
46
- __classPrivateFieldGet(this, _Queue_queue, "f").next = nextNode;
47
- __classPrivateFieldSet(this, _Queue_queue, nextNode, "f");
24
+ this.#queue.next = nextNode;
25
+ this.#queue = nextNode;
48
26
  }
49
27
  else {
50
28
  this.done = true;
51
29
  }
52
30
  }
53
31
  }
54
- _Queue_source = new WeakMap(), _Queue_queue = new WeakMap();
55
32
  /**
56
33
  * Branches the given async iterable into the `n` branches.
57
34
  *