@mtkruto/node 0.0.990 → 0.0.992

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 (254) hide show
  1. package/esm/1_utilities.d.ts +12 -0
  2. package/esm/1_utilities.js +12 -0
  3. package/esm/2_connection.d.ts +2 -0
  4. package/esm/2_connection.js +2 -0
  5. package/esm/2_tl.d.ts +10 -0
  6. package/esm/2_tl.js +10 -0
  7. package/esm/3_storage.d.ts +6 -0
  8. package/esm/3_storage.js +6 -0
  9. package/esm/3_transport.d.ts +4 -0
  10. package/esm/3_transport.js +4 -0
  11. package/esm/3_types.d.ts +35 -0
  12. package/esm/3_types.js +35 -0
  13. package/esm/{constants.d.ts → 4_constants.d.ts} +2 -2
  14. package/esm/{constants.js → 4_constants.js} +1 -1
  15. package/esm/5_client.d.ts +2 -0
  16. package/esm/5_client.js +2 -0
  17. package/esm/client/0_html.d.ts +1 -1
  18. package/esm/client/0_html.js +1 -1
  19. package/esm/client/0_message.d.ts +1 -2
  20. package/esm/client/0_message.js +7 -14
  21. package/esm/client/0_password.d.ts +2 -2
  22. package/esm/client/0_password.js +2 -4
  23. package/esm/client/0_utilities.d.ts +3 -5
  24. package/esm/client/0_utilities.js +3 -22
  25. package/esm/client/1_client_abstract.d.ts +2 -2
  26. package/esm/client/1_client_abstract.js +3 -3
  27. package/esm/client/2_client_plain.d.ts +3 -3
  28. package/esm/client/2_client_plain.js +13 -20
  29. package/esm/client/3_client.d.ts +43 -18
  30. package/esm/client/3_client.js +107 -46
  31. package/esm/connection/0_connection.d.ts +1 -1
  32. package/esm/connection/1_connection_web_socket.js +1 -1
  33. package/esm/mod.d.ts +7 -21
  34. package/esm/mod.js +7 -21
  35. package/esm/storage/0_storage.d.ts +4 -5
  36. package/esm/storage/0_storage.js +3 -8
  37. package/esm/storage/0_utilities.js +2 -2
  38. package/esm/storage/1_storage_local_storage.d.ts +1 -1
  39. package/esm/storage/1_storage_memory.d.ts +1 -1
  40. package/esm/storage/1_storage_session_storage.d.ts +1 -1
  41. package/esm/tl/0_tl_raw_reader.js +1 -1
  42. package/esm/tl/0_tl_raw_writer.js +1 -1
  43. package/esm/tl/1_tl_object.js +1 -1
  44. package/esm/tl/3_deserialize.js +1 -1
  45. package/esm/tl/3_utilities.d.ts +3 -0
  46. package/esm/tl/3_utilities.js +20 -0
  47. package/esm/tl/4_tl_writer.js +1 -1
  48. package/esm/transport/0_obfuscation.d.ts +2 -2
  49. package/esm/transport/0_obfuscation.js +1 -2
  50. package/esm/transport/0_transport.d.ts +1 -2
  51. package/esm/transport/1_transport_abridged.d.ts +1 -1
  52. package/esm/transport/1_transport_abridged.js +1 -1
  53. package/esm/transport/1_transport_intermediate.d.ts +1 -1
  54. package/esm/transport/1_transport_intermediate.js +1 -1
  55. package/esm/transport/2_transport_provider.d.ts +1 -1
  56. package/esm/transport/2_transport_provider.js +1 -1
  57. package/esm/types/!0_file_id.js +6 -9
  58. package/esm/types/!0_misc.d.ts +7 -0
  59. package/esm/types/!0_misc.js +1 -0
  60. package/esm/types/0_audio.d.ts +3 -3
  61. package/esm/types/0_audio.js +1 -1
  62. package/esm/types/0_chat_administrator_rights.d.ts +1 -1
  63. package/esm/types/0_chat_administrator_rights.js +1 -1
  64. package/esm/types/0_chat_photo.d.ts +3 -3
  65. package/esm/types/0_chat_photo.js +1 -1
  66. package/esm/types/0_color.d.ts +2 -0
  67. package/esm/types/0_color.js +16 -0
  68. package/esm/types/0_contact.d.ts +2 -2
  69. package/esm/types/0_dice.d.ts +1 -1
  70. package/esm/types/0_force_reply.d.ts +1 -1
  71. package/esm/types/0_force_reply.js +1 -1
  72. package/esm/types/0_location.d.ts +1 -1
  73. package/esm/types/0_location.js +1 -2
  74. package/esm/types/0_mask_position.d.ts +1 -1
  75. package/esm/types/0_message_entity.d.ts +5 -5
  76. package/esm/types/0_message_entity.js +1 -1
  77. package/esm/types/0_poll_option.d.ts +1 -1
  78. package/esm/types/0_reply_keyboard_remove.d.ts +1 -1
  79. package/esm/types/0_reply_keyboard_remove.js +2 -2
  80. package/esm/types/0_thumbnail.d.ts +2 -2
  81. package/esm/types/0_thumbnail.js +1 -1
  82. package/esm/types/0_venue.d.ts +1 -1
  83. package/esm/types/0_venue.js +1 -2
  84. package/esm/types/0_voice.d.ts +3 -3
  85. package/esm/types/0_web_app_info.d.ts +2 -2
  86. package/esm/types/1_animation.d.ts +3 -3
  87. package/esm/types/1_animation.js +1 -1
  88. package/esm/types/1_chat.d.ts +5 -4
  89. package/esm/types/1_chat.js +8 -9
  90. package/esm/types/1_document.d.ts +4 -4
  91. package/esm/types/1_document.js +1 -1
  92. package/esm/types/1_inline_keyboard_button.d.ts +4 -4
  93. package/esm/types/1_inline_keyboard_button.js +2 -2
  94. package/esm/types/1_keyboard_button.d.ts +8 -8
  95. package/esm/types/1_keyboard_button.js +2 -2
  96. package/esm/types/1_photo.d.ts +2 -2
  97. package/esm/types/1_photo.js +1 -1
  98. package/esm/types/1_poll.d.ts +8 -8
  99. package/esm/types/1_poll.js +1 -1
  100. package/esm/types/1_sticker.d.ts +3 -3
  101. package/esm/types/1_sticker.js +1 -2
  102. package/esm/types/1_user.d.ts +4 -3
  103. package/esm/types/1_user.js +4 -4
  104. package/esm/types/1_video.d.ts +3 -3
  105. package/esm/types/1_video.js +1 -1
  106. package/esm/types/1_video_note.d.ts +2 -2
  107. package/esm/types/1_video_note.js +1 -1
  108. package/esm/types/2_game.d.ts +3 -3
  109. package/esm/types/2_game.js +2 -3
  110. package/esm/types/2_inline_keyboard_markup.d.ts +2 -2
  111. package/esm/types/2_inline_keyboard_markup.js +1 -1
  112. package/esm/types/2_inline_query.d.ts +19 -0
  113. package/esm/types/2_inline_query.js +41 -0
  114. package/esm/types/2_reply_keyboard_markup.d.ts +2 -2
  115. package/esm/types/2_reply_keyboard_markup.js +1 -1
  116. package/esm/types/3_message.d.ts +23 -23
  117. package/esm/types/3_message.js +19 -18
  118. package/esm/types/4_callback_query.d.ts +14 -0
  119. package/esm/types/4_callback_query.js +24 -0
  120. package/esm/utilities/0_base64.js +1 -1
  121. package/esm/utilities/0_crypto.js +1 -1
  122. package/esm/utilities/0_queue.js +1 -1
  123. package/esm/utilities/1_auth.js +1 -1
  124. package/package.json +1 -1
  125. package/script/1_utilities.d.ts +12 -0
  126. package/script/1_utilities.js +28 -0
  127. package/script/2_connection.d.ts +2 -0
  128. package/script/2_connection.js +18 -0
  129. package/script/2_tl.d.ts +10 -0
  130. package/script/2_tl.js +40 -0
  131. package/script/3_storage.d.ts +6 -0
  132. package/script/3_storage.js +22 -0
  133. package/script/3_transport.d.ts +4 -0
  134. package/script/3_transport.js +20 -0
  135. package/script/3_types.d.ts +35 -0
  136. package/script/3_types.js +51 -0
  137. package/script/{constants.d.ts → 4_constants.d.ts} +2 -2
  138. package/script/{constants.js → 4_constants.js} +1 -1
  139. package/script/5_client.d.ts +2 -0
  140. package/script/5_client.js +18 -0
  141. package/script/client/0_html.d.ts +1 -1
  142. package/script/client/0_html.js +2 -2
  143. package/script/client/0_message.d.ts +1 -2
  144. package/script/client/0_message.js +32 -39
  145. package/script/client/0_password.d.ts +2 -2
  146. package/script/client/0_password.js +20 -22
  147. package/script/client/0_utilities.d.ts +3 -5
  148. package/script/client/0_utilities.js +24 -68
  149. package/script/client/1_client_abstract.d.ts +2 -2
  150. package/script/client/1_client_abstract.js +6 -6
  151. package/script/client/2_client_plain.d.ts +3 -3
  152. package/script/client/2_client_plain.js +45 -52
  153. package/script/client/3_client.d.ts +43 -18
  154. package/script/client/3_client.js +342 -305
  155. package/script/connection/0_connection.d.ts +1 -1
  156. package/script/connection/1_connection_web_socket.js +5 -5
  157. package/script/mod.d.ts +7 -21
  158. package/script/mod.js +17 -45
  159. package/script/storage/0_storage.d.ts +4 -5
  160. package/script/storage/0_storage.js +11 -39
  161. package/script/storage/0_utilities.js +6 -6
  162. package/script/storage/1_storage_local_storage.d.ts +1 -1
  163. package/script/storage/1_storage_memory.d.ts +1 -1
  164. package/script/storage/1_storage_session_storage.d.ts +1 -1
  165. package/script/tl/0_tl_raw_reader.js +6 -6
  166. package/script/tl/0_tl_raw_writer.js +7 -7
  167. package/script/tl/1_tl_object.js +3 -3
  168. package/script/tl/3_deserialize.js +2 -2
  169. package/script/tl/3_utilities.d.ts +3 -0
  170. package/script/tl/3_utilities.js +48 -0
  171. package/script/tl/4_tl_writer.js +2 -2
  172. package/script/transport/0_obfuscation.d.ts +2 -2
  173. package/script/transport/0_obfuscation.js +5 -6
  174. package/script/transport/0_transport.d.ts +1 -2
  175. package/script/transport/1_transport_abridged.d.ts +1 -1
  176. package/script/transport/1_transport_abridged.js +3 -3
  177. package/script/transport/1_transport_intermediate.d.ts +1 -1
  178. package/script/transport/1_transport_intermediate.js +3 -3
  179. package/script/transport/2_transport_provider.d.ts +1 -1
  180. package/script/transport/2_transport_provider.js +2 -2
  181. package/script/types/!0_file_id.js +24 -27
  182. package/script/types/!0_misc.d.ts +7 -0
  183. package/script/types/!0_misc.js +2 -0
  184. package/script/types/0_audio.d.ts +3 -3
  185. package/script/types/0_audio.js +2 -25
  186. package/script/types/0_chat_administrator_rights.d.ts +1 -1
  187. package/script/types/0_chat_administrator_rights.js +2 -25
  188. package/script/types/0_chat_photo.d.ts +3 -3
  189. package/script/types/0_chat_photo.js +2 -25
  190. package/script/types/0_color.d.ts +2 -0
  191. package/script/types/{!0_id_color.js → 0_color.js} +10 -10
  192. package/script/types/0_contact.d.ts +2 -2
  193. package/script/types/0_dice.d.ts +1 -1
  194. package/script/types/0_force_reply.d.ts +1 -1
  195. package/script/types/0_force_reply.js +2 -25
  196. package/script/types/0_location.d.ts +1 -1
  197. package/script/types/0_location.js +5 -29
  198. package/script/types/0_mask_position.d.ts +1 -1
  199. package/script/types/0_message_entity.d.ts +5 -5
  200. package/script/types/0_message_entity.js +39 -62
  201. package/script/types/0_poll_option.d.ts +1 -1
  202. package/script/types/0_reply_keyboard_remove.d.ts +1 -1
  203. package/script/types/0_reply_keyboard_remove.js +4 -27
  204. package/script/types/0_thumbnail.d.ts +2 -2
  205. package/script/types/0_thumbnail.js +2 -25
  206. package/script/types/0_venue.d.ts +1 -1
  207. package/script/types/0_venue.js +2 -26
  208. package/script/types/0_voice.d.ts +3 -3
  209. package/script/types/0_web_app_info.d.ts +2 -2
  210. package/script/types/1_animation.d.ts +3 -3
  211. package/script/types/1_animation.js +2 -25
  212. package/script/types/1_chat.d.ts +5 -4
  213. package/script/types/1_chat.js +20 -44
  214. package/script/types/1_document.d.ts +4 -4
  215. package/script/types/1_document.js +2 -25
  216. package/script/types/1_inline_keyboard_button.d.ts +4 -4
  217. package/script/types/1_inline_keyboard_button.js +19 -42
  218. package/script/types/1_keyboard_button.d.ts +8 -8
  219. package/script/types/1_keyboard_button.js +24 -47
  220. package/script/types/1_photo.d.ts +2 -2
  221. package/script/types/1_photo.js +4 -27
  222. package/script/types/1_poll.d.ts +8 -8
  223. package/script/types/1_poll.js +2 -2
  224. package/script/types/1_sticker.d.ts +3 -3
  225. package/script/types/1_sticker.js +6 -30
  226. package/script/types/1_user.d.ts +4 -3
  227. package/script/types/1_user.js +6 -29
  228. package/script/types/1_video.d.ts +3 -3
  229. package/script/types/1_video.js +2 -25
  230. package/script/types/1_video_note.d.ts +2 -2
  231. package/script/types/1_video_note.js +2 -25
  232. package/script/types/2_game.d.ts +3 -3
  233. package/script/types/2_game.js +6 -30
  234. package/script/types/2_inline_keyboard_markup.d.ts +2 -2
  235. package/script/types/2_inline_keyboard_markup.js +3 -26
  236. package/script/types/2_inline_query.d.ts +19 -0
  237. package/script/types/2_inline_query.js +45 -0
  238. package/script/types/2_reply_keyboard_markup.d.ts +2 -2
  239. package/script/types/2_reply_keyboard_markup.js +3 -26
  240. package/script/types/3_message.d.ts +23 -23
  241. package/script/types/3_message.js +97 -119
  242. package/script/types/4_callback_query.d.ts +14 -0
  243. package/script/types/4_callback_query.js +28 -0
  244. package/script/utilities/0_base64.js +3 -3
  245. package/script/utilities/0_crypto.js +3 -3
  246. package/script/utilities/0_queue.js +2 -2
  247. package/script/utilities/1_auth.js +5 -5
  248. package/esm/types/!0_id_color.d.ts +0 -1
  249. package/esm/types/!0_id_color.js +0 -16
  250. package/script/types/!0_id_color.d.ts +0 -1
  251. /package/esm/{deps.d.ts → 0_deps.d.ts} +0 -0
  252. /package/esm/{deps.js → 0_deps.js} +0 -0
  253. /package/script/{deps.d.ts → 0_deps.d.ts} +0 -0
  254. /package/script/{deps.js → 0_deps.js} +0 -0
@@ -1,80 +1,55 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.constructMessage = void 0;
27
- const deps_js_1 = require("../deps.js");
28
- const _0_control_js_1 = require("../utilities/0_control.js");
29
- const _0_object_js_1 = require("../utilities/0_object.js");
30
- const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
31
- const types = __importStar(require("../tl/2_types.js"));
4
+ const _0_deps_js_1 = require("../0_deps.js");
5
+ const _1_utilities_js_1 = require("../1_utilities.js");
6
+ const _2_tl_js_1 = require("../2_tl.js");
7
+ const _4_constants_js_1 = require("../4_constants.js");
8
+ const _0_file_id_js_1 = require("./!0_file_id.js");
32
9
  const _0_force_reply_js_1 = require("./0_force_reply.js");
33
10
  const _0_message_entity_js_1 = require("./0_message_entity.js");
11
+ const _0_audio_js_1 = require("./0_audio.js");
12
+ const _0_contact_js_1 = require("./0_contact.js");
13
+ const _0_voice_js_1 = require("./0_voice.js");
14
+ const _0_venue_js_1 = require("./0_venue.js");
15
+ const _0_location_js_1 = require("./0_location.js");
16
+ const _0_dice_js_1 = require("./0_dice.js");
34
17
  const _0_reply_keyboard_remove_js_1 = require("./0_reply_keyboard_remove.js");
35
18
  const _1_chat_js_1 = require("./1_chat.js");
36
- const _1_user_js_1 = require("./1_user.js");
37
- const _2_inline_keyboard_markup_js_1 = require("./2_inline_keyboard_markup.js");
38
- const _2_reply_keyboard_markup_js_1 = require("./2_reply_keyboard_markup.js");
39
- const _1_sticker_js_1 = require("./1_sticker.js");
40
19
  const _1_photo_js_1 = require("./1_photo.js");
41
20
  const _1_document_js_1 = require("./1_document.js");
42
21
  const _1_video_js_1 = require("./1_video.js");
43
22
  const _1_video_note_js_1 = require("./1_video_note.js");
44
23
  const _1_animation_js_1 = require("./1_animation.js");
45
- const _0_audio_js_1 = require("./0_audio.js");
46
- const _0_voice_js_1 = require("./0_voice.js");
47
- const _0_dice_js_1 = require("./0_dice.js");
48
- const _0_file_id_js_1 = require("./!0_file_id.js");
49
- const _0_contact_js_1 = require("./0_contact.js");
50
- const _2_game_js_1 = require("./2_game.js");
24
+ const _1_user_js_1 = require("./1_user.js");
51
25
  const _1_poll_js_1 = require("./1_poll.js");
52
- const _0_venue_js_1 = require("./0_venue.js");
53
- const _0_location_js_1 = require("./0_location.js");
54
- const constants_js_1 = require("../constants.js");
55
- const d = (0, deps_js_1.debug)("types/Message");
26
+ const _1_sticker_js_1 = require("./1_sticker.js");
27
+ const _2_inline_keyboard_markup_js_1 = require("./2_inline_keyboard_markup.js");
28
+ const _2_reply_keyboard_markup_js_1 = require("./2_reply_keyboard_markup.js");
29
+ const _2_game_js_1 = require("./2_game.js");
30
+ const d = (0, _0_deps_js_1.debug)("types/Message");
56
31
  async function getSender(message_, getEntity) {
57
- if (message_.fromId instanceof types.PeerUser) {
32
+ if (message_.fromId instanceof _2_tl_js_1.types.PeerUser) {
58
33
  const entity = await getEntity(message_.fromId);
59
34
  if (entity) {
60
35
  return { from: (0, _1_user_js_1.constructUser)(entity) };
61
36
  }
62
37
  else {
63
- (0, _0_control_js_1.UNREACHABLE)();
38
+ (0, _1_utilities_js_1.UNREACHABLE)();
64
39
  }
65
40
  }
66
- else if (message_.fromId instanceof types.PeerChannel) {
41
+ else if (message_.fromId instanceof _2_tl_js_1.types.PeerChannel) {
67
42
  const entity = await getEntity(message_.fromId);
68
43
  if (entity) {
69
44
  return { senderChat: (0, _1_chat_js_1.constructChat)(entity) };
70
45
  }
71
46
  else {
72
- (0, _0_control_js_1.UNREACHABLE)();
47
+ (0, _1_utilities_js_1.UNREACHABLE)();
73
48
  }
74
49
  }
75
50
  }
76
51
  async function getReply(message_, chat, getMessage) {
77
- if (getMessage && message_.replyTo instanceof types.MessageReplyHeader) {
52
+ if (getMessage && message_.replyTo instanceof _2_tl_js_1.types.MessageReplyHeader) {
78
53
  let isTopicMessage = false;
79
54
  if (message_.replyTo.forumTopic) {
80
55
  isTopicMessage = true;
@@ -98,53 +73,53 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
98
73
  isTopicMessage: false,
99
74
  };
100
75
  Object.assign(message, await getSender(message_, getEntity));
101
- if (message_.action instanceof types.MessageActionChatAddUser) {
76
+ if (message_.action instanceof _2_tl_js_1.types.MessageActionChatAddUser) {
102
77
  message.newChatMembers = [];
103
78
  for (const user_ of message_.action.users) {
104
- const entity = await getEntity(new types.PeerUser({ userId: user_ }));
79
+ const entity = await getEntity(new _2_tl_js_1.types.PeerUser({ userId: user_ }));
105
80
  if (entity) {
106
81
  const user = (0, _1_user_js_1.constructUser)(entity);
107
82
  message.newChatMembers.push(user);
108
83
  }
109
84
  else {
110
- (0, _0_control_js_1.UNREACHABLE)();
85
+ (0, _1_utilities_js_1.UNREACHABLE)();
111
86
  }
112
87
  }
113
88
  }
114
- else if (message_.action instanceof types.MessageActionChatDeleteUser) {
115
- const entity = await getEntity(new types.PeerUser({ userId: message_.action.userId }));
89
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionChatDeleteUser) {
90
+ const entity = await getEntity(new _2_tl_js_1.types.PeerUser({ userId: message_.action.userId }));
116
91
  if (entity) {
117
92
  const user = (0, _1_user_js_1.constructUser)(entity);
118
93
  message.leftChatMember = user;
119
94
  }
120
95
  else {
121
- (0, _0_control_js_1.UNREACHABLE)();
96
+ (0, _1_utilities_js_1.UNREACHABLE)();
122
97
  }
123
98
  }
124
- else if (message_.action instanceof types.MessageActionChatEditTitle) {
99
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionChatEditTitle) {
125
100
  message.newChatTitle = message_.action.title;
126
101
  }
127
- else if (message_.action instanceof types.MessageActionChatEditPhoto) {
128
- message.newChatPhoto = (0, _1_photo_js_1.constructPhoto)(message_.action.photo[_1_tl_object_js_1.as](types.Photo));
102
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionChatEditPhoto) {
103
+ message.newChatPhoto = (0, _1_photo_js_1.constructPhoto)(message_.action.photo[_2_tl_js_1.as](_2_tl_js_1.types.Photo));
129
104
  }
130
- else if (message_.action instanceof types.MessageActionChatDeletePhoto) {
105
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionChatDeletePhoto) {
131
106
  message.deletedChatPhoto = true;
132
107
  }
133
- else if (message_.action instanceof types.MessageActionChatCreate) {
108
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionChatCreate) {
134
109
  message.groupCreated = true;
135
110
  message.newChatMembers = [];
136
111
  for (const user_ of message_.action.users) {
137
- const entity = await getEntity(new types.PeerUser({ userId: user_ }));
112
+ const entity = await getEntity(new _2_tl_js_1.types.PeerUser({ userId: user_ }));
138
113
  if (entity) {
139
114
  const user = (0, _1_user_js_1.constructUser)(entity);
140
115
  message.newChatMembers.push(user);
141
116
  }
142
117
  else {
143
- (0, _0_control_js_1.UNREACHABLE)();
118
+ (0, _1_utilities_js_1.UNREACHABLE)();
144
119
  }
145
120
  }
146
121
  }
147
- else if (message_.action instanceof types.MessageActionChannelCreate) {
122
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionChannelCreate) {
148
123
  if (message.chat.type == _1_chat_js_1.ChatType.Channel) {
149
124
  message.channelCreated = true;
150
125
  }
@@ -152,35 +127,35 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
152
127
  message.supergroupCreated = true;
153
128
  }
154
129
  else {
155
- (0, _0_control_js_1.UNREACHABLE)();
130
+ (0, _1_utilities_js_1.UNREACHABLE)();
156
131
  }
157
132
  }
158
- else if (message_.action instanceof types.MessageActionChatMigrateTo) {
159
- message.chatMigratedTo = constants_js_1.ZERO_CHANNEL_ID + Number(-message_.action.channelId);
133
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionChatMigrateTo) {
134
+ message.chatMigratedTo = _4_constants_js_1.ZERO_CHANNEL_ID + Number(-message_.action.channelId);
160
135
  }
161
- else if (message_.action instanceof types.MessageActionChannelMigrateFrom) {
136
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionChannelMigrateFrom) {
162
137
  message.chatMigratedFrom = Number(-message_.action.chatId);
163
138
  }
164
- else if (message_.action instanceof types.MessageActionPinMessage) {
139
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionPinMessage) {
165
140
  const { replyToMessage } = await getReply(message_, chat, getMessage);
166
141
  message.pinnedMessage = replyToMessage;
167
142
  }
168
- else if (message_.action instanceof types.MessageActionRequestedPeer) {
169
- const user = message_.action.peer[_1_tl_object_js_1.as](types.PeerUser);
143
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionRequestedPeer) {
144
+ const user = message_.action.peer[_2_tl_js_1.as](_2_tl_js_1.types.PeerUser);
170
145
  message.userShared = { requestId: message_.action.buttonId, userId: Number(user.userId) };
171
146
  }
172
- else if (message_.action instanceof types.MessageActionBotAllowed) {
173
- const webAppName = message_.action.app ? message_.action.app[_1_tl_object_js_1.as](types.BotApp).title : undefined;
147
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionBotAllowed) {
148
+ const webAppName = message_.action.app ? message_.action.app[_2_tl_js_1.as](_2_tl_js_1.types.BotApp).title : undefined;
174
149
  message.writeAccessAllowed = { webAppName };
175
150
  }
176
- else if (message_.action instanceof types.MessageActionTopicCreate) {
151
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionTopicCreate) {
177
152
  message.forumTopicCreated = {
178
153
  name: message_.action.title,
179
154
  iconColor: "#" + message_.action.iconColor.toString(16).padStart(6, "0"),
180
155
  iconCutsomEmojiId: message_.action.iconEmojiId ? String(message_.action.iconEmojiId) : undefined,
181
156
  };
182
157
  }
183
- else if (message_.action instanceof types.MessageActionTopicEdit) {
158
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionTopicEdit) {
184
159
  if (message_.action.closed) {
185
160
  message.forumTopicClosed = {};
186
161
  }
@@ -194,10 +169,10 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
194
169
  message.forumTopicReopened = {};
195
170
  }
196
171
  }
197
- else if (message_.action instanceof types.MessageActionGroupCallScheduled) {
172
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionGroupCallScheduled) {
198
173
  message.videoChatScheduled = { startDate: new Date(message_.action.scheduleDate * 1000) };
199
174
  }
200
- else if (message_.action instanceof types.MessageActionGroupCall) {
175
+ else if (message_.action instanceof _2_tl_js_1.types.MessageActionGroupCall) {
201
176
  if (message_.action.duration) {
202
177
  message.videoChatEnded = { duration: message_.action.duration };
203
178
  }
@@ -205,50 +180,53 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
205
180
  message.videoChatStarted = {};
206
181
  }
207
182
  }
208
- return (0, _0_object_js_1.cleanObject)(message);
183
+ return (0, _1_utilities_js_1.cleanObject)(message);
209
184
  }
210
185
  async function constructMessage(message_, getEntity, getMessage, getStickerSetName) {
211
- if (!(message_ instanceof types.Message) && !(message_ instanceof types.MessageService)) {
212
- (0, _0_control_js_1.UNREACHABLE)();
186
+ if (!(message_ instanceof _2_tl_js_1.types.Message) && !(message_ instanceof _2_tl_js_1.types.MessageService)) {
187
+ (0, _1_utilities_js_1.UNREACHABLE)();
213
188
  }
189
+ let link;
214
190
  let chat_ = null;
215
- if (message_.peerId instanceof types.PeerUser) {
191
+ if (message_.peerId instanceof _2_tl_js_1.types.PeerUser) {
216
192
  const entity = await getEntity(message_.peerId);
217
193
  if (entity) {
218
194
  chat_ = (0, _1_chat_js_1.constructChat)(entity);
219
195
  }
220
196
  else {
221
- (0, _0_control_js_1.UNREACHABLE)();
197
+ (0, _1_utilities_js_1.UNREACHABLE)();
222
198
  }
223
199
  }
224
- else if (message_.peerId instanceof types.PeerChat) {
200
+ else if (message_.peerId instanceof _2_tl_js_1.types.PeerChat) {
225
201
  const entity = await getEntity(message_.peerId);
226
202
  if (entity) {
227
203
  chat_ = (0, _1_chat_js_1.constructChat)(entity);
228
204
  }
229
205
  else {
230
- (0, _0_control_js_1.UNREACHABLE)();
206
+ (0, _1_utilities_js_1.UNREACHABLE)();
231
207
  }
232
208
  }
233
- else if (message_.peerId instanceof types.PeerChannel) {
209
+ else if (message_.peerId instanceof _2_tl_js_1.types.PeerChannel) {
210
+ link = `https://t.me/c/${message_.peerId.channelId}/${message_.id}`;
234
211
  const entity = await getEntity(message_.peerId);
235
212
  if (entity) {
236
213
  chat_ = (0, _1_chat_js_1.constructChat)(entity);
237
214
  }
238
215
  else {
239
- (0, _0_control_js_1.UNREACHABLE)();
216
+ (0, _1_utilities_js_1.UNREACHABLE)();
240
217
  }
241
218
  }
242
219
  else {
243
- (0, _0_control_js_1.UNREACHABLE)();
220
+ (0, _1_utilities_js_1.UNREACHABLE)();
244
221
  }
245
- if (message_ instanceof types.MessageService) {
222
+ if (message_ instanceof _2_tl_js_1.types.MessageService) {
246
223
  return await constructServiceMessage(message_, chat_, getEntity, getMessage);
247
224
  }
248
225
  const message = {
249
226
  out: message_.out ?? false,
250
227
  id: message_.id,
251
228
  chat: chat_,
229
+ link,
252
230
  date: new Date(message_.date * 1000),
253
231
  views: message_.views,
254
232
  isTopicMessage: false,
@@ -256,7 +234,7 @@ async function constructMessage(message_, getEntity, getMessage, getStickerSetNa
256
234
  };
257
235
  Object.assign(message, await getReply(message_, chat_, getMessage));
258
236
  Object.assign(message, await getSender(message_, getEntity));
259
- if (message_.media instanceof types.MessageMediaPhoto || message_.media instanceof types.MessageMediaDocument) {
237
+ if (message_.media instanceof _2_tl_js_1.types.MessageMediaPhoto || message_.media instanceof _2_tl_js_1.types.MessageMediaDocument) {
260
238
  message.hasMediaSpoiler = message_.media.spoiler || false;
261
239
  }
262
240
  if (message_.groupedId != undefined) {
@@ -282,91 +260,91 @@ async function constructMessage(message_, getEntity, getMessage, getStickerSetNa
282
260
  message.editDate = new Date(message_.editDate * 1000);
283
261
  }
284
262
  if (message_.replyMarkup) {
285
- if (message_.replyMarkup instanceof types.ReplyKeyboardMarkup) {
263
+ if (message_.replyMarkup instanceof _2_tl_js_1.types.ReplyKeyboardMarkup) {
286
264
  message.replyMarkup = (0, _2_reply_keyboard_markup_js_1.constructReplyKeyboardMarkup)(message_.replyMarkup);
287
265
  }
288
- else if (message_.replyMarkup instanceof types.ReplyInlineMarkup) {
266
+ else if (message_.replyMarkup instanceof _2_tl_js_1.types.ReplyInlineMarkup) {
289
267
  message.replyMarkup = (0, _2_inline_keyboard_markup_js_1.constructInlineKeyboardMarkup)(message_.replyMarkup);
290
268
  }
291
- else if (message_.replyMarkup instanceof types.ReplyKeyboardHide) {
269
+ else if (message_.replyMarkup instanceof _2_tl_js_1.types.ReplyKeyboardHide) {
292
270
  message.replyMarkup = (0, _0_reply_keyboard_remove_js_1.constructReplyKeyboardRemove)(message_.replyMarkup);
293
271
  }
294
- else if (message_.replyMarkup instanceof types.ReplyKeyboardForceReply) {
272
+ else if (message_.replyMarkup instanceof _2_tl_js_1.types.ReplyKeyboardForceReply) {
295
273
  message.replyMarkup = (0, _0_force_reply_js_1.constructForceReply)(message_.replyMarkup);
296
274
  }
297
275
  else {
298
- (0, _0_control_js_1.UNREACHABLE)();
276
+ (0, _1_utilities_js_1.UNREACHABLE)();
299
277
  }
300
278
  }
301
279
  if (message_.viaBotId != undefined) {
302
- const viaBot = await getEntity(new types.PeerUser({ userId: message_.viaBotId }));
280
+ const viaBot = await getEntity(new _2_tl_js_1.types.PeerUser({ userId: message_.viaBotId }));
303
281
  if (viaBot) {
304
282
  message.viaBot = (0, _1_user_js_1.constructUser)(viaBot);
305
283
  }
306
284
  else {
307
- (0, _0_control_js_1.UNREACHABLE)();
285
+ (0, _1_utilities_js_1.UNREACHABLE)();
308
286
  }
309
287
  }
310
288
  if (message_.postAuthor != undefined) {
311
289
  message.authorSignature = message_.postAuthor;
312
290
  }
313
- if (message_.fwdFrom instanceof types.MessageFwdHeader) {
291
+ if (message_.fwdFrom instanceof _2_tl_js_1.types.MessageFwdHeader) {
314
292
  message.isAutomaticForward = message_.fwdFrom.savedFromPeer != undefined && message_.fwdFrom.savedFromMsgId != undefined;
315
293
  message.forwardSenderName = message_.fwdFrom.fromName;
316
294
  message.forwardId = message_.fwdFrom.channelPost;
317
295
  message.forwardSignature = message_.fwdFrom.postAuthor;
318
296
  message.forwardDate = new Date(message_.date * 1000);
319
- if (message_.fwdFrom.fromId instanceof types.PeerUser) {
297
+ if (message_.fwdFrom.fromId instanceof _2_tl_js_1.types.PeerUser) {
320
298
  const entity = await getEntity(message_.fwdFrom.fromId);
321
299
  if (entity) {
322
300
  message.forwardFrom = (0, _1_user_js_1.constructUser)(entity);
323
301
  }
324
302
  else {
325
- (0, _0_control_js_1.UNREACHABLE)();
303
+ (0, _1_utilities_js_1.UNREACHABLE)();
326
304
  }
327
305
  }
328
- else if (message_.fwdFrom.fromId instanceof types.PeerChat) {
306
+ else if (message_.fwdFrom.fromId instanceof _2_tl_js_1.types.PeerChat) {
329
307
  const entity = await getEntity(message_.fwdFrom.fromId);
330
308
  if (entity) {
331
309
  message.forwardFromChat = (0, _1_chat_js_1.constructChat)(entity);
332
310
  }
333
311
  else {
334
- (0, _0_control_js_1.UNREACHABLE)();
312
+ (0, _1_utilities_js_1.UNREACHABLE)();
335
313
  }
336
314
  }
337
- else if (message_.fwdFrom.fromId instanceof types.PeerChannel) {
315
+ else if (message_.fwdFrom.fromId instanceof _2_tl_js_1.types.PeerChannel) {
338
316
  const entity = await getEntity(message_.fwdFrom.fromId);
339
317
  if (entity) {
340
318
  message.forwardFromChat = (0, _1_chat_js_1.constructChat)(entity);
341
319
  }
342
320
  else {
343
- (0, _0_control_js_1.UNREACHABLE)();
321
+ (0, _1_utilities_js_1.UNREACHABLE)();
344
322
  }
345
323
  }
346
324
  }
347
325
  if (message_.media) {
348
- if (message_.media instanceof types.MessageMediaPhoto) {
349
- if (message_.media.photo instanceof types.Photo) {
326
+ if (message_.media instanceof _2_tl_js_1.types.MessageMediaPhoto) {
327
+ if (message_.media.photo instanceof _2_tl_js_1.types.Photo) {
350
328
  message.photo = (0, _1_photo_js_1.constructPhoto)(message_.media.photo);
351
329
  }
352
330
  }
353
- else if (message_.media instanceof types.MessageMediaDice) {
331
+ else if (message_.media instanceof _2_tl_js_1.types.MessageMediaDice) {
354
332
  message.dice = (0, _0_dice_js_1.constructDice)(message_.media);
355
333
  }
356
- else if (message_.media instanceof types.MessageMediaDocument) {
334
+ else if (message_.media instanceof _2_tl_js_1.types.MessageMediaDocument) {
357
335
  const { document } = message_.media;
358
- if (document instanceof types.Document) {
336
+ if (document instanceof _2_tl_js_1.types.Document) {
359
337
  const getFileId = (type) => new _0_file_id_js_1.FileID(null, null, type, document.dcId, {
360
338
  mediaId: document.id,
361
339
  accessHash: document.accessHash,
362
340
  fileReference: document.fileReference,
363
341
  }).encode();
364
342
  const fileUniqueId = new _0_file_id_js_1.FileUniqueID(_0_file_id_js_1.FileUniqueType.Document, { mediaId: document.id }).encode();
365
- const animated = document.attributes.find((v) => v instanceof types.DocumentAttributeAnimated);
366
- const audio = document.attributes.find((v) => v instanceof types.DocumentAttributeAudio);
367
- const fileName = document.attributes.find((v) => v instanceof types.DocumentAttributeFilename);
368
- const sticker = document.attributes.find((v) => v instanceof types.DocumentAttributeSticker);
369
- const video = document.attributes.find((v) => v instanceof types.DocumentAttributeVideo);
343
+ const animated = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeAnimated);
344
+ const audio = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeAudio);
345
+ const fileName = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeFilename);
346
+ const sticker = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeSticker);
347
+ const video = document.attributes.find((v) => v instanceof _2_tl_js_1.types.DocumentAttributeVideo);
370
348
  if (animated) {
371
349
  message.animation = (0, _1_animation_js_1.constructAnimation)(document, video, fileName, getFileId(_0_file_id_js_1.FileType.Animation), fileUniqueId);
372
350
  }
@@ -393,33 +371,33 @@ async function constructMessage(message_, getEntity, getMessage, getStickerSetNa
393
371
  message.document = (0, _1_document_js_1.constructDocument)(document, fileName, getFileId(_0_file_id_js_1.FileType.Document), fileUniqueId);
394
372
  }
395
373
  else {
396
- (0, _0_control_js_1.UNREACHABLE)();
374
+ (0, _1_utilities_js_1.UNREACHABLE)();
397
375
  }
398
376
  }
399
377
  }
400
- else if (message_.media instanceof types.MessageMediaContact) {
378
+ else if (message_.media instanceof _2_tl_js_1.types.MessageMediaContact) {
401
379
  message.contact = (0, _0_contact_js_1.constructContact)(message_.media);
402
380
  }
403
- else if (message_.media instanceof types.MessageMediaGame) {
381
+ else if (message_.media instanceof _2_tl_js_1.types.MessageMediaGame) {
404
382
  message.game = (0, _2_game_js_1.constructGame)(message_.media);
405
383
  }
406
- else if (message_.media instanceof types.MessageMediaPoll) {
384
+ else if (message_.media instanceof _2_tl_js_1.types.MessageMediaPoll) {
407
385
  message.poll = (0, _1_poll_js_1.constructPoll)(message_.media);
408
386
  }
409
- else if (message_.media instanceof types.MessageMediaVenue) {
387
+ else if (message_.media instanceof _2_tl_js_1.types.MessageMediaVenue) {
410
388
  message.venue = (0, _0_venue_js_1.constructVenue)(message_.media);
411
389
  }
412
- else if (message_.media instanceof types.MessageMediaGeo || message_.media instanceof types.MessageMediaGeoLive) {
390
+ else if (message_.media instanceof _2_tl_js_1.types.MessageMediaGeo || message_.media instanceof _2_tl_js_1.types.MessageMediaGeoLive) {
413
391
  message.location = (0, _0_location_js_1.constructLocation)(message_.media);
414
392
  }
415
- else if (message_.media instanceof types.MessageMediaWebPage) {
393
+ else if (message_.media instanceof _2_tl_js_1.types.MessageMediaWebPage) {
416
394
  //
417
395
  }
418
396
  else {
419
397
  // not implemented
420
- (0, _0_control_js_1.UNREACHABLE)();
398
+ (0, _1_utilities_js_1.UNREACHABLE)();
421
399
  }
422
400
  }
423
- return (0, _0_object_js_1.cleanObject)(message);
401
+ return (0, _1_utilities_js_1.cleanObject)(message);
424
402
  }
425
403
  exports.constructMessage = constructMessage;
@@ -0,0 +1,14 @@
1
+ import { types } from "../2_tl.js";
2
+ import { EntityGetter } from "./!0_misc.js";
3
+ import { User } from "./1_user.js";
4
+ import { Message, MessageGetter } from "./3_message.js";
5
+ export interface CallbackQuery {
6
+ id: string;
7
+ from: User;
8
+ message?: Message;
9
+ inlineMessageId?: number;
10
+ chatInstance?: string;
11
+ data?: string;
12
+ gameShortName?: string;
13
+ }
14
+ export declare function constructCallbackQuery(callbackQuery: types.UpdateBotCallbackQuery | types.UpdateInlineBotCallbackQuery, getEntity: EntityGetter, getMessage: MessageGetter): Promise<CallbackQuery>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.constructCallbackQuery = void 0;
4
+ const _1_utilities_js_1 = require("../1_utilities.js");
5
+ const _2_tl_js_1 = require("../2_tl.js");
6
+ const _1_user_js_1 = require("./1_user.js");
7
+ async function constructCallbackQuery(callbackQuery, getEntity, getMessage) {
8
+ const user_ = await getEntity(new _2_tl_js_1.types.PeerUser({ userId: callbackQuery.userId }));
9
+ if (!user_) {
10
+ (0, _1_utilities_js_1.UNREACHABLE)();
11
+ }
12
+ const user = (0, _1_user_js_1.constructUser)(user_);
13
+ const id = String(callbackQuery.queryId);
14
+ const gameShortName = callbackQuery.gameShortName;
15
+ const data = callbackQuery.data !== undefined ? new TextDecoder().decode(callbackQuery.data) : undefined;
16
+ const chatInstance = callbackQuery.chatInstance == 0n ? "" : String(callbackQuery.chatInstance);
17
+ if (callbackQuery instanceof _2_tl_js_1.types.UpdateBotCallbackQuery) {
18
+ const message = await getMessage((0, _2_tl_js_1.peerToChatId)(callbackQuery.peer), Number(callbackQuery.msgId));
19
+ if (message == null) {
20
+ (0, _1_utilities_js_1.UNREACHABLE)();
21
+ }
22
+ return (0, _1_utilities_js_1.cleanObject)({ id, from: user, message, chatInstance, data, gameShortName });
23
+ }
24
+ else {
25
+ return (0, _1_utilities_js_1.cleanObject)({ id, from: user, inlineMessageId: Number(callbackQuery.msgId.id), chatInstance, data, gameShortName });
26
+ }
27
+ }
28
+ exports.constructCallbackQuery = constructCallbackQuery;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.base64DecodeUrlSafe = exports.base64EncodeUrlSafe = void 0;
4
- const deps_js_1 = require("../deps.js");
4
+ const _0_deps_js_1 = require("../0_deps.js");
5
5
  function base64EncodeUrlSafe(data) {
6
- return (0, deps_js_1.base64Encode)(data).replace(/=*$/, "").replaceAll("+", "-").replaceAll("/", "_");
6
+ return (0, _0_deps_js_1.base64Encode)(data).replace(/=*$/, "").replaceAll("+", "-").replaceAll("/", "_");
7
7
  }
8
8
  exports.base64EncodeUrlSafe = base64EncodeUrlSafe;
9
9
  function base64DecodeUrlSafe(data) {
@@ -11,6 +11,6 @@ function base64DecodeUrlSafe(data) {
11
11
  if (data.length != 4) {
12
12
  data += "=".repeat(4 - data.length % 4);
13
13
  }
14
- return (0, deps_js_1.base64Decode)(data);
14
+ return (0, _0_deps_js_1.base64Decode)(data);
15
15
  }
16
16
  exports.base64DecodeUrlSafe = base64DecodeUrlSafe;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CTR = void 0;
4
- const deps_js_1 = require("../deps.js");
4
+ const _0_deps_js_1 = require("../0_deps.js");
5
5
  class CTR {
6
6
  constructor(key, iv) {
7
7
  Object.defineProperty(this, "key", {
@@ -24,13 +24,13 @@ class CTR {
24
24
  });
25
25
  }
26
26
  encrypt(data) {
27
- const [encrypted, iv, state] = (0, deps_js_1.ctr256Encrypt)(data, this.key, this.iv, this.state);
27
+ const [encrypted, iv, state] = (0, _0_deps_js_1.ctr256Encrypt)(data, this.key, this.iv, this.state);
28
28
  this.iv = iv;
29
29
  this.state = state;
30
30
  return new Uint8Array(encrypted);
31
31
  }
32
32
  decrypt(data) {
33
- const [decrypted, iv, state] = (0, deps_js_1.ctr256Decrypt)(data, this.key, this.iv, this.state);
33
+ const [decrypted, iv, state] = (0, _0_deps_js_1.ctr256Decrypt)(data, this.key, this.iv, this.state);
34
34
  this.iv = iv;
35
35
  this.state = state;
36
36
  return new Uint8Array(decrypted);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Queue = void 0;
4
- const deps_js_1 = require("../deps.js");
4
+ const _0_deps_js_1 = require("../0_deps.js");
5
5
  class Queue {
6
6
  constructor(name) {
7
7
  Object.defineProperty(this, "d", {
@@ -22,7 +22,7 @@ class Queue {
22
22
  writable: true,
23
23
  value: false
24
24
  });
25
- this.d = (0, deps_js_1.debug)(`q/${name}`);
25
+ this.d = (0, _0_deps_js_1.debug)(`q/${name}`);
26
26
  }
27
27
  add(fn) {
28
28
  this.functions.push(fn);
@@ -25,12 +25,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.rsaPad = void 0;
27
27
  const dntShim = __importStar(require("../_dnt.shims.js"));
28
- const deps_js_1 = require("../deps.js");
28
+ const _0_deps_js_1 = require("../0_deps.js");
29
29
  const _0_bigint_js_1 = require("./0_bigint.js");
30
30
  const _0_buffer_js_1 = require("./0_buffer.js");
31
31
  const _0_hash_js_1 = require("./0_hash.js");
32
32
  async function rsaPad(data, [serverKey, exponent]) {
33
- (0, deps_js_1.assert)(data.length <= 144);
33
+ (0, _0_deps_js_1.assert)(data.length <= 144);
34
34
  let keyAesEncryptedInt;
35
35
  let tries = 0;
36
36
  do {
@@ -41,16 +41,16 @@ async function rsaPad(data, [serverKey, exponent]) {
41
41
  const dataPadReversed = new Uint8Array(dataWithPadding).reverse();
42
42
  const tempKey = dntShim.crypto.getRandomValues(new Uint8Array(32));
43
43
  const dataWithHash = (0, _0_buffer_js_1.concat)(dataPadReversed, await (0, _0_hash_js_1.sha256)((0, _0_buffer_js_1.concat)(tempKey, dataWithPadding)));
44
- const aesEncrypted = (0, deps_js_1.ige256Encrypt)(dataWithHash, tempKey, new Uint8Array(32));
44
+ const aesEncrypted = (0, _0_deps_js_1.ige256Encrypt)(dataWithHash, tempKey, new Uint8Array(32));
45
45
  const aesEncryptedSha256 = await (0, _0_hash_js_1.sha256)(aesEncrypted);
46
46
  const tempKeyXor = tempKey.map((v, i) => v ^ aesEncryptedSha256[i]);
47
47
  const keyAesEncrypted = (0, _0_buffer_js_1.concat)(tempKeyXor, aesEncrypted);
48
- (0, deps_js_1.assertEquals)(keyAesEncrypted.length, 256);
48
+ (0, _0_deps_js_1.assertEquals)(keyAesEncrypted.length, 256);
49
49
  keyAesEncryptedInt = (0, _0_bigint_js_1.bigIntFromBuffer)(keyAesEncrypted, false, false);
50
50
  } while (keyAesEncryptedInt >= serverKey);
51
51
  const encryptedDataInt = (0, _0_bigint_js_1.modExp)(keyAesEncryptedInt, exponent, serverKey);
52
52
  const encryptedData = (0, _0_buffer_js_1.bufferFromBigInt)(encryptedDataInt, 256, false, false);
53
- (0, deps_js_1.assertEquals)(encryptedData.length, 256);
53
+ (0, _0_deps_js_1.assertEquals)(encryptedData.length, 256);
54
54
  return encryptedData;
55
55
  }
56
56
  exports.rsaPad = rsaPad;
@@ -1 +0,0 @@
1
- export declare function getIdColor(id: number): string;
@@ -1,16 +0,0 @@
1
- const colors = [
2
- "#ff5a2b",
3
- "#ffa92b",
4
- "#b364f1",
5
- "#30dc53",
6
- "#30dcc2",
7
- "#309cdc",
8
- "#e52eb1", // pink
9
- ];
10
- export function getIdColor(id) {
11
- id = Number(String(id).replaceAll("-100", "-"));
12
- if (id < 0) {
13
- id = -id;
14
- }
15
- return colors[id % 7];
16
- }
@@ -1 +0,0 @@
1
- export declare function getIdColor(id: number): string;
File without changes
File without changes
File without changes
File without changes