@mtkruto/node 0.147.0 → 0.150.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 (285) hide show
  1. package/esm/0_deps.d.ts +8 -8
  2. package/esm/0_deps.js +8 -8
  3. package/esm/3_types.d.ts +3 -0
  4. package/esm/3_types.d.ts.map +1 -1
  5. package/esm/3_types.js +3 -0
  6. package/esm/client/0_params.d.ts +8 -0
  7. package/esm/client/0_params.d.ts.map +1 -1
  8. package/esm/client/0_utilities.d.ts +1 -1
  9. package/esm/client/0_utilities.d.ts.map +1 -1
  10. package/esm/client/1_client_generic.d.ts +20 -2
  11. package/esm/client/1_client_generic.d.ts.map +1 -1
  12. package/esm/client/3_filters.d.ts.map +1 -1
  13. package/esm/client/3_filters.js +4 -1
  14. package/esm/client/3_message_manager.d.ts +4 -2
  15. package/esm/client/3_message_manager.d.ts.map +1 -1
  16. package/esm/client/3_message_manager.js +85 -1
  17. package/esm/client/6_client.d.ts +20 -2
  18. package/esm/client/6_client.d.ts.map +1 -1
  19. package/esm/client/6_client.js +22 -0
  20. package/esm/client/6_client_dispatcher.d.ts +20 -2
  21. package/esm/client/6_client_dispatcher.d.ts.map +1 -1
  22. package/esm/client/6_client_dispatcher.js +22 -0
  23. package/{script/deps/jsr.io/@std/async/1.3.0 → esm/deps/jsr.io/@std/async/1.4.0}/delay.d.ts.map +1 -1
  24. package/esm/deps/jsr.io/@std/async/{1.3.0 → 1.4.0}/pool.d.ts.map +1 -1
  25. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/assert_path.d.ts.map +1 -1
  26. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/assert_path.js +1 -1
  27. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/basename.d.ts.map +1 -1
  28. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/basename.js +1 -1
  29. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/constants.d.ts.map +1 -1
  30. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/constants.js +1 -1
  31. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/from_file_url.d.ts.map +1 -1
  32. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/from_file_url.js +1 -1
  33. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize.d.ts.map +1 -1
  34. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize.js +1 -1
  35. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize_string.d.ts.map +1 -1
  36. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize_string.js +1 -1
  37. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/strip_trailing_separators.d.ts.map +1 -1
  38. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/strip_trailing_separators.js +1 -1
  39. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/to_file_url.d.ts.map +1 -1
  40. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/to_file_url.js +1 -1
  41. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/basename.d.ts +4 -1
  42. package/esm/deps/jsr.io/@std/path/1.1.5/basename.d.ts.map +1 -0
  43. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/basename.js +5 -2
  44. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/extname.d.ts +4 -1
  45. package/esm/deps/jsr.io/@std/path/1.1.5/extname.d.ts.map +1 -0
  46. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/extname.js +5 -2
  47. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/is_absolute.d.ts.map +1 -1
  48. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/is_absolute.js +1 -1
  49. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/join.d.ts.map +1 -1
  50. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/join.js +1 -1
  51. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/_util.d.ts.map +1 -1
  52. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/_util.js +1 -1
  53. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/posix/basename.d.ts +5 -0
  54. package/esm/deps/jsr.io/@std/path/1.1.5/posix/basename.d.ts.map +1 -0
  55. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/basename.js +6 -1
  56. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/posix/extname.d.ts +5 -0
  57. package/esm/deps/jsr.io/@std/path/1.1.5/posix/extname.d.ts.map +1 -0
  58. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/extname.js +6 -1
  59. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/from_file_url.d.ts.map +1 -1
  60. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/from_file_url.js +1 -1
  61. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/is_absolute.d.ts.map +1 -1
  62. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/is_absolute.js +1 -1
  63. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/posix/join.d.ts.map +1 -1
  64. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/join.js +1 -1
  65. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/posix/normalize.d.ts.map +1 -1
  66. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/normalize.js +1 -1
  67. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/posix/to_file_url.d.ts.map +1 -1
  68. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/to_file_url.js +1 -1
  69. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/to_file_url.d.ts.map +1 -1
  70. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/to_file_url.js +1 -1
  71. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/_util.d.ts.map +1 -1
  72. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/_util.js +1 -1
  73. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/basename.d.ts +1 -0
  74. package/esm/deps/jsr.io/@std/path/1.1.5/windows/basename.d.ts.map +1 -0
  75. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/basename.js +2 -1
  76. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/windows/extname.d.ts +1 -0
  77. package/esm/deps/jsr.io/@std/path/1.1.5/windows/extname.d.ts.map +1 -0
  78. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/extname.js +2 -1
  79. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/windows/from_file_url.d.ts.map +1 -1
  80. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/from_file_url.js +1 -1
  81. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/windows/is_absolute.d.ts.map +1 -1
  82. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/is_absolute.js +1 -1
  83. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/windows/join.d.ts.map +1 -1
  84. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/join.js +1 -1
  85. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/windows/normalize.d.ts.map +1 -1
  86. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/normalize.js +1 -1
  87. package/{script/deps/jsr.io/@std/path/1.1.4 → esm/deps/jsr.io/@std/path/1.1.5}/windows/to_file_url.d.ts.map +1 -1
  88. package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/to_file_url.js +1 -1
  89. package/esm/deps/jsr.io/@std/streams/{1.1.0 → 1.1.1}/to_array_buffer.d.ts.map +1 -1
  90. package/esm/tl/1_telegram_api.d.ts +444 -11
  91. package/esm/tl/1_telegram_api.d.ts.map +1 -1
  92. package/esm/tl/1_telegram_api.js +554 -33
  93. package/esm/types/2_message_entity.d.ts +16 -0
  94. package/esm/types/2_message_entity.d.ts.map +1 -1
  95. package/esm/types/2_message_entity.js +51 -45
  96. package/esm/types/3_rich_text_component.d.ts +268 -0
  97. package/esm/types/3_rich_text_component.d.ts.map +1 -0
  98. package/esm/types/3_rich_text_component.js +161 -0
  99. package/esm/types/4_page_block.d.ts +479 -0
  100. package/esm/types/4_page_block.d.ts.map +1 -0
  101. package/esm/types/4_page_block.js +552 -0
  102. package/esm/types/5_input_rich_text.d.ts +38 -0
  103. package/esm/types/5_input_rich_text.d.ts.map +1 -0
  104. package/esm/types/5_input_rich_text.js +20 -0
  105. package/esm/types/6_message.d.ts +20 -1
  106. package/esm/types/6_message.d.ts.map +1 -1
  107. package/esm/types/6_message.js +32 -2
  108. package/package.json +1 -1
  109. package/script/0_deps.d.ts +8 -8
  110. package/script/0_deps.js +8 -8
  111. package/script/3_types.d.ts +3 -0
  112. package/script/3_types.d.ts.map +1 -1
  113. package/script/3_types.js +3 -0
  114. package/script/client/0_params.d.ts +8 -0
  115. package/script/client/0_params.d.ts.map +1 -1
  116. package/script/client/0_utilities.d.ts +1 -1
  117. package/script/client/0_utilities.d.ts.map +1 -1
  118. package/script/client/1_client_generic.d.ts +20 -2
  119. package/script/client/1_client_generic.d.ts.map +1 -1
  120. package/script/client/3_filters.d.ts.map +1 -1
  121. package/script/client/3_filters.js +4 -1
  122. package/script/client/3_message_manager.d.ts +4 -2
  123. package/script/client/3_message_manager.d.ts.map +1 -1
  124. package/script/client/3_message_manager.js +84 -0
  125. package/script/client/6_client.d.ts +20 -2
  126. package/script/client/6_client.d.ts.map +1 -1
  127. package/script/client/6_client.js +22 -0
  128. package/script/client/6_client_dispatcher.d.ts +20 -2
  129. package/script/client/6_client_dispatcher.d.ts.map +1 -1
  130. package/script/client/6_client_dispatcher.js +22 -0
  131. package/{esm/deps/jsr.io/@std/async/1.3.0 → script/deps/jsr.io/@std/async/1.4.0}/delay.d.ts.map +1 -1
  132. package/script/deps/jsr.io/@std/async/{1.3.0 → 1.4.0}/pool.d.ts.map +1 -1
  133. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/assert_path.d.ts.map +1 -1
  134. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/assert_path.js +1 -1
  135. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/basename.d.ts.map +1 -1
  136. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/basename.js +1 -1
  137. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/constants.d.ts.map +1 -1
  138. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/constants.js +1 -1
  139. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/from_file_url.d.ts.map +1 -1
  140. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/from_file_url.js +1 -1
  141. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize.d.ts.map +1 -1
  142. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize.js +1 -1
  143. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize_string.d.ts.map +1 -1
  144. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize_string.js +1 -1
  145. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/strip_trailing_separators.d.ts.map +1 -1
  146. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/strip_trailing_separators.js +1 -1
  147. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/to_file_url.d.ts.map +1 -1
  148. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/to_file_url.js +1 -1
  149. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/basename.d.ts +4 -1
  150. package/script/deps/jsr.io/@std/path/1.1.5/basename.d.ts.map +1 -0
  151. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/basename.js +5 -2
  152. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/extname.d.ts +4 -1
  153. package/script/deps/jsr.io/@std/path/1.1.5/extname.d.ts.map +1 -0
  154. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/extname.js +5 -2
  155. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/is_absolute.d.ts.map +1 -1
  156. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/is_absolute.js +1 -1
  157. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/join.d.ts.map +1 -1
  158. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/join.js +1 -1
  159. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/_util.d.ts.map +1 -1
  160. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/_util.js +1 -1
  161. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/posix/basename.d.ts +5 -0
  162. package/script/deps/jsr.io/@std/path/1.1.5/posix/basename.d.ts.map +1 -0
  163. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/basename.js +6 -1
  164. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/posix/extname.d.ts +5 -0
  165. package/script/deps/jsr.io/@std/path/1.1.5/posix/extname.d.ts.map +1 -0
  166. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/extname.js +6 -1
  167. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/from_file_url.d.ts.map +1 -1
  168. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/from_file_url.js +1 -1
  169. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/is_absolute.d.ts.map +1 -1
  170. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/is_absolute.js +1 -1
  171. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/posix/join.d.ts.map +1 -1
  172. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/join.js +1 -1
  173. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/posix/normalize.d.ts.map +1 -1
  174. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/normalize.js +1 -1
  175. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/posix/to_file_url.d.ts.map +1 -1
  176. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/to_file_url.js +1 -1
  177. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/to_file_url.d.ts.map +1 -1
  178. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/to_file_url.js +1 -1
  179. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/_util.d.ts.map +1 -1
  180. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/_util.js +1 -1
  181. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/basename.d.ts +1 -0
  182. package/script/deps/jsr.io/@std/path/1.1.5/windows/basename.d.ts.map +1 -0
  183. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/basename.js +2 -1
  184. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/windows/extname.d.ts +1 -0
  185. package/script/deps/jsr.io/@std/path/1.1.5/windows/extname.d.ts.map +1 -0
  186. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/extname.js +2 -1
  187. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/windows/from_file_url.d.ts.map +1 -1
  188. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/from_file_url.js +1 -1
  189. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/windows/is_absolute.d.ts.map +1 -1
  190. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/is_absolute.js +1 -1
  191. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/windows/join.d.ts.map +1 -1
  192. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/join.js +1 -1
  193. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/windows/normalize.d.ts.map +1 -1
  194. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/normalize.js +1 -1
  195. package/{esm/deps/jsr.io/@std/path/1.1.4 → script/deps/jsr.io/@std/path/1.1.5}/windows/to_file_url.d.ts.map +1 -1
  196. package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/to_file_url.js +1 -1
  197. package/script/deps/jsr.io/@std/streams/{1.1.0 → 1.1.1}/to_array_buffer.d.ts.map +1 -1
  198. package/script/tl/1_telegram_api.d.ts +444 -11
  199. package/script/tl/1_telegram_api.d.ts.map +1 -1
  200. package/script/tl/1_telegram_api.js +554 -33
  201. package/script/types/2_message_entity.d.ts +16 -0
  202. package/script/types/2_message_entity.d.ts.map +1 -1
  203. package/script/types/2_message_entity.js +53 -45
  204. package/script/types/3_rich_text_component.d.ts +268 -0
  205. package/script/types/3_rich_text_component.d.ts.map +1 -0
  206. package/script/types/3_rich_text_component.js +165 -0
  207. package/script/types/4_page_block.d.ts +479 -0
  208. package/script/types/4_page_block.d.ts.map +1 -0
  209. package/script/types/4_page_block.js +569 -0
  210. package/script/types/5_input_rich_text.d.ts +38 -0
  211. package/script/types/5_input_rich_text.d.ts.map +1 -0
  212. package/script/types/5_input_rich_text.js +21 -0
  213. package/script/types/6_message.d.ts +20 -1
  214. package/script/types/6_message.d.ts.map +1 -1
  215. package/script/types/6_message.js +32 -2
  216. package/esm/deps/jsr.io/@std/path/1.1.4/basename.d.ts.map +0 -1
  217. package/esm/deps/jsr.io/@std/path/1.1.4/extname.d.ts.map +0 -1
  218. package/esm/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts.map +0 -1
  219. package/esm/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts.map +0 -1
  220. package/esm/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts.map +0 -1
  221. package/esm/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts.map +0 -1
  222. package/script/deps/jsr.io/@std/path/1.1.4/basename.d.ts.map +0 -1
  223. package/script/deps/jsr.io/@std/path/1.1.4/extname.d.ts.map +0 -1
  224. package/script/deps/jsr.io/@std/path/1.1.4/posix/basename.d.ts.map +0 -1
  225. package/script/deps/jsr.io/@std/path/1.1.4/posix/extname.d.ts.map +0 -1
  226. package/script/deps/jsr.io/@std/path/1.1.4/windows/basename.d.ts.map +0 -1
  227. package/script/deps/jsr.io/@std/path/1.1.4/windows/extname.d.ts.map +0 -1
  228. /package/esm/deps/jsr.io/@std/async/{1.3.0 → 1.4.0}/delay.d.ts +0 -0
  229. /package/esm/deps/jsr.io/@std/async/{1.3.0 → 1.4.0}/delay.js +0 -0
  230. /package/esm/deps/jsr.io/@std/async/{1.3.0 → 1.4.0}/pool.d.ts +0 -0
  231. /package/esm/deps/jsr.io/@std/async/{1.3.0 → 1.4.0}/pool.js +0 -0
  232. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/assert_path.d.ts +0 -0
  233. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/basename.d.ts +0 -0
  234. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/constants.d.ts +0 -0
  235. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/from_file_url.d.ts +0 -0
  236. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize.d.ts +0 -0
  237. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize_string.d.ts +0 -0
  238. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/strip_trailing_separators.d.ts +0 -0
  239. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/to_file_url.d.ts +0 -0
  240. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/is_absolute.d.ts +0 -0
  241. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/join.d.ts +0 -0
  242. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/_util.d.ts +0 -0
  243. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/from_file_url.d.ts +0 -0
  244. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/is_absolute.d.ts +0 -0
  245. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/join.d.ts +0 -0
  246. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/normalize.d.ts +0 -0
  247. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/to_file_url.d.ts +0 -0
  248. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/to_file_url.d.ts +0 -0
  249. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/_util.d.ts +0 -0
  250. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/from_file_url.d.ts +0 -0
  251. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/is_absolute.d.ts +0 -0
  252. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/join.d.ts +0 -0
  253. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/normalize.d.ts +0 -0
  254. /package/esm/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/to_file_url.d.ts +0 -0
  255. /package/esm/deps/jsr.io/@std/streams/{1.1.0 → 1.1.1}/to_array_buffer.d.ts +0 -0
  256. /package/esm/deps/jsr.io/@std/streams/{1.1.0 → 1.1.1}/to_array_buffer.js +0 -0
  257. /package/script/deps/jsr.io/@std/async/{1.3.0 → 1.4.0}/delay.d.ts +0 -0
  258. /package/script/deps/jsr.io/@std/async/{1.3.0 → 1.4.0}/delay.js +0 -0
  259. /package/script/deps/jsr.io/@std/async/{1.3.0 → 1.4.0}/pool.d.ts +0 -0
  260. /package/script/deps/jsr.io/@std/async/{1.3.0 → 1.4.0}/pool.js +0 -0
  261. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/assert_path.d.ts +0 -0
  262. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/basename.d.ts +0 -0
  263. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/constants.d.ts +0 -0
  264. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/from_file_url.d.ts +0 -0
  265. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize.d.ts +0 -0
  266. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/normalize_string.d.ts +0 -0
  267. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/strip_trailing_separators.d.ts +0 -0
  268. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/_common/to_file_url.d.ts +0 -0
  269. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/is_absolute.d.ts +0 -0
  270. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/join.d.ts +0 -0
  271. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/_util.d.ts +0 -0
  272. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/from_file_url.d.ts +0 -0
  273. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/is_absolute.d.ts +0 -0
  274. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/join.d.ts +0 -0
  275. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/normalize.d.ts +0 -0
  276. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/posix/to_file_url.d.ts +0 -0
  277. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/to_file_url.d.ts +0 -0
  278. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/_util.d.ts +0 -0
  279. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/from_file_url.d.ts +0 -0
  280. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/is_absolute.d.ts +0 -0
  281. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/join.d.ts +0 -0
  282. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/normalize.d.ts +0 -0
  283. /package/script/deps/jsr.io/@std/path/{1.1.4 → 1.1.5}/windows/to_file_url.d.ts +0 -0
  284. /package/script/deps/jsr.io/@std/streams/{1.1.0 → 1.1.1}/to_array_buffer.d.ts +0 -0
  285. /package/script/deps/jsr.io/@std/streams/{1.1.0 → 1.1.1}/to_array_buffer.js +0 -0
@@ -0,0 +1,552 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2026 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+ import { unreachable } from "../0_deps.js";
21
+ import { cleanObject } from "../1_utilities.js";
22
+ import { Api } from "../2_tl.js";
23
+ import { deserializeFileId, FileType, serializeFileId } from "./_file_id.js";
24
+ import { constructLocation } from "./0_location.js";
25
+ import { constructChatP } from "./1_chat_p.js";
26
+ import { constructPhoto } from "./1_photo.js";
27
+ import { constructRichTextComponent, richTextComponentToTlObject } from "./3_rich_text_component.js";
28
+ export function constructPageBlockListItem(pli, photos, documents) {
29
+ switch (pli._) {
30
+ case "pageListItemText":
31
+ return { type: "text", isCheckbox: !!pli.checkbox, isChecked: !!pli.checked, text: constructRichTextComponent(pli.text, photos) };
32
+ case "pageListItemBlocks":
33
+ return { type: "blockList", isCheckbox: !!pli.checkbox, isChecked: !!pli.checked, blocks: pli.blocks.map((v) => constructPageBlock(v, photos, documents)) };
34
+ }
35
+ }
36
+ export function pageBlockListItemToTlObject(pbli) {
37
+ switch (pbli.type) {
38
+ case "text":
39
+ return { _: "pageListItemText", checkbox: pbli.isCheckbox || undefined, checked: pbli.isChecked || undefined, text: richTextComponentToTlObject(pbli.text) };
40
+ case "blockList":
41
+ return { _: "pageListItemBlocks", checkbox: pbli.isCheckbox || undefined, checked: pbli.isChecked || undefined, blocks: pbli.blocks.map(pageBlockToTlObject) };
42
+ }
43
+ }
44
+ export function constructPageBlockCaption(pc, photos) {
45
+ return {
46
+ text: constructRichTextComponent(pc.text, photos),
47
+ credit: constructRichTextComponent(pc.credit, photos),
48
+ };
49
+ }
50
+ export function pageBlockCaptionToTlObject(pbc) {
51
+ return {
52
+ _: "pageCaption",
53
+ text: richTextComponentToTlObject(pbc.text),
54
+ credit: richTextComponentToTlObject(pbc.credit),
55
+ };
56
+ }
57
+ export function constructPageBlockTableCell(ptc, photos) {
58
+ return cleanObject({
59
+ isHeader: !!ptc.header,
60
+ isCenterAligned: !!ptc.align_center,
61
+ isRightAligned: !!ptc.align_right,
62
+ isMiddleVerticallyAligned: !!ptc.valign_middle,
63
+ isBottomVerticallyAligned: !!ptc.valign_bottom,
64
+ text: ptc.text ? constructRichTextComponent(ptc.text, photos) : undefined,
65
+ colspan: ptc.colspan,
66
+ rowspan: ptc.rowspan,
67
+ });
68
+ }
69
+ export function pageBlockTableCellToTlObject(pbtc) {
70
+ return {
71
+ _: "pageTableCell",
72
+ header: pbtc.isHeader || undefined,
73
+ align_center: pbtc.isCenterAligned || undefined,
74
+ align_right: pbtc.isRightAligned || undefined,
75
+ valign_middle: pbtc.isMiddleVerticallyAligned || undefined,
76
+ valign_bottom: pbtc.isBottomVerticallyAligned || undefined,
77
+ text: pbtc.text ? richTextComponentToTlObject(pbtc.text) : undefined,
78
+ colspan: pbtc.colspan,
79
+ rowspan: pbtc.rowspan,
80
+ };
81
+ }
82
+ export function constructPageBlockTableRow(ptr, photos) {
83
+ return {
84
+ cells: ptr.cells.map((v) => constructPageBlockTableCell(v, photos)),
85
+ };
86
+ }
87
+ export function pageBlockTableRowToTlObject(pbtr) {
88
+ return {
89
+ _: "pageTableRow",
90
+ cells: pbtr.cells.map(pageBlockTableCellToTlObject),
91
+ };
92
+ }
93
+ export function constructPageBlockOrderedListItem(ploi, photos, documents) {
94
+ switch (ploi._) {
95
+ case "pageListOrderedItemText":
96
+ return cleanObject({ type: "text", isCheckbox: !!ploi.checkbox, isChecked: !!ploi.checked, number: ploi.num, value: ploi.value, itemType: ploi.type, text: constructRichTextComponent(ploi.text, photos) });
97
+ case "pageListOrderedItemBlocks":
98
+ return cleanObject({ type: "blockList", isCheckbox: !!ploi.checkbox, isChecked: !!ploi.checked, number: ploi.num, value: ploi.value, itemType: ploi.type, blocks: ploi.blocks.map((v) => constructPageBlock(v, photos, documents)) });
99
+ }
100
+ unreachable();
101
+ }
102
+ export function pageBlockOrderedListItemToTlObject(pboli) {
103
+ switch (pboli.type) {
104
+ case "text":
105
+ return { _: "pageListOrderedItemText", checkbox: pboli.isCheckbox || undefined, checked: pboli.isCheckbox || undefined, text: richTextComponentToTlObject(pboli.text), num: pboli.number, type: pboli.itemType, value: pboli.value };
106
+ case "blockList":
107
+ return { _: "pageListOrderedItemBlocks", checkbox: pboli.isCheckbox || undefined, checked: pboli.isCheckbox || undefined, blocks: pboli.blocks.map(pageBlockToTlObject), num: pboli.number, type: pboli.itemType, value: pboli.value };
108
+ }
109
+ }
110
+ export function constructPageBlockRelatedArticle(pra) {
111
+ return cleanObject({
112
+ url: pra.url,
113
+ linkPreviewId: String(pra.webpage_id),
114
+ title: pra.title,
115
+ description: pra.description,
116
+ photoId: pra.photo_id ? String(pra.photo_id) : undefined,
117
+ author: pra.author,
118
+ date: pra.published_date,
119
+ });
120
+ }
121
+ export function pageBlockRelatedArticleToTlObject(pbra) {
122
+ return { _: "pageRelatedArticle", url: pbra.url, webpage_id: BigInt(pbra.linkPreviewId), title: pbra.title, description: pbra.description, photo_id: pbra.photoId ? BigInt(pbra.photoId) : undefined, author: pbra.author, published_date: pbra.date };
123
+ }
124
+ export function constructPageBlock(pb, photos, documents) {
125
+ switch (pb._) {
126
+ case "pageBlockUnsupported":
127
+ return { type: "unsupported" };
128
+ case "pageBlockTitle":
129
+ return { type: "title", text: constructRichTextComponent(pb.text, photos) };
130
+ case "pageBlockSubtitle":
131
+ return { type: "subtitle", text: constructRichTextComponent(pb.text, photos) };
132
+ case "pageBlockAuthorDate":
133
+ return { type: "authorDate", author: constructRichTextComponent(pb.author, photos), date: pb.published_date };
134
+ case "pageBlockHeader":
135
+ return { type: "header", text: constructRichTextComponent(pb.text, photos) };
136
+ case "pageBlockSubheader":
137
+ return { type: "subheader", text: constructRichTextComponent(pb.text, photos) };
138
+ case "pageBlockParagraph":
139
+ return { type: "paragraph", text: constructRichTextComponent(pb.text, photos) };
140
+ case "pageBlockPreformatted":
141
+ return cleanObject({ type: "pre", text: constructRichTextComponent(pb.text, photos), language: pb.language || undefined });
142
+ case "pageBlockFooter":
143
+ return { type: "footer", text: constructRichTextComponent(pb.text, photos) };
144
+ case "pageBlockDivider":
145
+ return { type: "divider" };
146
+ case "pageBlockAnchor":
147
+ return { type: "anchor", name: pb.name };
148
+ case "pageBlockList":
149
+ return { type: "list", items: pb.items.map((v) => constructPageBlockListItem(v, photos, documents)) };
150
+ case "pageBlockBlockquote":
151
+ return { type: "blockQuote", text: constructRichTextComponent(pb.text, photos), caption: constructRichTextComponent(pb.caption, photos) };
152
+ case "pageBlockPullquote":
153
+ return { type: "blockQuote", text: constructRichTextComponent(pb.text, photos), caption: constructRichTextComponent(pb.caption, photos) };
154
+ case "pageBlockPhoto": {
155
+ const fileId = constructPhoto(Api.as("photo", photos.find((v) => v.id === pb.photo_id))).fileId;
156
+ return cleanObject({ type: "photo", fileId, caption: constructPageBlockCaption(pb.caption, photos), isSpoiler: !!pb.spoiler, linkPreviewId: pb.webpage_id ? String(pb.webpage_id) : undefined, url: pb.url });
157
+ }
158
+ case "pageBlockVideo": {
159
+ const document = Api.as("document", documents.find((v) => v.id === pb.video_id));
160
+ const isAnimated = !!document.attributes.find((v) => Api.is("documentAttributeAnimated", v));
161
+ const fileId = {
162
+ type: FileType.Video,
163
+ dcId: document.dc_id,
164
+ location: { type: "common", id: document.id, accessHash: document.access_hash },
165
+ fileReference: document.file_reference,
166
+ };
167
+ return { type: isAnimated ? "animation" : "video", fileId: serializeFileId(fileId), caption: constructPageBlockCaption(pb.caption, photos), isSpoiler: !!pb.spoiler, isAutoplay: !!pb.autoplay, isLoop: !!pb.loop };
168
+ }
169
+ case "pageBlockCover":
170
+ return { type: "cover", cover: constructPageBlock(pb.cover, photos, documents) };
171
+ case "pageBlockEmbed":
172
+ return cleanObject({ type: "embed", caption: constructPageBlockCaption(pb.caption, photos), isFullWidth: !!pb.full_width, isScrollingAllowed: !!pb.allow_scrolling, width: pb.w, height: pb.h, html: pb.html, url: pb.url, posterPhotoId: pb.poster_photo_id ? String(pb.poster_photo_id) : undefined });
173
+ case "pageBlockEmbedPost":
174
+ return cleanObject({ type: "embedPost", caption: constructPageBlockCaption(pb.caption, photos), author: pb.author, authorPhotoId: String(pb.author_photo_id), blocks: pb.blocks.map((v) => constructPageBlock(v, photos, documents)), date: pb.date, linkPreviewId: String(pb.webpage_id), url: pb.url });
175
+ case "pageBlockCollage":
176
+ return cleanObject({ type: "collage", caption: constructPageBlockCaption(pb.caption, photos), items: pb.items.map((v) => constructPageBlock(v, photos, documents)) });
177
+ case "pageBlockSlideshow":
178
+ return cleanObject({ type: "slideshow", caption: constructPageBlockCaption(pb.caption, photos), items: pb.items.map((v) => constructPageBlock(v, photos, documents)) });
179
+ case "pageBlockChannel":
180
+ return cleanObject({ type: "channel", chat: constructChatP(pb.channel) });
181
+ case "pageBlockAudio": {
182
+ const document = Api.as("document", documents.find((v) => v.id === pb.audio_id));
183
+ const audioAttribute = document.attributes.find((v) => Api.is("documentAttributeAudio", v));
184
+ if (!audioAttribute) {
185
+ unreachable();
186
+ }
187
+ const fileId = {
188
+ type: FileType.Video,
189
+ dcId: document.dc_id,
190
+ location: { type: "common", id: document.id, accessHash: document.access_hash },
191
+ fileReference: document.file_reference,
192
+ };
193
+ return cleanObject({ type: audioAttribute.voice ? "voice" : "audio", fileId: serializeFileId(fileId), caption: constructPageBlockCaption(pb.caption, photos) });
194
+ }
195
+ case "pageBlockKicker":
196
+ return cleanObject({ type: "kicker", text: constructRichTextComponent(pb.text, photos) });
197
+ case "pageBlockTable":
198
+ return cleanObject({ type: "table", isBordered: !!pb.bordered, isStriped: !!pb.striped, title: constructRichTextComponent(pb.title, photos), rows: pb.rows.map((v) => constructPageBlockTableRow(v, photos)) });
199
+ case "pageBlockOrderedList":
200
+ return cleanObject({
201
+ type: "orderedList",
202
+ isReversed: !!pb.reversed,
203
+ items: pb.items.map((v) => constructPageBlockOrderedListItem(v, photos, documents)),
204
+ itemsType: pb.type,
205
+ start: pb.start,
206
+ });
207
+ case "pageBlockDetails":
208
+ return { type: "details", isOpen: !!pb.open, title: constructRichTextComponent(pb.title, photos), blocks: pb.blocks.map((v) => constructPageBlock(v, photos, documents)) };
209
+ case "pageBlockRelatedArticles":
210
+ return {
211
+ type: "relatedArticles",
212
+ title: constructRichTextComponent(pb.title, photos),
213
+ articles: pb.articles.map(constructPageBlockRelatedArticle),
214
+ };
215
+ case "pageBlockMap":
216
+ return {
217
+ type: "map",
218
+ caption: constructPageBlockCaption(pb.caption, photos),
219
+ width: pb.w,
220
+ height: pb.h,
221
+ zoom: pb.zoom,
222
+ location: constructLocation(Api.as("geoPoint", pb.geo)),
223
+ };
224
+ case "pageBlockHeading1":
225
+ return { type: "heading1", text: constructRichTextComponent(pb.text, photos) };
226
+ case "pageBlockHeading2":
227
+ return { type: "heading2", text: constructRichTextComponent(pb.text, photos) };
228
+ case "pageBlockHeading3":
229
+ return { type: "heading3", text: constructRichTextComponent(pb.text, photos) };
230
+ case "pageBlockHeading4":
231
+ return { type: "heading4", text: constructRichTextComponent(pb.text, photos) };
232
+ case "pageBlockHeading5":
233
+ return { type: "heading5", text: constructRichTextComponent(pb.text, photos) };
234
+ case "pageBlockHeading6":
235
+ return { type: "heading6", text: constructRichTextComponent(pb.text, photos) };
236
+ case "pageBlockMath":
237
+ return { type: "math", code: pb.source };
238
+ case "pageBlockThinking":
239
+ return { type: "thinking", text: constructRichTextComponent(pb.text, photos) };
240
+ case "inputPageBlockMap":
241
+ unreachable();
242
+ break;
243
+ case "pageBlockBlockquoteBlocks":
244
+ return { type: "blockQuoteBlocks", blocks: pb.blocks.map((v) => constructPageBlock(v, photos, documents)), caption: constructRichTextComponent(pb.caption, photos) };
245
+ }
246
+ unreachable();
247
+ }
248
+ export function pageBlockToTlObject(pb) {
249
+ switch (pb.type) {
250
+ case "unsupported":
251
+ return { _: "pageBlockUnsupported" };
252
+ case "title":
253
+ return { _: "pageBlockTitle", text: richTextComponentToTlObject(pb.text) };
254
+ case "subtitle":
255
+ return { _: "pageBlockSubtitle", text: richTextComponentToTlObject(pb.text) };
256
+ case "authorDate":
257
+ return { _: "pageBlockAuthorDate", author: richTextComponentToTlObject(pb.author), published_date: pb.date };
258
+ case "header":
259
+ return { _: "pageBlockHeader", text: richTextComponentToTlObject(pb.text) };
260
+ case "subheader":
261
+ return { _: "pageBlockSubheader", text: richTextComponentToTlObject(pb.text) };
262
+ case "paragraph":
263
+ return { _: "pageBlockParagraph", text: richTextComponentToTlObject(pb.text) };
264
+ case "pre":
265
+ return { _: "pageBlockPreformatted", text: richTextComponentToTlObject(pb.text), language: pb.language ?? "" };
266
+ case "footer":
267
+ return { _: "pageBlockFooter", text: richTextComponentToTlObject(pb.text) };
268
+ case "divider":
269
+ return { _: "pageBlockDivider" };
270
+ case "anchor":
271
+ return { _: "pageBlockAnchor", name: pb.name };
272
+ case "list":
273
+ return { _: "pageBlockList", items: pb.items.map(pageBlockListItemToTlObject) };
274
+ case "blockQuote":
275
+ return { _: "pageBlockBlockquote", text: richTextComponentToTlObject(pb.text), caption: richTextComponentToTlObject(pb.caption) };
276
+ case "pullQuote":
277
+ return { _: "pageBlockPullquote", text: richTextComponentToTlObject(pb.text), caption: richTextComponentToTlObject(pb.caption) };
278
+ case "photo": {
279
+ const location = deserializeFileId(pb.fileId).location;
280
+ if (!("id" in location)) {
281
+ unreachable();
282
+ }
283
+ return { _: "pageBlockPhoto", photo_id: location.id, caption: pageBlockCaptionToTlObject(pb.caption), spoiler: pb.isSpoiler || undefined, url: pb.url, webpage_id: pb.linkPreviewId ? BigInt(pb.linkPreviewId) : undefined };
284
+ }
285
+ case "video":
286
+ case "animation": {
287
+ const location = deserializeFileId(pb.fileId).location;
288
+ if (!("id" in location)) {
289
+ unreachable();
290
+ }
291
+ return { _: "pageBlockVideo", video_id: location.id, caption: pageBlockCaptionToTlObject(pb.caption), spoiler: pb.isSpoiler || undefined, autoplay: pb.isAutoplay || undefined, loop: pb.isLoop || undefined };
292
+ }
293
+ case "cover":
294
+ return { _: "pageBlockCover", cover: pageBlockToTlObject(pb.cover) };
295
+ case "embed":
296
+ return { _: "pageBlockEmbed", caption: pageBlockCaptionToTlObject(pb.caption), allow_scrolling: pb.isScrollingAllowed || undefined, full_width: pb.isFullWidth || undefined, w: pb.width, h: pb.height, html: pb.html, url: pb.url, poster_photo_id: pb.posterPhotoId ? BigInt(pb.posterPhotoId) : undefined };
297
+ case "embedPost":
298
+ return { _: "pageBlockEmbedPost", caption: pageBlockCaptionToTlObject(pb.caption), url: pb.url, author: pb.author, author_photo_id: BigInt(pb.authorPhotoId), blocks: pb.blocks.map(pageBlockToTlObject), date: pb.date, webpage_id: BigInt(pb.linkPreviewId) };
299
+ case "collage":
300
+ return { _: "pageBlockCollage", caption: pageBlockCaptionToTlObject(pb.caption), items: pb.items.map(pageBlockToTlObject) };
301
+ case "slideshow":
302
+ return { _: "pageBlockSlideshow", caption: pageBlockCaptionToTlObject(pb.caption), items: pb.items.map(pageBlockToTlObject) };
303
+ case "channel":
304
+ unreachable();
305
+ break;
306
+ case "audio":
307
+ case "voice": {
308
+ const location = deserializeFileId(pb.fileId).location;
309
+ if (!("id" in location)) {
310
+ unreachable();
311
+ }
312
+ return { _: "pageBlockAudio", audio_id: location.id, caption: pageBlockCaptionToTlObject(pb.caption) };
313
+ }
314
+ case "kicker":
315
+ return { _: "pageBlockKicker", text: richTextComponentToTlObject(pb.text) };
316
+ case "math":
317
+ return { _: "pageBlockMath", source: pb.code };
318
+ case "table":
319
+ return { _: "pageBlockTable", title: richTextComponentToTlObject(pb.title), rows: pb.rows.map(pageBlockTableRowToTlObject), bordered: pb.isBordered || undefined, striped: pb.isStriped || undefined };
320
+ case "orderedList":
321
+ return { _: "pageBlockOrderedList", items: pb.items.map(pageBlockOrderedListItemToTlObject), reversed: pb.isReversed || undefined, start: pb.start, type: pb.itemsType };
322
+ case "details":
323
+ return { _: "pageBlockDetails", title: richTextComponentToTlObject(pb.title), blocks: pb.blocks.map(pageBlockToTlObject), open: pb.isOpen || undefined };
324
+ case "relatedArticles":
325
+ return { _: "pageBlockRelatedArticles", title: richTextComponentToTlObject(pb.title), articles: pb.articles.map(pageBlockRelatedArticleToTlObject) };
326
+ case "map":
327
+ return { _: "inputPageBlockMap", geo: { _: "inputGeoPoint", lat: pb.location.latitude, long: pb.location.longitude, accuracy_radius: pb.location.horizontalAccuracy }, caption: pageBlockCaptionToTlObject(pb.caption), w: pb.width, h: pb.height, zoom: pb.zoom };
328
+ case "heading1":
329
+ return { _: "pageBlockHeading1", text: richTextComponentToTlObject(pb.text) };
330
+ case "heading2":
331
+ return { _: "pageBlockHeading2", text: richTextComponentToTlObject(pb.text) };
332
+ case "heading3":
333
+ return { _: "pageBlockHeading3", text: richTextComponentToTlObject(pb.text) };
334
+ case "heading4":
335
+ return { _: "pageBlockHeading4", text: richTextComponentToTlObject(pb.text) };
336
+ case "heading5":
337
+ return { _: "pageBlockHeading5", text: richTextComponentToTlObject(pb.text) };
338
+ case "heading6":
339
+ return { _: "pageBlockHeading6", text: richTextComponentToTlObject(pb.text) };
340
+ case "thinking":
341
+ return { _: "pageBlockThinking", text: richTextComponentToTlObject(pb.text) };
342
+ case "blockQuoteBlocks":
343
+ return { _: "pageBlockBlockquoteBlocks", caption: richTextComponentToTlObject(pb.caption), blocks: pb.blocks.map(pageBlockToTlObject) };
344
+ }
345
+ unreachable();
346
+ }
347
+ export function collectMediaFileIds(pageBlocks) {
348
+ const fileIds = new Array();
349
+ for (const m of collectPageBlockMedia(pageBlocks)) {
350
+ fileIds.push({ type: m.type, fileId: m.fileId });
351
+ }
352
+ for (const photo of collectRichTextComponentPhoto(collectRichTextComponents(pageBlocks))) {
353
+ fileIds.push({ type: "photo", fileId: photo.fileId });
354
+ }
355
+ return fileIds;
356
+ }
357
+ function collectRichTextComponentPhoto(components) {
358
+ const photos = new Array();
359
+ for (const component of components) {
360
+ for (const c of flattenRichTextComponent(component)) {
361
+ if (c.type === "photo") {
362
+ photos.push(c);
363
+ }
364
+ }
365
+ }
366
+ return photos;
367
+ }
368
+ function flattenRichTextComponent(component) {
369
+ const items = new Array();
370
+ switch (component.type) {
371
+ case "anchor":
372
+ case "dateTime":
373
+ case "bold":
374
+ case "italic":
375
+ case "underline":
376
+ case "strikethrough":
377
+ case "fixed":
378
+ case "link":
379
+ case "emailLink":
380
+ case "subscript":
381
+ case "superscript":
382
+ case "marked":
383
+ case "phoneNumberLink":
384
+ case "spoiler":
385
+ case "mention":
386
+ case "hashtag":
387
+ case "botCommand":
388
+ case "cashtag":
389
+ case "url":
390
+ case "email":
391
+ case "phoneNumber":
392
+ case "bankCard":
393
+ case "textMention":
394
+ for (const item of flattenRichTextComponent(component.text)) {
395
+ items.push(item);
396
+ }
397
+ break;
398
+ case "concatenate":
399
+ for (const c of component.components) {
400
+ for (const i of flattenRichTextComponent(c)) {
401
+ items.push(i);
402
+ }
403
+ }
404
+ }
405
+ return items;
406
+ }
407
+ function collectRichTextComponents(pageBlocks) {
408
+ const components = new Array();
409
+ for (const pb of pageBlocks) {
410
+ switch (pb.type) {
411
+ case "title":
412
+ case "subtitle":
413
+ case "header":
414
+ case "subheader":
415
+ case "paragraph":
416
+ case "pre":
417
+ case "footer":
418
+ case "kicker":
419
+ case "heading1":
420
+ case "heading2":
421
+ case "heading3":
422
+ case "heading4":
423
+ case "heading5":
424
+ case "heading6":
425
+ case "thinking":
426
+ components.push(pb.text);
427
+ break;
428
+ case "authorDate":
429
+ components.push(pb.author);
430
+ break;
431
+ case "list":
432
+ case "orderedList":
433
+ for (const item of pb.items) {
434
+ if (item.type === "text") {
435
+ components.push(item.text);
436
+ }
437
+ else {
438
+ for (const c of collectRichTextComponents(item.blocks)) {
439
+ components.push(c);
440
+ }
441
+ }
442
+ }
443
+ break;
444
+ case "blockQuote":
445
+ case "pullQuote":
446
+ components.push(pb.text);
447
+ components.push(pb.caption);
448
+ break;
449
+ case "photo":
450
+ case "video":
451
+ case "embed":
452
+ case "audio":
453
+ case "map":
454
+ components.push(pb.caption.text);
455
+ components.push(pb.caption.credit);
456
+ break;
457
+ case "cover":
458
+ for (const c of collectRichTextComponents([pb.cover])) {
459
+ components.push(c);
460
+ }
461
+ break;
462
+ case "collage":
463
+ case "slideshow":
464
+ components.push(pb.caption.text);
465
+ components.push(pb.caption.credit);
466
+ for (const c of collectRichTextComponents(pb.items)) {
467
+ components.push(c);
468
+ }
469
+ break;
470
+ case "embedPost":
471
+ components.push(pb.caption.text);
472
+ components.push(pb.caption.credit);
473
+ for (const c of collectRichTextComponents(pb.blocks)) {
474
+ components.push(c);
475
+ }
476
+ break;
477
+ case "math":
478
+ break;
479
+ case "table":
480
+ components.push(pb.title);
481
+ for (const row of pb.rows) {
482
+ for (const cell of row.cells) {
483
+ if (cell.text) {
484
+ components.push(cell.text);
485
+ }
486
+ }
487
+ }
488
+ break;
489
+ case "details":
490
+ components.push(pb.title);
491
+ for (const c of collectRichTextComponents(pb.blocks)) {
492
+ components.push(c);
493
+ }
494
+ break;
495
+ case "blockQuoteBlocks":
496
+ components.push(pb.caption);
497
+ for (const c of collectRichTextComponents(pb.blocks)) {
498
+ components.push(c);
499
+ }
500
+ break;
501
+ }
502
+ }
503
+ return components;
504
+ }
505
+ function collectPageBlockMedia(pageBlocks) {
506
+ const media = new Array();
507
+ for (const pb of pageBlocks) {
508
+ if (pb.type === "photo" || pb.type === "video" || pb.type === "audio" || pb.type === "voice" || pb.type === "animation") {
509
+ media.push(pb);
510
+ }
511
+ else {
512
+ switch (pb.type) {
513
+ case "list":
514
+ for (const item of pb.items) {
515
+ if (item.type === "blockList") {
516
+ for (const m of collectPageBlockMedia(item.blocks)) {
517
+ media.push(m);
518
+ }
519
+ }
520
+ }
521
+ break;
522
+ case "embedPost":
523
+ for (const m of collectPageBlockMedia(pb.blocks)) {
524
+ media.push(m);
525
+ }
526
+ break;
527
+ case "collage":
528
+ case "slideshow":
529
+ for (const m of collectPageBlockMedia(pb.items)) {
530
+ media.push(m);
531
+ }
532
+ break;
533
+ case "orderedList":
534
+ for (const item of pb.items) {
535
+ if (item.type === "blockList") {
536
+ for (const m of collectPageBlockMedia(item.blocks)) {
537
+ media.push(m);
538
+ }
539
+ }
540
+ }
541
+ break;
542
+ case "details":
543
+ case "blockQuoteBlocks":
544
+ for (const m of collectPageBlockMedia(pb.blocks)) {
545
+ media.push(m);
546
+ }
547
+ break;
548
+ }
549
+ }
550
+ }
551
+ return media;
552
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2026 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+ import type { PageBlock } from "./4_page_block.js";
21
+ /** @unlisted */
22
+ export interface InputRichTextBlocks {
23
+ type: "blocks";
24
+ blocks: PageBlock[];
25
+ }
26
+ /** @unlisted */
27
+ export interface InputRichTextMarkdown {
28
+ type: "markdown";
29
+ markdown: string;
30
+ }
31
+ /** @unlisted */
32
+ export interface InputRichTextHtml {
33
+ type: "html";
34
+ html: string;
35
+ }
36
+ /** Any type of input rich text. */
37
+ export type InputRichText = InputRichTextBlocks | InputRichTextMarkdown | InputRichTextHtml;
38
+ //# sourceMappingURL=5_input_rich_text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"5_input_rich_text.d.ts","sourceRoot":"","sources":["../../src/types/5_input_rich_text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,gBAAgB;AAChB,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB;AAED,gBAAgB;AAChB,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,gBAAgB;AAChB,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,mCAAmC;AACnC,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,qBAAqB,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2026 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+ export {};
@@ -48,6 +48,7 @@ import { type Game } from "./3_game.js";
48
48
  import { type PollOption } from "./3_poll_option.js";
49
49
  import { type ReplyQuote } from "./3_reply_quote.js";
50
50
  import { type Checklist } from "./4_checklist.js";
51
+ import { type PageBlock } from "./4_page_block.js";
51
52
  import { type Poll } from "./4_poll.js";
52
53
  import { type GiftNonUpgradedInformation } from "./5_gift_non_upgraded_information.js";
53
54
  import { type GiftUpgradedInformation } from "./5_gift_upgraded_information.js";
@@ -581,6 +582,23 @@ export interface MessagePollOptionRemoved extends _MessageBase {
581
582
  /** The option that was added. */
582
583
  pollOptionRemoved: PollOption;
583
584
  }
585
+ /**
586
+ * A message with rich text.
587
+ * @unlisted
588
+ */
589
+ export interface MessageRichText extends _MessageBase {
590
+ type: "richText";
591
+ /** The blocks of the rich text. */
592
+ blocks: PageBlock[];
593
+ /** Whether the rich text is right-to-left. */
594
+ isRtl: boolean;
595
+ /** Whether the rich text is partial. */
596
+ isPartial: boolean;
597
+ /** The photos included in the rich text. */
598
+ photos: Photo[];
599
+ /** The documents included in the rich text. */
600
+ documents: Document[];
601
+ }
584
602
  /** @unlisted */
585
603
  export interface MessageTypes {
586
604
  text: MessageText;
@@ -633,11 +651,12 @@ export interface MessageTypes {
633
651
  giftUpgraded: MessageGiftUpgraded;
634
652
  pollOptionAdded: MessagePollOptionAdded;
635
653
  pollOptionRemoved: MessagePollOptionRemoved;
654
+ richText: MessageRichText;
636
655
  }
637
656
  export declare const messageTypes: (keyof MessageTypes)[];
638
657
  export declare function assertMessageType<T extends keyof MessageTypes>(message: Message, type: T): MessageTypes[T];
639
658
  /** Any type of message. */
640
- export type Message = MessageText | MessageLink | MessagePhoto | MessageLivePhoto | MessageDocument | MessageVideo | MessageSticker | MessageAnimation | MessageVoice | MessageAudio | MessageDice | MessageVideoNote | MessageContact | MessageGame | MessagePoll | MessageChecklist | MessageInvoice | MessageVenue | MessageLocation | MessageNewChatMembers | MessageLeftChatMember | MessageNewChatTitle | MessageNewChatPhoto | MessageDeletedChatPhoto | MessageGroupCreated | MessageSupergroupCreated | MessageChannelCreated | MessageAutoDeleteTimerChanged | MessageChatMigratedTo | MessageChatMigratedFrom | MessagePinnedMessage | MessageUserShared | MessageWriteAccessAllowed | MessageForumTopicCreated | MessageForumTopicEdited | MessageForumTopicClosed | MessageForumTopicReopened | MessageVideoChatScheduled | MessageVideoChatStarted | MessageVideoChatEnded | MessageGiveaway | MessageUnsupported | MessageSuccessfulPayment | MessageRefundedPayment | MessageChecklistChanged | MessageChecklistExtended | MessageGiftNonUpgraded | MessageGiftUpgraded | MessagePollOptionAdded | MessagePollOptionRemoved;
659
+ export type Message = MessageText | MessageLink | MessagePhoto | MessageLivePhoto | MessageDocument | MessageVideo | MessageSticker | MessageAnimation | MessageVoice | MessageAudio | MessageDice | MessageVideoNote | MessageContact | MessageGame | MessagePoll | MessageChecklist | MessageInvoice | MessageVenue | MessageLocation | MessageNewChatMembers | MessageLeftChatMember | MessageNewChatTitle | MessageNewChatPhoto | MessageDeletedChatPhoto | MessageGroupCreated | MessageSupergroupCreated | MessageChannelCreated | MessageAutoDeleteTimerChanged | MessageChatMigratedTo | MessageChatMigratedFrom | MessagePinnedMessage | MessageUserShared | MessageWriteAccessAllowed | MessageForumTopicCreated | MessageForumTopicEdited | MessageForumTopicClosed | MessageForumTopicReopened | MessageVideoChatScheduled | MessageVideoChatStarted | MessageVideoChatEnded | MessageGiveaway | MessageUnsupported | MessageSuccessfulPayment | MessageRefundedPayment | MessageChecklistChanged | MessageChecklistExtended | MessageGiftNonUpgraded | MessageGiftUpgraded | MessagePollOptionAdded | MessagePollOptionRemoved | MessageRichText;
641
660
  /** @unlisted */
642
661
  export interface MessageGetter {
643
662
  (chatId: number, messageId: number): MaybePromise<Message | null>;