@mtkruto/node 0.161.0 → 0.170.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.
- package/esm/0_deps.d.ts +1 -1
- package/esm/0_deps.d.ts.map +1 -1
- package/esm/0_deps.js +1 -1
- package/esm/2_tl.d.ts +1 -0
- package/esm/2_tl.d.ts.map +1 -1
- package/esm/2_tl.js +1 -0
- package/esm/3_types.d.ts +3 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +3 -0
- package/esm/client/0_markdown.d.ts.map +1 -1
- package/esm/client/0_params.d.ts +38 -4
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_secret_chat_state.d.ts +86 -0
- package/esm/client/0_secret_chat_state.d.ts.map +1 -0
- package/esm/client/0_secret_chat_state.js +129 -0
- package/esm/client/0_storage_operations.d.ts +1 -0
- package/esm/client/0_storage_operations.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +3 -0
- package/esm/client/1_client_generic.d.ts +86 -15
- package/esm/client/1_client_generic.d.ts.map +1 -1
- package/esm/client/2_client_encrypted.js +6 -6
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +26 -3
- package/esm/client/3_account_manager.js +3 -3
- package/esm/client/3_filters.d.ts +16 -7
- package/esm/client/3_filters.d.ts.map +1 -1
- package/esm/client/3_message_manager.d.ts +59 -20
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +6 -0
- package/esm/client/3_secret_chat_manager.d.ts +26 -0
- package/esm/client/3_secret_chat_manager.d.ts.map +1 -0
- package/esm/client/3_secret_chat_manager.js +770 -0
- package/esm/client/4_chat_manager.d.ts +2 -0
- package/esm/client/4_chat_manager.d.ts.map +1 -1
- package/esm/client/4_chat_manager.js +12 -0
- package/esm/client/4_poll_manager.js +2 -2
- package/esm/client/6_client.d.ts +87 -16
- package/esm/client/6_client.d.ts.map +1 -1
- package/esm/client/6_client.js +118 -18
- package/esm/client/6_client_dispatcher.d.ts +86 -15
- package/esm/client/6_client_dispatcher.d.ts.map +1 -1
- package/esm/client/6_client_dispatcher.js +107 -15
- package/esm/session/2_session_encrypted.js +5 -5
- package/esm/tl/1_secret_chats_api.d.ts +637 -0
- package/esm/tl/1_secret_chats_api.d.ts.map +1 -0
- package/esm/tl/1_secret_chats_api.js +849 -0
- package/esm/tl/1_tl_reader.js +3 -3
- package/esm/tl/2_secret_chats.d.ts +33 -0
- package/esm/tl/2_secret_chats.d.ts.map +1 -0
- package/esm/tl/2_secret_chats.js +53 -0
- package/esm/types/0_secret_chat.d.ts +66 -0
- package/esm/types/0_secret_chat.d.ts.map +1 -0
- package/esm/types/0_secret_chat.js +30 -0
- package/esm/types/0_secret_message_entity.d.ts +115 -0
- package/esm/types/0_secret_message_entity.d.ts.map +1 -0
- package/esm/types/0_secret_message_entity.js +174 -0
- package/esm/types/1_chat_p.d.ts +3 -3
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_input_poll_media.d.ts +2 -2
- package/esm/types/1_sticker.d.ts +2 -1
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/1_sticker.js +23 -1
- package/esm/types/2_inactive_chat.d.ts +1 -1
- package/esm/types/2_inactive_chat.d.ts.map +1 -1
- package/esm/types/2_message_entity.d.ts +0 -3
- package/esm/types/2_message_entity.d.ts.map +1 -1
- package/esm/types/2_secret_message.d.ts +184 -0
- package/esm/types/2_secret_message.d.ts.map +1 -0
- package/esm/types/2_secret_message.js +341 -0
- package/esm/types/2_user.d.ts +1 -1
- package/esm/types/2_user.d.ts.map +1 -1
- package/esm/types/3_input_media.d.ts +2 -2
- package/esm/types/4_gift.d.ts +2 -2
- package/esm/types/4_gift.d.ts.map +1 -1
- package/esm/types/9_message.d.ts +8 -60
- package/esm/types/9_message.d.ts.map +1 -1
- package/esm/types/9_message.js +1 -0
- package/esm/types/B_update.d.ts +32 -41
- package/esm/types/B_update.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/0_deps.d.ts +1 -1
- package/script/0_deps.d.ts.map +1 -1
- package/script/0_deps.js +2 -1
- package/script/2_tl.d.ts +1 -0
- package/script/2_tl.d.ts.map +1 -1
- package/script/2_tl.js +2 -1
- package/script/3_types.d.ts +3 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +3 -0
- package/script/client/0_markdown.d.ts.map +1 -1
- package/script/client/0_params.d.ts +38 -4
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_secret_chat_state.d.ts +86 -0
- package/script/client/0_secret_chat_state.d.ts.map +1 -0
- package/script/client/0_secret_chat_state.js +133 -0
- package/script/client/0_storage_operations.d.ts +1 -0
- package/script/client/0_storage_operations.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +3 -0
- package/script/client/1_client_generic.d.ts +86 -15
- package/script/client/1_client_generic.d.ts.map +1 -1
- package/script/client/2_client_encrypted.js +6 -6
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +25 -2
- package/script/client/3_account_manager.js +3 -3
- package/script/client/3_filters.d.ts +16 -7
- package/script/client/3_filters.d.ts.map +1 -1
- package/script/client/3_message_manager.d.ts +59 -20
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +6 -0
- package/script/client/3_secret_chat_manager.d.ts +26 -0
- package/script/client/3_secret_chat_manager.d.ts.map +1 -0
- package/script/client/3_secret_chat_manager.js +807 -0
- package/script/client/4_chat_manager.d.ts +2 -0
- package/script/client/4_chat_manager.d.ts.map +1 -1
- package/script/client/4_chat_manager.js +12 -0
- package/script/client/4_poll_manager.js +2 -2
- package/script/client/6_client.d.ts +87 -16
- package/script/client/6_client.d.ts.map +1 -1
- package/script/client/6_client.js +118 -18
- package/script/client/6_client_dispatcher.d.ts +86 -15
- package/script/client/6_client_dispatcher.d.ts.map +1 -1
- package/script/client/6_client_dispatcher.js +107 -15
- package/script/session/2_session_encrypted.js +5 -5
- package/script/tl/1_secret_chats_api.d.ts +637 -0
- package/script/tl/1_secret_chats_api.d.ts.map +1 -0
- package/script/tl/1_secret_chats_api.js +852 -0
- package/script/tl/1_tl_reader.js +3 -3
- package/script/tl/2_secret_chats.d.ts +33 -0
- package/script/tl/2_secret_chats.d.ts.map +1 -0
- package/script/tl/2_secret_chats.js +78 -0
- package/script/types/0_secret_chat.d.ts +66 -0
- package/script/types/0_secret_chat.d.ts.map +1 -0
- package/script/types/0_secret_chat.js +33 -0
- package/script/types/0_secret_message_entity.d.ts +115 -0
- package/script/types/0_secret_message_entity.d.ts.map +1 -0
- package/script/types/0_secret_message_entity.js +179 -0
- package/script/types/1_chat_p.d.ts +3 -3
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_input_poll_media.d.ts +2 -2
- package/script/types/1_sticker.d.ts +2 -1
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/1_sticker.js +23 -0
- package/script/types/2_inactive_chat.d.ts +1 -1
- package/script/types/2_inactive_chat.d.ts.map +1 -1
- package/script/types/2_message_entity.d.ts +0 -3
- package/script/types/2_message_entity.d.ts.map +1 -1
- package/script/types/2_secret_message.d.ts +184 -0
- package/script/types/2_secret_message.d.ts.map +1 -0
- package/script/types/2_secret_message.js +344 -0
- package/script/types/2_user.d.ts +1 -1
- package/script/types/2_user.d.ts.map +1 -1
- package/script/types/3_input_media.d.ts +2 -2
- package/script/types/4_gift.d.ts +2 -2
- package/script/types/4_gift.d.ts.map +1 -1
- package/script/types/9_message.d.ts +8 -60
- package/script/types/9_message.d.ts.map +1 -1
- package/script/types/9_message.js +1 -0
- package/script/types/B_update.d.ts +32 -41
- package/script/types/B_update.d.ts.map +1 -1
|
@@ -20,10 +20,7 @@
|
|
|
20
20
|
import { Api } from "../2_tl.js";
|
|
21
21
|
import type { PeerGetter } from "./1_chat_p.js";
|
|
22
22
|
/** @unlisted */
|
|
23
|
-
export type MessageEntityType = "mention" | "hashtag" | "botCommand" | "url" | "email" | "bold" | "italic" | "code" | "pre" | "textLink" | "textMention" | "cashtag" | "phoneNumber" | "underline" | "strikethrough" | "blockquote" | "bankCard" | "spoiler" | "customEmoji" | "dateTime";
|
|
24
|
-
/** @unlisted */
|
|
25
23
|
export interface _MessageEntityBase {
|
|
26
|
-
type: MessageEntityType;
|
|
27
24
|
offset: number;
|
|
28
25
|
length: number;
|
|
29
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_message_entity.d.ts","sourceRoot":"","sources":["../../src/types/2_message_entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,gBAAgB;AAChB,MAAM,
|
|
1
|
+
{"version":3,"file":"2_message_entity.d.ts","sourceRoot":"","sources":["../../src/types/2_message_entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,gBAAgB;AAChB,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,gBAAgB;AAChB,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,gBAAgB;AAChB,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,gBAAgB;AAChB,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,gBAAgB;AAChB,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D,IAAI,EAAE,KAAK,CAAC;CACb;AAED,gBAAgB;AAChB,MAAM,WAAW,yBAA0B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AAC;IAChB,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB,QAyBA;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,aAAa,GAAG,aAAa,GAAG,IAAI,CAoDnF;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,GAAG,GAAG,CAAC,aAAa,CAsErG;AAwBD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CAY9E"}
|
|
@@ -0,0 +1,184 @@
|
|
|
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 { Api, SecretChats } from "../2_tl.js";
|
|
21
|
+
import type { Contact } from "./0_contact.js";
|
|
22
|
+
import type { Location } from "./0_location.js";
|
|
23
|
+
import { type SecretMessageEntity } from "./0_secret_message_entity.js";
|
|
24
|
+
import type { Voice } from "./0_voice.js";
|
|
25
|
+
import type { Animation } from "./1_animation.js";
|
|
26
|
+
import type { Audio } from "./1_audio.js";
|
|
27
|
+
import type { Document } from "./1_document.js";
|
|
28
|
+
import type { Photo } from "./1_photo.js";
|
|
29
|
+
import { type Sticker } from "./1_sticker.js";
|
|
30
|
+
import type { Venue } from "./1_venue.js";
|
|
31
|
+
import type { VideoNote } from "./1_video_note.js";
|
|
32
|
+
import type { Video } from "./1_video.js";
|
|
33
|
+
/** @unlisted */
|
|
34
|
+
export interface _SecretMessageBase {
|
|
35
|
+
/** The identifier of the secret chat that the message belongs to. */
|
|
36
|
+
chatId: number;
|
|
37
|
+
/** The message's identifier. */
|
|
38
|
+
id: string;
|
|
39
|
+
/** The identifier of the message that this message replies to. */
|
|
40
|
+
replyToMessageId?: string;
|
|
41
|
+
/** Whether the message was sent silently. */
|
|
42
|
+
isSilent: boolean;
|
|
43
|
+
/** The message's time-to-live. */
|
|
44
|
+
ttl: number;
|
|
45
|
+
/** The name of the inline bot that was used to send the message. */
|
|
46
|
+
viaBot?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface _SecretMessageMediaBase extends _SecretMessageBase {
|
|
49
|
+
/** The message's media group ID. */
|
|
50
|
+
mediaGroupId?: string;
|
|
51
|
+
/** The message's caption. */
|
|
52
|
+
caption: string;
|
|
53
|
+
/** The entities of the message's caption. */
|
|
54
|
+
entities: SecretMessageEntity[];
|
|
55
|
+
/** Information required for downloading the file. */
|
|
56
|
+
fileInformation: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A secret text message.
|
|
60
|
+
* @unlisted
|
|
61
|
+
*/
|
|
62
|
+
export interface SecretMessageText extends _SecretMessageBase {
|
|
63
|
+
type: "text";
|
|
64
|
+
/** The message's text. */
|
|
65
|
+
text: string;
|
|
66
|
+
/** The entities of the message's text. */
|
|
67
|
+
entities: SecretMessageEntity[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A secret message sharing a location.
|
|
71
|
+
* @unlisted
|
|
72
|
+
*/
|
|
73
|
+
export interface SecretMessageLocation extends _SecretMessageBase {
|
|
74
|
+
type: "location";
|
|
75
|
+
/** The location. */
|
|
76
|
+
location: Location;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A secret message sharing a contact.
|
|
80
|
+
* @unlisted
|
|
81
|
+
*/
|
|
82
|
+
export interface SecretMessageContact extends _SecretMessageBase {
|
|
83
|
+
type: "contact";
|
|
84
|
+
/** The contact. */
|
|
85
|
+
contact: Contact;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A secret message sharing a venue.
|
|
89
|
+
* @unlisted
|
|
90
|
+
*/
|
|
91
|
+
export interface SecretMessageVenue extends _SecretMessageBase {
|
|
92
|
+
type: "venue";
|
|
93
|
+
/** The venue. */
|
|
94
|
+
venue: Venue;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A secret message sharing a web page.
|
|
98
|
+
* @unlisted
|
|
99
|
+
*/
|
|
100
|
+
export interface SecretMessageWebPage extends _SecretMessageBase {
|
|
101
|
+
type: "webPage";
|
|
102
|
+
/** The URL of the web page. */
|
|
103
|
+
url: string;
|
|
104
|
+
/** The message's caption. */
|
|
105
|
+
caption: string;
|
|
106
|
+
/** The entities of the message's caption. */
|
|
107
|
+
entities: SecretMessageEntity[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A secret message sharing a photo.
|
|
111
|
+
* @unlisted
|
|
112
|
+
*/
|
|
113
|
+
export interface SecretMessagePhoto extends _SecretMessageMediaBase {
|
|
114
|
+
type: "photo";
|
|
115
|
+
/** The photo included in the message. */
|
|
116
|
+
photo: Photo;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* A secret message sharing a video.
|
|
120
|
+
* @unlisted
|
|
121
|
+
*/
|
|
122
|
+
export interface SecretMessageVideo extends _SecretMessageMediaBase {
|
|
123
|
+
type: "video";
|
|
124
|
+
/** The video included in the message. */
|
|
125
|
+
video: Video;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* A secret message sharing a video note.
|
|
129
|
+
* @unlisted
|
|
130
|
+
*/
|
|
131
|
+
export interface SecretMessageVideoNote extends _SecretMessageMediaBase {
|
|
132
|
+
type: "videoNote";
|
|
133
|
+
/** The video note included in the message. */
|
|
134
|
+
videoNote: VideoNote;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* A secret message sharing an audio.
|
|
138
|
+
* @unlisted
|
|
139
|
+
*/
|
|
140
|
+
export interface SecretMessageAudio extends _SecretMessageMediaBase {
|
|
141
|
+
type: "audio";
|
|
142
|
+
/** The audio included in the message. */
|
|
143
|
+
audio: Audio;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* A secret message sharing a document.
|
|
147
|
+
* @unlisted
|
|
148
|
+
*/
|
|
149
|
+
export interface SecretMessageDocument extends _SecretMessageMediaBase {
|
|
150
|
+
type: "document";
|
|
151
|
+
/** The document included in the message. */
|
|
152
|
+
document: Document;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* A secret message sharing a sticker.
|
|
156
|
+
* @unlisted
|
|
157
|
+
*/
|
|
158
|
+
export interface SecretMessageSticker extends _SecretMessageBase {
|
|
159
|
+
type: "sticker";
|
|
160
|
+
/** The sticker included in the message. */
|
|
161
|
+
sticker: Sticker;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* A secret message sharing an animation.
|
|
165
|
+
* @unlisted
|
|
166
|
+
*/
|
|
167
|
+
export interface SecretMessageAnimation extends _SecretMessageMediaBase {
|
|
168
|
+
type: "animation";
|
|
169
|
+
/** The animation included in the message. */
|
|
170
|
+
animation: Animation;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* A secret message sharing a voice.
|
|
174
|
+
* @unlisted
|
|
175
|
+
*/
|
|
176
|
+
export interface SecretMessageVoice extends _SecretMessageMediaBase {
|
|
177
|
+
type: "voice";
|
|
178
|
+
/** The voice included in the message. */
|
|
179
|
+
voice: Voice;
|
|
180
|
+
}
|
|
181
|
+
/** Any type of secret message. */
|
|
182
|
+
export type SecretMessage = SecretMessageText | SecretMessageLocation | SecretMessageContact | SecretMessageVenue | SecretMessageWebPage | SecretMessagePhoto | SecretMessageVideo | SecretMessageVideoNote | SecretMessageAudio | SecretMessageDocument | SecretMessageSticker | SecretMessageAnimation | SecretMessageVoice;
|
|
183
|
+
export declare function constructSecretMessage(chatId: number, message: SecretChats.decryptedMessage, encryptedMessage: Api.EncryptedMessage): SecretMessage;
|
|
184
|
+
//# sourceMappingURL=2_secret_message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"2_secret_message.d.ts","sourceRoot":"","sources":["../../src/types/2_secret_message.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAgC,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACtG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,E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MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IACjE,IAAI,EAAE,OAAO,CAAC;IACd,yCAAyC;IACzC,KAAK,EAAE,KAAK,CAAC;CACd;AAED,kCAAkC;AAClC,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,qBAAqB,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,sBAAsB,GAAG,kBAAkB,GAAG,qBAAqB,GAAG,oBAAoB,GAAG,sBAAsB,GAAG,kBAAkB,CAAC;AAE9T,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,CAAC,gBAAgB,GAAG,aAAa,CA4TnJ"}
|
|
@@ -0,0 +1,341 @@
|
|
|
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 { encodeHex } from "../0_deps.js";
|
|
21
|
+
import { cleanObject } from "../1_utilities.js";
|
|
22
|
+
import { Api, SecretChats } from "../2_tl.js";
|
|
23
|
+
import { FileType, PhotoSourceType, serializeFileId, toUniqueFileId } from "./_file_id.js";
|
|
24
|
+
import { constructSecretMessageEntity } from "./0_secret_message_entity.js";
|
|
25
|
+
import { constructSticker3 } from "./1_sticker.js";
|
|
26
|
+
export function constructSecretMessage(chatId, message, encryptedMessage) {
|
|
27
|
+
const isSilent = !!message.silent;
|
|
28
|
+
const id = String(message.random_id);
|
|
29
|
+
const text = message.message;
|
|
30
|
+
const entities = (message.entities ?? []).map(constructSecretMessageEntity).filter((v) => v !== null);
|
|
31
|
+
const mediaGroupId = message.grouped_id ? String(message.grouped_id) : undefined;
|
|
32
|
+
const replyToMessageId = message.reply_to_random_id ? String(message.reply_to_random_id) : undefined;
|
|
33
|
+
const ttl = message.ttl;
|
|
34
|
+
const viaBot = message.via_bot_name;
|
|
35
|
+
const messageBase = { chatId, id, isSilent, replyToMessageId, ttl, viaBot };
|
|
36
|
+
let fileInformation = "";
|
|
37
|
+
if (message.media && "key" in message.media && "iv" in message.media) {
|
|
38
|
+
fileInformation = `0${encodeHex(message.media.key)}${encodeHex(message.media.iv)}${message.media.size}`;
|
|
39
|
+
}
|
|
40
|
+
function getFileIds(type) {
|
|
41
|
+
let fileId_;
|
|
42
|
+
if (SecretChats.is("decryptedMessageMediaExternalDocument", message.media)) {
|
|
43
|
+
fileId_ = {
|
|
44
|
+
type,
|
|
45
|
+
dcId: message.media.dc_id,
|
|
46
|
+
location: {
|
|
47
|
+
type: "common",
|
|
48
|
+
id: message.media.id,
|
|
49
|
+
accessHash: message.media.access_hash,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const file = Api.as("encryptedFile", Api.as("encryptedMessage", encryptedMessage).file);
|
|
55
|
+
fileId_ = {
|
|
56
|
+
type: FileType.Encrypted,
|
|
57
|
+
dcId: file.dc_id,
|
|
58
|
+
location: {
|
|
59
|
+
type: "common",
|
|
60
|
+
id: file.id,
|
|
61
|
+
accessHash: file.access_hash,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const fileId = serializeFileId(fileId_);
|
|
66
|
+
const fileUniqueId = toUniqueFileId(fileId_);
|
|
67
|
+
return { fileId, fileUniqueId };
|
|
68
|
+
}
|
|
69
|
+
if (message.media) {
|
|
70
|
+
switch (message.media._) {
|
|
71
|
+
case "decryptedMessageMediaGeoPoint": {
|
|
72
|
+
const location = { latitude: message.media.lat, longitude: message.media.long };
|
|
73
|
+
return cleanObject({
|
|
74
|
+
type: "location",
|
|
75
|
+
...messageBase,
|
|
76
|
+
location,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
case "decryptedMessageMediaContact": {
|
|
80
|
+
const contact = cleanObject({ firstName: message.media.first_name, lastName: message.media.last_name || undefined, phoneNumber: message.media.phone_number, userId: message.media.user_id });
|
|
81
|
+
return cleanObject({
|
|
82
|
+
type: "contact",
|
|
83
|
+
...messageBase,
|
|
84
|
+
contact,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
case "decryptedMessageMediaPhoto": {
|
|
88
|
+
const file = Api.as("encryptedFile", Api.as("encryptedMessage", encryptedMessage).file);
|
|
89
|
+
const fileId_ = {
|
|
90
|
+
type: FileType.Encrypted,
|
|
91
|
+
dcId: file.dc_id,
|
|
92
|
+
location: {
|
|
93
|
+
type: "photo",
|
|
94
|
+
id: file.id,
|
|
95
|
+
accessHash: file.access_hash,
|
|
96
|
+
source: {
|
|
97
|
+
type: PhotoSourceType.Thumbnail,
|
|
98
|
+
fileType: FileType.EncryptedThumbnail,
|
|
99
|
+
thumbnailType: "t".charCodeAt(0),
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
const fileId = serializeFileId(fileId_);
|
|
104
|
+
const fileUniqueId = toUniqueFileId(fileId_);
|
|
105
|
+
const photo = {
|
|
106
|
+
fileId,
|
|
107
|
+
fileUniqueId,
|
|
108
|
+
width: message.media.w,
|
|
109
|
+
height: message.media.h,
|
|
110
|
+
fileSize: message.media.size,
|
|
111
|
+
thumbnails: [],
|
|
112
|
+
};
|
|
113
|
+
return cleanObject({
|
|
114
|
+
type: "photo",
|
|
115
|
+
...messageBase,
|
|
116
|
+
photo,
|
|
117
|
+
mediaGroupId,
|
|
118
|
+
caption: text,
|
|
119
|
+
entities,
|
|
120
|
+
fileInformation,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
case "decryptedMessageMediaAudio": {
|
|
124
|
+
const { fileId, fileUniqueId } = getFileIds(FileType.Audio);
|
|
125
|
+
const audio = cleanObject({
|
|
126
|
+
fileId,
|
|
127
|
+
fileUniqueId,
|
|
128
|
+
duration: message.media.duration,
|
|
129
|
+
mimeType: message.media.mime_type,
|
|
130
|
+
fileSize: message.media.size,
|
|
131
|
+
thumbnails: [],
|
|
132
|
+
});
|
|
133
|
+
return cleanObject({
|
|
134
|
+
type: "audio",
|
|
135
|
+
...messageBase,
|
|
136
|
+
audio,
|
|
137
|
+
mediaGroupId,
|
|
138
|
+
caption: text,
|
|
139
|
+
entities,
|
|
140
|
+
fileInformation,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
case "decryptedMessageMediaDocument8": {
|
|
144
|
+
const { fileId, fileUniqueId } = getFileIds(FileType.Document);
|
|
145
|
+
const document = cleanObject({
|
|
146
|
+
fileId,
|
|
147
|
+
fileUniqueId,
|
|
148
|
+
thumbnails: [],
|
|
149
|
+
fileName: message.media.file_name,
|
|
150
|
+
mimeType: message.media.mime_type,
|
|
151
|
+
fileSize: message.media.size,
|
|
152
|
+
});
|
|
153
|
+
return cleanObject({
|
|
154
|
+
type: "document",
|
|
155
|
+
...messageBase,
|
|
156
|
+
document,
|
|
157
|
+
mediaGroupId,
|
|
158
|
+
caption: text,
|
|
159
|
+
entities,
|
|
160
|
+
fileInformation,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
case "decryptedMessageMediaExternalDocument":
|
|
164
|
+
case "decryptedMessageMediaDocument46":
|
|
165
|
+
case "decryptedMessageMediaDocument": {
|
|
166
|
+
const animated = message.media.attributes.find((v) => SecretChats.is("documentAttributeAnimated", v));
|
|
167
|
+
const audio = message.media.attributes.find((v) => SecretChats.is("documentAttributeAudio", v));
|
|
168
|
+
const fileName = message.media.attributes.find((v) => SecretChats.is("documentAttributeFilename", v));
|
|
169
|
+
const sticker = message.media.attributes.find((v) => SecretChats.is("documentAttributeSticker", v));
|
|
170
|
+
const video = message.media.attributes.find((v) => SecretChats.is("documentAttributeVideo", v));
|
|
171
|
+
if (sticker) {
|
|
172
|
+
const { fileId, fileUniqueId } = getFileIds(FileType.Sticker);
|
|
173
|
+
const sticker = constructSticker3(message.media, fileId, fileUniqueId);
|
|
174
|
+
return cleanObject({
|
|
175
|
+
type: "sticker",
|
|
176
|
+
...messageBase,
|
|
177
|
+
sticker,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
else if (animated) {
|
|
181
|
+
const { fileId, fileUniqueId } = getFileIds(FileType.Animation);
|
|
182
|
+
const animation = {
|
|
183
|
+
fileId,
|
|
184
|
+
fileUniqueId,
|
|
185
|
+
width: video?.w ?? 0,
|
|
186
|
+
height: video?.h ?? 0,
|
|
187
|
+
duration: video?.duration ?? 0,
|
|
188
|
+
thumbnails: [],
|
|
189
|
+
fileName: fileName?.file_name,
|
|
190
|
+
mimeType: message.media.mime_type,
|
|
191
|
+
fileSize: Number(message.media.size),
|
|
192
|
+
};
|
|
193
|
+
return cleanObject({
|
|
194
|
+
type: "animation",
|
|
195
|
+
...messageBase,
|
|
196
|
+
animation,
|
|
197
|
+
mediaGroupId,
|
|
198
|
+
caption: text,
|
|
199
|
+
entities,
|
|
200
|
+
fileInformation,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
else if (video) {
|
|
204
|
+
if (video.round_message) {
|
|
205
|
+
const { fileId, fileUniqueId } = getFileIds(FileType.VideoNote);
|
|
206
|
+
const videoNote = {
|
|
207
|
+
fileId,
|
|
208
|
+
fileUniqueId,
|
|
209
|
+
length: video.w,
|
|
210
|
+
duration: video.duration,
|
|
211
|
+
thumbnails: [],
|
|
212
|
+
fileName: fileName?.file_name,
|
|
213
|
+
fileSize: Number(message.media.size),
|
|
214
|
+
};
|
|
215
|
+
return cleanObject({
|
|
216
|
+
type: "videoNote",
|
|
217
|
+
...messageBase,
|
|
218
|
+
videoNote,
|
|
219
|
+
mediaGroupId,
|
|
220
|
+
caption: text,
|
|
221
|
+
entities,
|
|
222
|
+
fileInformation,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
const { fileId, fileUniqueId } = getFileIds(FileType.Video);
|
|
227
|
+
const video_ = {
|
|
228
|
+
fileId,
|
|
229
|
+
fileUniqueId,
|
|
230
|
+
width: video.w,
|
|
231
|
+
height: video.h,
|
|
232
|
+
duration: video.duration,
|
|
233
|
+
thumbnails: [],
|
|
234
|
+
fileName: fileName?.file_name,
|
|
235
|
+
mimeType: message.media.mime_type,
|
|
236
|
+
fileSize: Number(message.media.size),
|
|
237
|
+
};
|
|
238
|
+
return cleanObject({
|
|
239
|
+
type: "video",
|
|
240
|
+
...messageBase,
|
|
241
|
+
video: video_,
|
|
242
|
+
mediaGroupId,
|
|
243
|
+
caption: text,
|
|
244
|
+
entities,
|
|
245
|
+
fileInformation,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
else if (audio) {
|
|
250
|
+
if (audio.voice) {
|
|
251
|
+
const { fileId, fileUniqueId } = getFileIds(FileType.Audio);
|
|
252
|
+
const voice = {
|
|
253
|
+
fileId,
|
|
254
|
+
fileUniqueId,
|
|
255
|
+
duration: audio.duration,
|
|
256
|
+
mimeType: message.media.mime_type,
|
|
257
|
+
fileSize: Number(message.media.size),
|
|
258
|
+
};
|
|
259
|
+
return cleanObject({
|
|
260
|
+
type: "voice",
|
|
261
|
+
...messageBase,
|
|
262
|
+
voice,
|
|
263
|
+
mediaGroupId,
|
|
264
|
+
caption: text,
|
|
265
|
+
entities,
|
|
266
|
+
fileInformation,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
const { fileId, fileUniqueId } = getFileIds(FileType.Audio);
|
|
271
|
+
const audio_ = {
|
|
272
|
+
fileId,
|
|
273
|
+
fileUniqueId,
|
|
274
|
+
duration: audio.duration,
|
|
275
|
+
performer: audio.performer,
|
|
276
|
+
title: audio.title,
|
|
277
|
+
mimeType: message.media.mime_type,
|
|
278
|
+
fileSize: Number(message.media.size),
|
|
279
|
+
thumbnails: [],
|
|
280
|
+
};
|
|
281
|
+
return cleanObject({
|
|
282
|
+
type: "audio",
|
|
283
|
+
...messageBase,
|
|
284
|
+
audio: audio_,
|
|
285
|
+
mediaGroupId,
|
|
286
|
+
caption: text,
|
|
287
|
+
entities,
|
|
288
|
+
fileInformation,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
const { fileId, fileUniqueId } = getFileIds(FileType.Document);
|
|
294
|
+
const document = {
|
|
295
|
+
fileId,
|
|
296
|
+
fileUniqueId,
|
|
297
|
+
thumbnails: [],
|
|
298
|
+
fileName: fileName?.file_name ?? "unknown",
|
|
299
|
+
mimeType: message.media.mime_type,
|
|
300
|
+
fileSize: Number(message.media.size),
|
|
301
|
+
};
|
|
302
|
+
return cleanObject({
|
|
303
|
+
type: "document",
|
|
304
|
+
...messageBase,
|
|
305
|
+
document,
|
|
306
|
+
mediaGroupId,
|
|
307
|
+
caption: text,
|
|
308
|
+
entities,
|
|
309
|
+
fileInformation,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
case "decryptedMessageMediaVideo":
|
|
314
|
+
break;
|
|
315
|
+
case "decryptedMessageMediaVenue": {
|
|
316
|
+
const venue = cleanObject({ title: message.media.title, address: message.media.address, location: { latitude: message.media.lat, longitude: message.media.long }, foursquareId: message.media.venue_id || undefined });
|
|
317
|
+
return cleanObject({
|
|
318
|
+
type: "venue",
|
|
319
|
+
...messageBase,
|
|
320
|
+
venue,
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
case "decryptedMessageMediaWebPage": {
|
|
324
|
+
const url = message.media.url;
|
|
325
|
+
return cleanObject({
|
|
326
|
+
type: "webPage",
|
|
327
|
+
...messageBase,
|
|
328
|
+
url,
|
|
329
|
+
caption: text,
|
|
330
|
+
entities,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return cleanObject({
|
|
336
|
+
type: "text",
|
|
337
|
+
...messageBase,
|
|
338
|
+
text,
|
|
339
|
+
entities,
|
|
340
|
+
});
|
|
341
|
+
}
|
package/esm/types/2_user.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export interface User {
|
|
|
59
59
|
isMutualContact: boolean;
|
|
60
60
|
/** Whether the user is a close friend. */
|
|
61
61
|
isCloseFriend: boolean;
|
|
62
|
-
/** Whether the user has been identified as scam. */
|
|
62
|
+
/** Whether the user has been identified as a scam. */
|
|
63
63
|
isScam: boolean;
|
|
64
64
|
/** Whether the user has been identified as an impersonator. */
|
|
65
65
|
isFake: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_user.d.ts","sourceRoot":"","sources":["../../src/types/2_user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,SAAS,EAAsB,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,cAAc;AACd,MAAM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AAiB,EAAE,CAAC;IACxC,gGAAgG;IAChG,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,0DAA0D;IAC1D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,6DAA6D;IAC7D,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAqCnD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CA8BxD"}
|
|
@@ -98,9 +98,9 @@ export interface InputMediaVideo extends _InputMediaCommon {
|
|
|
98
98
|
thumbnail?: FileSource;
|
|
99
99
|
/** The duration of the video in seconds. */
|
|
100
100
|
duration?: number;
|
|
101
|
-
/** The width of the
|
|
101
|
+
/** The width of the video in pixels. */
|
|
102
102
|
width?: number;
|
|
103
|
-
/** The height of the
|
|
103
|
+
/** The height of the video in pixels. */
|
|
104
104
|
height?: number;
|
|
105
105
|
/** Whether the video is suitable for streaming. */
|
|
106
106
|
supportsStreaming?: boolean;
|
package/esm/types/4_gift.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface GiftNonUpgraded {
|
|
|
33
33
|
id: string;
|
|
34
34
|
/** The sticker that represents the gift. */
|
|
35
35
|
sticker: Sticker;
|
|
36
|
-
/** The price of the
|
|
36
|
+
/** The price of the gift in Telegram Stars. */
|
|
37
37
|
price: number;
|
|
38
38
|
/** Whether the supply of this gift is limited. */
|
|
39
39
|
isLimited: boolean;
|
|
@@ -73,7 +73,7 @@ export interface GiftUpgraded {
|
|
|
73
73
|
ownerAddress?: string;
|
|
74
74
|
/** The user or chat that owns the gift. */
|
|
75
75
|
owner?: ChatP;
|
|
76
|
-
/** The
|
|
76
|
+
/** The number of upgraded gifts of the same type. */
|
|
77
77
|
currentUpgrades: number;
|
|
78
78
|
/** The maximum count of gifts of the same type that can be upgraded. */
|
|
79
79
|
maxUpgrades: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4_gift.d.ts","sourceRoot":"","sources":["../../src/types/4_gift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAkC,KAAK,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5G;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB
|
|
1
|
+
{"version":3,"file":"4_gift.d.ts","sourceRoot":"","sources":["../../src/types/4_gift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAqB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAkC,KAAK,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5G;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC;IACnB,mDAAmD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