@mtkruto/node 0.1.200 → 0.1.300

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 (231) hide show
  1. package/esm/0_deps.d.ts +1 -1
  2. package/esm/0_deps.js +2 -1
  3. package/esm/1_utilities.d.ts +1 -1
  4. package/esm/1_utilities.js +1 -1
  5. package/esm/4_errors.js +3 -3
  6. package/esm/client/0_markdown.js +5 -5
  7. package/esm/client/0_utilities.d.ts +6 -0
  8. package/esm/client/0_utilities.js +35 -4
  9. package/esm/client/1_account_manager.js +4 -4
  10. package/esm/client/1_client_encrypted.js +4 -4
  11. package/esm/client/1_client_plain.js +3 -3
  12. package/esm/client/1_file_manager.js +6 -5
  13. package/esm/client/1_reaction_manager.js +2 -2
  14. package/esm/client/1_update_manager.js +9 -8
  15. package/esm/client/2_message_manager.js +47 -24
  16. package/esm/client/3_callback_query_manager.js +2 -0
  17. package/esm/client/3_chat_list_manager.js +13 -12
  18. package/esm/client/3_inline_query_manager.js +4 -2
  19. package/esm/client/3_story_manager.js +7 -5
  20. package/esm/client/4_client.d.ts +5 -8
  21. package/esm/client/4_client.js +19 -27
  22. package/esm/connection/1_connection_web_socket.js +3 -2
  23. package/{script/deps/deno.land/x/tgcrypto@0.3.3 → esm/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
  24. package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +0 -11
  25. package/esm/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +308 -0
  26. package/esm/mod.d.ts +1 -1
  27. package/esm/mod.js +1 -1
  28. package/esm/storage/0_storage.js +6 -5
  29. package/esm/storage/1_utilities.d.ts +0 -1
  30. package/esm/storage/1_utilities.js +2 -3
  31. package/esm/storage/2_storage_local_storage.js +1 -4
  32. package/esm/storage/2_storage_session_storage.js +1 -4
  33. package/esm/tl/3_utilities.js +5 -4
  34. package/esm/transport/2_transport_provider.js +4 -4
  35. package/esm/types/0_message_entity.js +3 -3
  36. package/esm/types/0_message_search_filter.js +2 -2
  37. package/esm/types/0_reaction.js +2 -2
  38. package/esm/types/1_bot_command_scope.js +3 -3
  39. package/esm/types/1_chat_p.js +3 -2
  40. package/esm/types/1_keyboard_button.js +3 -3
  41. package/esm/types/1_message_reaction.js +2 -2
  42. package/esm/types/1_story_privacy.js +3 -3
  43. package/esm/types/2_chat_member.js +6 -5
  44. package/esm/types/2_chosen_inline_result.js +3 -2
  45. package/esm/types/2_inactive_chat.js +3 -2
  46. package/esm/types/2_inline_keyboard_button.js +3 -3
  47. package/esm/types/2_inline_query.js +3 -3
  48. package/esm/types/2_invite_link.js +3 -2
  49. package/esm/types/2_story_content.js +5 -5
  50. package/esm/types/2_story_interactive_area.js +5 -5
  51. package/esm/types/3_chat_member_updated.js +4 -3
  52. package/esm/types/3_reply_markup.js +4 -3
  53. package/esm/types/3_story.js +3 -2
  54. package/esm/types/4_inline_query_result.js +5 -5
  55. package/esm/types/4_message.js +17 -16
  56. package/esm/types/5_callback_query.js +4 -3
  57. package/esm/types/5_chat.js +8 -7
  58. package/esm/types/_file_id.js +9 -8
  59. package/esm/utilities/0_bigint.d.ts +1 -0
  60. package/esm/utilities/0_bigint.js +25 -0
  61. package/esm/utilities/0_logger.d.ts +8 -0
  62. package/esm/utilities/0_logger.js +9 -5
  63. package/esm/utilities/1_math.d.ts +1 -0
  64. package/esm/utilities/1_math.js +51 -0
  65. package/esm/utilities/1_misc.js +2 -2
  66. package/package.json +1 -1
  67. package/script/0_deps.d.ts +1 -1
  68. package/script/0_deps.js +3 -3
  69. package/script/1_utilities.d.ts +1 -1
  70. package/script/1_utilities.js +1 -1
  71. package/script/4_errors.js +3 -3
  72. package/script/client/0_markdown.js +5 -5
  73. package/script/client/0_utilities.d.ts +6 -0
  74. package/script/client/0_utilities.js +41 -4
  75. package/script/client/1_account_manager.js +4 -4
  76. package/script/client/1_client_encrypted.js +2 -2
  77. package/script/client/1_client_plain.js +2 -2
  78. package/script/client/1_file_manager.js +5 -4
  79. package/script/client/1_reaction_manager.js +2 -2
  80. package/script/client/1_update_manager.js +8 -7
  81. package/script/client/2_message_manager.js +51 -28
  82. package/script/client/3_callback_query_manager.js +2 -0
  83. package/script/client/3_chat_list_manager.js +12 -11
  84. package/script/client/3_inline_query_manager.js +4 -2
  85. package/script/client/3_story_manager.js +4 -2
  86. package/script/client/4_client.d.ts +5 -8
  87. package/script/client/4_client.js +18 -26
  88. package/script/connection/1_connection_web_socket.js +2 -1
  89. package/{esm/deps/deno.land/x/tgcrypto@0.3.3 → script/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
  90. package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +1 -13
  91. package/script/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +310 -0
  92. package/script/mod.d.ts +1 -1
  93. package/script/mod.js +2 -1
  94. package/script/storage/0_storage.js +5 -4
  95. package/script/storage/1_utilities.d.ts +0 -1
  96. package/script/storage/1_utilities.js +3 -4
  97. package/script/storage/2_storage_local_storage.js +0 -3
  98. package/script/storage/2_storage_session_storage.js +0 -3
  99. package/script/tl/3_utilities.js +4 -3
  100. package/script/transport/2_transport_provider.js +4 -4
  101. package/script/types/0_message_entity.js +3 -3
  102. package/script/types/0_message_search_filter.js +2 -2
  103. package/script/types/0_reaction.js +2 -2
  104. package/script/types/1_bot_command_scope.js +3 -3
  105. package/script/types/1_chat_p.js +2 -1
  106. package/script/types/1_keyboard_button.js +3 -3
  107. package/script/types/1_message_reaction.js +2 -2
  108. package/script/types/1_story_privacy.js +3 -3
  109. package/script/types/2_chat_member.js +5 -4
  110. package/script/types/2_chosen_inline_result.js +2 -1
  111. package/script/types/2_inactive_chat.js +2 -1
  112. package/script/types/2_inline_keyboard_button.js +3 -3
  113. package/script/types/2_inline_query.js +3 -3
  114. package/script/types/2_invite_link.js +2 -1
  115. package/script/types/2_story_content.js +5 -5
  116. package/script/types/2_story_interactive_area.js +5 -5
  117. package/script/types/3_chat_member_updated.js +3 -2
  118. package/script/types/3_reply_markup.js +3 -2
  119. package/script/types/3_story.js +2 -1
  120. package/script/types/4_inline_query_result.js +5 -5
  121. package/script/types/4_message.js +16 -15
  122. package/script/types/5_callback_query.js +3 -2
  123. package/script/types/5_chat.js +7 -6
  124. package/script/types/_file_id.js +8 -7
  125. package/script/utilities/0_bigint.d.ts +1 -0
  126. package/script/utilities/0_bigint.js +27 -1
  127. package/script/utilities/0_logger.d.ts +8 -0
  128. package/script/utilities/0_logger.js +11 -6
  129. package/script/utilities/1_math.d.ts +1 -0
  130. package/script/utilities/1_math.js +55 -0
  131. package/script/utilities/1_misc.js +2 -2
  132. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  133. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -203
  134. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  135. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -274
  136. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  137. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -51
  138. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  139. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -191
  140. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  141. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -385
  142. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  143. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -431
  144. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  145. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1046
  146. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  147. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -52
  148. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  149. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -122
  150. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  151. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -24
  152. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  153. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -121
  154. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  155. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -30
  156. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  157. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2127
  158. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  159. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -108
  160. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  161. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -1
  162. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  163. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -95
  164. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  165. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -128
  166. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  167. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -110
  168. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  169. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -120
  170. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  171. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -6
  172. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  173. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -110
  174. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  175. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -75
  176. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  177. package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -101
  178. package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -324
  179. package/esm/utilities/0_control.d.ts +0 -1
  180. package/esm/utilities/0_control.js +0 -3
  181. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
  182. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -207
  183. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
  184. package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -301
  185. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
  186. package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -55
  187. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
  188. package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -222
  189. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
  190. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -404
  191. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
  192. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -438
  193. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
  194. package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1052
  195. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
  196. package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -88
  197. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
  198. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -128
  199. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
  200. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -30
  201. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
  202. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -129
  203. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
  204. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -32
  205. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
  206. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2129
  207. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
  208. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -110
  209. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
  210. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -3
  211. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
  212. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -114
  213. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
  214. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -134
  215. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
  216. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -118
  217. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
  218. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -129
  219. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
  220. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -22
  221. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
  222. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -119
  223. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
  224. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -86
  225. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
  226. package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -112
  227. package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -326
  228. package/script/utilities/0_control.d.ts +0 -1
  229. package/script/utilities/0_control.js +0 -7
  230. /package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
  231. /package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
@@ -28,7 +28,7 @@ class StoryManager {
28
28
  async createStory(chatId, content, params) {
29
29
  await __classPrivateFieldGet(this, _StoryManager_c, "f").storage.assertUser("createStory");
30
30
  let media = null;
31
- const source = "video" in content ? content.video : "photo" in content ? content.photo : (0, _1_utilities_js_1.UNREACHABLE)();
31
+ const source = "video" in content ? content.video : "photo" in content ? content.photo : (0, _0_deps_js_1.unreachable)();
32
32
  if (typeof source === "string") {
33
33
  const fileId = __classPrivateFieldGet(this, _StoryManager_c, "f").messageManager.resolveFileId(source, _3_types_js_1.FileType.Photo);
34
34
  if (fileId != null) {
@@ -87,6 +87,7 @@ class StoryManager {
87
87
  }
88
88
  async getStories(chatId, storyIds) {
89
89
  await __classPrivateFieldGet(this, _StoryManager_c, "f").storage.assertUser("getStories");
90
+ (0, _0_utilities_js_1.checkArray)(storyIds, _0_utilities_js_1.checkStoryId);
90
91
  const peer = await __classPrivateFieldGet(this, _StoryManager_c, "f").getInputPeer(chatId);
91
92
  const stories_ = await __classPrivateFieldGet(this, _StoryManager_c, "f").api.stories.getStoriesByID({ peer, id: storyIds });
92
93
  const stories = new Array();
@@ -150,8 +151,9 @@ _StoryManager_c = new WeakMap(), _StoryManager_instances = new WeakSet(), _Story
150
151
  return await (0, _3_types_js_1.constructStory)(updateStory.story, updateStory.peer, __classPrivateFieldGet(this, _StoryManager_c, "f").getEntity);
151
152
  }
152
153
  }
153
- (0, _1_utilities_js_1.UNREACHABLE)();
154
+ (0, _0_deps_js_1.unreachable)();
154
155
  }, _StoryManager_togglePinned = async function _StoryManager_togglePinned(chatId, storyIds, pinned) {
156
+ (0, _0_utilities_js_1.checkArray)(storyIds, _0_utilities_js_1.checkStoryId);
155
157
  const peer = await __classPrivateFieldGet(this, _StoryManager_c, "f").getInputPeer(chatId);
156
158
  await __classPrivateFieldGet(this, _StoryManager_c, "f").api.stories.togglePinned({ peer, id: storyIds, pinned });
157
159
  };
@@ -235,27 +235,24 @@ export declare class Client<C extends Context = Context> extends Composer<C> {
235
235
  [handleMigrationError](err: Migrate): Promise<void>;
236
236
  disconnect(): Promise<void>;
237
237
  /**
238
- * Calls [initConnection](1) and authorizes the client with one of the following:
238
+ * Authorizes the client with one of the following:
239
239
  *
240
240
  * - Bot token (`string`)
241
- * - Exported authorization (`types.AuthExportedAuthorization`)
242
241
  * - User authorization handlers (`AuthorizeUserParams`)
243
242
  *
244
- * if the current auth key doesn't throw AUTH_KEY_UNREGISTERED when calling [updates.getState](2).
243
+ * if the current auth key doesn't throw AUTH_KEY_UNREGISTERED when calling [updates.getState](1).
245
244
  *
246
245
  * Notes:
247
246
  * 1. Requires the `apiId` and `apiHash` paramters to be passed when constructing the client.
248
247
  * 2. Reconnects the client to the appropriate DC in case of MIGRATE_X errors.
249
- * 3. The parameters passed to the [initConnection][1] call can be configured with the last parameter of the constructor.
250
248
  *
251
- * [1]: https://core.telegram.org/method/initConnection
252
- * [2]: https://core.telegram.org/method/updates.getState
249
+ * [1]: https://core.telegram.org/method/updates.getState
253
250
  */
254
- authorize(params?: string | types.auth.ExportedAuthorization | AuthorizeUserParams): Promise<void>;
251
+ authorize(params?: string | AuthorizeUserParams): Promise<void>;
255
252
  /**
256
253
  * Same as calling `.connect()` followed by `.authorize(params)`.
257
254
  */
258
- start(params?: string | types.auth.ExportedAuthorization | AuthorizeUserParams): Promise<void>;
255
+ start(params?: string | AuthorizeUserParams): Promise<void>;
259
256
  /**
260
257
  * Invokes a function waiting and returning its reply if the second parameter is not `true`. Requires the client
261
258
  * to be connected.
@@ -13,6 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var _Client_instances, _Client_client, _Client_guaranteeUpdateDelivery, _Client_updateManager, _Client_networkStatisticsManager, _Client_botInfoManager, _Client_fileManager, _Client_reactionManager, _Client_businessConnectionManager, _Client_messageManager, _Client_storyManager, _Client_callbackQueryManager, _Client_inlineQueryManager, _Client_chatListManager, _Client_accountManager, _Client_parseMode, _Client_publicKeys, _Client_ignoreOutgoing, _Client_storeMessages, _Client_Lauthorize, _Client_LpingLoop, _Client_LhandleMigrationError, _Client_L$initConncetion, _Client_namespaceProxies, _Client_getApiId, _Client_constructContext, _Client_propagateConnectionState, _Client_lastPropagatedConnectionState, _Client_stateChangeHandler, _Client_storageInited, _Client_initStorage, _Client_connectionInited, _Client_lastPropagatedAuthorizationState, _Client_propagateAuthorizationState, _Client_getSelfId, _Client_pingLoopStarted, _Client_pingLoopAbortController, _Client_pingInterval, _Client_lastUpdates, _Client_startPingLoop, _Client_pingLoop, _Client_invoke, _Client_handleInvokeError, _Client_getUserAccessHash, _Client_getChannelAccessHash, _Client_getInputPeerInner, _Client_handleCtxUpdate, _Client_queueHandleCtxUpdate, _Client_handleUpdate, _Client_lastGetMe, _Client_getMe;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.Client = exports.handleMigrationError = exports.restartAuth = exports.Composer = void 0;
16
+ const _0_deps_js_1 = require("../0_deps.js");
16
17
  const _0_errors_js_1 = require("../0_errors.js");
17
18
  const _1_utilities_js_1 = require("../1_utilities.js");
18
19
  const _2_tl_js_1 = require("../2_tl.js");
@@ -164,7 +165,7 @@ class Client extends Composer {
164
165
  };
165
166
  }
166
167
  else {
167
- (0, _1_utilities_js_1.UNREACHABLE)();
168
+ (0, _0_deps_js_1.unreachable)();
168
169
  }
169
170
  }
170
171
  },
@@ -212,7 +213,7 @@ class Client extends Composer {
212
213
  return { chatId: reactions.chatId, messageId: reactions.messageId };
213
214
  }
214
215
  else {
215
- (0, _1_utilities_js_1.UNREACHABLE)();
216
+ (0, _0_deps_js_1.unreachable)();
216
217
  }
217
218
  };
218
219
  const mustGetUserId = () => {
@@ -226,7 +227,7 @@ class Client extends Composer {
226
227
  return update.chosenInlineResult.from.id;
227
228
  }
228
229
  else {
229
- (0, _1_utilities_js_1.UNREACHABLE)();
230
+ (0, _0_deps_js_1.unreachable)();
230
231
  }
231
232
  };
232
233
  const mustGetInlineMsgId = () => {
@@ -240,7 +241,7 @@ class Client extends Composer {
240
241
  return update.callbackQuery.inlineMessageId;
241
242
  }
242
243
  }
243
- (0, _1_utilities_js_1.UNREACHABLE)();
244
+ (0, _0_deps_js_1.unreachable)();
244
245
  };
245
246
  const chat_ = "messageReactions" in update ? update.messageReactions.chat : "messageReactionCount" in update ? update.messageReactionCount.chat : undefined;
246
247
  const chat = chat_ ?? msg?.chat;
@@ -353,21 +354,21 @@ class Client extends Composer {
353
354
  banSender: (params) => {
354
355
  const { chatId, senderId } = mustGetMsg();
355
356
  if (!senderId) {
356
- (0, _1_utilities_js_1.UNREACHABLE)();
357
+ (0, _0_deps_js_1.unreachable)();
357
358
  }
358
359
  return this.banChatMember(chatId, senderId, params);
359
360
  },
360
361
  kickSender: () => {
361
362
  const { chatId, senderId } = mustGetMsg();
362
363
  if (!senderId) {
363
- (0, _1_utilities_js_1.UNREACHABLE)();
364
+ (0, _0_deps_js_1.unreachable)();
364
365
  }
365
366
  return this.kickChatMember(chatId, senderId);
366
367
  },
367
368
  setSenderRights: (params) => {
368
369
  const { chatId, senderId } = mustGetMsg();
369
370
  if (!senderId) {
370
- (0, _1_utilities_js_1.UNREACHABLE)();
371
+ (0, _0_deps_js_1.unreachable)();
371
372
  }
372
373
  return this.setChatMemberRights(chatId, senderId, params);
373
374
  },
@@ -381,13 +382,13 @@ class Client extends Composer {
381
382
  },
382
383
  answerCallbackQuery: (params) => {
383
384
  if (!("callbackQuery" in update)) {
384
- (0, _1_utilities_js_1.UNREACHABLE)();
385
+ (0, _0_deps_js_1.unreachable)();
385
386
  }
386
387
  return this.answerCallbackQuery(update.callbackQuery.id, params);
387
388
  },
388
389
  answerInlineQuery: (results, params) => {
389
390
  if (!("inlineQuery" in update)) {
390
- (0, _1_utilities_js_1.UNREACHABLE)();
391
+ (0, _0_deps_js_1.unreachable)();
391
392
  }
392
393
  return this.answerInlineQuery(update.inlineQuery.id, results, params);
393
394
  },
@@ -540,7 +541,7 @@ class Client extends Composer {
540
541
  getBusinessConnection: () => {
541
542
  const { businessConnectionId } = mustGetMsg();
542
543
  if (!businessConnectionId) {
543
- (0, _1_utilities_js_1.UNREACHABLE)();
544
+ (0, _0_deps_js_1.unreachable)();
544
545
  }
545
546
  return this.getBusinessConnection(businessConnectionId);
546
547
  },
@@ -685,8 +686,7 @@ class Client extends Composer {
685
686
  if (ctx.error instanceof _4_errors_js_1.AuthKeyUnregistered && dcId) {
686
687
  try {
687
688
  const exportedAuth = await this.api.auth.exportAuthorization({ dc_id: dcId });
688
- await client.authorize(exportedAuth);
689
- // throw 1;
689
+ await client.api.auth.importAuthorization(exportedAuth);
690
690
  return true;
691
691
  }
692
692
  catch (err) {
@@ -867,21 +867,18 @@ class Client extends Composer {
867
867
  __classPrivateFieldGet(this, _Client_pingLoopAbortController, "f")?.abort();
868
868
  }
869
869
  /**
870
- * Calls [initConnection](1) and authorizes the client with one of the following:
870
+ * Authorizes the client with one of the following:
871
871
  *
872
872
  * - Bot token (`string`)
873
- * - Exported authorization (`types.AuthExportedAuthorization`)
874
873
  * - User authorization handlers (`AuthorizeUserParams`)
875
874
  *
876
- * if the current auth key doesn't throw AUTH_KEY_UNREGISTERED when calling [updates.getState](2).
875
+ * if the current auth key doesn't throw AUTH_KEY_UNREGISTERED when calling [updates.getState](1).
877
876
  *
878
877
  * Notes:
879
878
  * 1. Requires the `apiId` and `apiHash` paramters to be passed when constructing the client.
880
879
  * 2. Reconnects the client to the appropriate DC in case of MIGRATE_X errors.
881
- * 3. The parameters passed to the [initConnection][1] call can be configured with the last parameter of the constructor.
882
880
  *
883
- * [1]: https://core.telegram.org/method/initConnection
884
- * [2]: https://core.telegram.org/method/updates.getState
881
+ * [1]: https://core.telegram.org/method/updates.getState
885
882
  */
886
883
  async authorize(params) {
887
884
  try {
@@ -933,11 +930,6 @@ class Client extends Composer {
933
930
  await __classPrivateFieldGet(this, _Client_updateManager, "f").fetchState("authorize");
934
931
  return;
935
932
  }
936
- if (params instanceof _2_tl_js_1.types.auth.ExportedAuthorization) {
937
- await this.api.auth.importAuthorization({ id: params.id, bytes: params.bytes });
938
- __classPrivateFieldGet(this, _Client_Lauthorize, "f").debug("authorization imported");
939
- return;
940
- }
941
933
  auth: while (true) {
942
934
  try {
943
935
  let phone;
@@ -1078,7 +1070,7 @@ class Client extends Composer {
1078
1070
  inputPeer.access_hash = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getUserAccessHash).call(this, inputPeer.user_id);
1079
1071
  }
1080
1072
  }
1081
- else {
1073
+ if ((inputPeer instanceof _2_tl_js_1.types.InputPeerUser || inputPeer instanceof _2_tl_js_1.types.InputPeerChannel && inputPeer.access_hash == 0n) && await this.storage.getAccountType() == "user") {
1082
1074
  throw new _0_errors_js_1.AccessError(`Cannot access the chat ${id} because there is no access hash for it.`);
1083
1075
  }
1084
1076
  return inputPeer;
@@ -1230,7 +1222,7 @@ class Client extends Composer {
1230
1222
  resolvedId = (0, _2_tl_js_1.peerToChatId)(resolved.peer);
1231
1223
  }
1232
1224
  else {
1233
- (0, _1_utilities_js_1.UNREACHABLE)();
1225
+ (0, _0_deps_js_1.unreachable)();
1234
1226
  }
1235
1227
  }
1236
1228
  const resolvedIdType = (0, _2_tl_js_1.getChatIdPeerType)(resolvedId);
@@ -1243,7 +1235,7 @@ class Client extends Composer {
1243
1235
  return new _2_tl_js_1.types.InputPeerChannel({ channel_id: (0, _2_tl_js_1.chatIdToPeerId)(resolvedId), access_hash: accessHash ?? 0n });
1244
1236
  }
1245
1237
  else {
1246
- (0, _1_utilities_js_1.UNREACHABLE)();
1238
+ (0, _0_deps_js_1.unreachable)();
1247
1239
  }
1248
1240
  }
1249
1241
  else if (id > 0) {
@@ -37,6 +37,7 @@ var _ConnectionWebSocket_instances, _ConnectionWebSocket_webSocket, _ConnectionW
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.ConnectionWebSocket = void 0;
39
39
  const dntShim = __importStar(require("../_dnt.shims.js"));
40
+ const _0_deps_js_1 = require("../0_deps.js");
40
41
  const _1_utilities_js_1 = require("../1_utilities.js");
41
42
  const _0_connection_js_1 = require("./0_connection.js");
42
43
  const L = (0, _1_utilities_js_1.getLogger)("ConnectionWebSocket");
@@ -142,7 +143,7 @@ _ConnectionWebSocket_webSocket = new WeakMap(), _ConnectionWebSocket_rMutex = ne
142
143
  return;
143
144
  }
144
145
  const unlock = await mutex.lock();
145
- const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : (0, _1_utilities_js_1.UNREACHABLE)())).arrayBuffer());
146
+ const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : (0, _0_deps_js_1.unreachable)())).arrayBuffer());
146
147
  __classPrivateFieldSet(this, _ConnectionWebSocket_buffer, (0, _1_utilities_js_1.concat)(__classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f"), data), "f");
147
148
  if (__classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f") != null && __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").length >= __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[0]) {
148
149
  __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[1].resolve();
@@ -40,4 +40,3 @@ export declare function cbc256Encrypt(data: Uint8Array, key: Uint8Array, iv: Uin
40
40
  * @param iv 16-byte initialization vector
41
41
  */
42
42
  export declare function cbc256Decrypt(data: Uint8Array, key: Uint8Array, iv: Uint8Array): Uint8Array;
43
- export declare function factorize(pq: bigint): [bigint, bigint];
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.factorize = exports.cbc256Decrypt = exports.cbc256Encrypt = exports.ctr256 = exports.ige256Decrypt = exports.ige256Encrypt = exports.init = void 0;
6
+ exports.cbc256Decrypt = exports.cbc256Encrypt = exports.ctr256 = exports.ige256Decrypt = exports.ige256Encrypt = exports.init = void 0;
7
7
  const tgcrypto_js_1 = __importDefault(require("./tgcrypto.js"));
8
8
  // deno-lint-ignore no-explicit-any
9
9
  let module_;
@@ -163,15 +163,3 @@ function cbc256Decrypt(data, key, iv) {
163
163
  }
164
164
  }
165
165
  exports.cbc256Decrypt = cbc256Decrypt;
166
- function factorize(pq) {
167
- const pqp = module_._malloc(16);
168
- module_.ccall("factorize", "void", ["number", "pointer"], [pq, pqp]);
169
- try {
170
- const pqp_ = module_.HEAP64.slice(pqp / 8, pqp / 8 + 2);
171
- return [pqp_[0], pqp_[1]];
172
- }
173
- finally {
174
- module_._free(pqp);
175
- }
176
- }
177
- exports.factorize = factorize;