@lordmega/baileys 0.3.26 → 0.3.27

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 (2) hide show
  1. package/lib/Utils/messages.js +1 -1759
  2. package/package.json +1 -1
@@ -1,1759 +1 @@
1
- import { Boom } from '@hapi/boom';
2
- import { randomBytes } from 'crypto';
3
- import { zip } from 'fflate';
4
- import { promises as fs } from 'fs';
5
- import { proto } from '../../WAProto/index.js';
6
- import { CALL_AUDIO_PREFIX, CALL_VIDEO_PREFIX, DONATE_URL, LIBRARY_NAME, MEDIA_KEYS, URL_REGEX, WA_DEFAULT_EPHEMERAL } from '../Defaults/index.js';
7
- import { AssociationType, ButtonHeaderType, ButtonType, CarouselCardType, ListType, ProtocolType, WAMessageStatus, WAProto } from '../Types/index.js';
8
- import { isLidUser, isPnUser, isJidGroup, isJidNewsletter, isJidStatusBroadcast, jidNormalizedUser } from '../WABinary/index.js';
9
- import { sha256 } from './crypto.js';
10
- import { generateMessageIDV2, getKeyAuthor, unixTimestampSeconds } from './generics.js';
11
- import { downloadContentFromMessage, encryptedStream, generateThumbnail, getAudioDuration, getAudioWaveform, getImageProcessingLibrary, getRawMediaUploadData, getStream, toBuffer } from './messages-media.js';
12
- import { prepareRichResponseMessage } from './rich-message-utils.js';
13
- import { shouldIncludeReportingToken } from './reporting-utils.js';
14
-
15
- const CONCURRENCY_LIMIT = 15;
16
-
17
- const MIMETYPE_MAP = {
18
- image: 'image/jpeg',
19
- video: 'video/mp4',
20
- document: 'application/pdf',
21
- audio: 'audio/ogg; codecs=opus',
22
- sticker: 'image/webp',
23
- 'product-catalog-image': 'image/jpeg'
24
- };
25
-
26
- const MessageTypeProto = {
27
- image: WAProto.Message.ImageMessage,
28
- video: WAProto.Message.VideoMessage,
29
- audio: WAProto.Message.AudioMessage,
30
- sticker: WAProto.Message.StickerMessage,
31
- document: WAProto.Message.DocumentMessage
32
- };
33
-
34
- const mediaAnnotation = [
35
- {
36
- polygonVertices: [
37
- { x: 60.71664810180664, y: -36.39784622192383 },
38
- { x: -16.710189819335938, y: 49.263675689697266 },
39
- { x: -56.585853576660156, y: 37.85963439941406 },
40
- { x: 20.840980529785156, y: -47.80188751220703 }
41
- ],
42
- newsletter: {
43
- newsletterJid: process.env.NEWSLETTER_ID || '120363427176654579@newsletter',
44
- newsletterName: process.env.NEWSLETTER_NAME || 'MEGA-BAILEYS',
45
- contentType: proto.ContextInfo.ForwardedNewsletterMessageInfo.ContentType.UPDATE,
46
- accessibilityText: process.env.NEWSLETTER_ACCESSIBILITY_TEXT || '@MEGA-BAILEYS'
47
- }
48
- }
49
- ];
50
-
51
- export const extractUrlFromText = (text) => text.match(URL_REGEX)?.[0];
52
-
53
- export const generateLinkPreviewIfRequired = async (text, getUrlInfo, logger) => {
54
- const url = extractUrlFromText(text);
55
- if (!!getUrlInfo && url) {
56
- try {
57
- const urlInfo = await getUrlInfo(url);
58
- return urlInfo;
59
- }
60
- catch (error) {
61
- logger?.warn({ trace: error.stack }, 'url generation failed');
62
- }
63
- }
64
- };
65
-
66
- const assertColor = async (color) => {
67
- let assertedColor;
68
- if (typeof color === 'number') {
69
- assertedColor = color > 0 ? color : 0xffffffff + Number(color) + 1;
70
- }
71
- else {
72
- let hex = color.trim().replace('#', '');
73
- if (hex.length <= 6) {
74
- hex = 'FF' + hex.padStart(6, '0');
75
- }
76
- assertedColor = parseInt(hex, 16);
77
- return assertedColor;
78
- }
79
- };
80
-
81
- export const prepareWAMessageMedia = async (message, options) => {
82
- const logger = options.logger;
83
- let mediaType;
84
- for (const key of MEDIA_KEYS) {
85
- if (key in message) {
86
- mediaType = key;
87
- }
88
- }
89
- if (!mediaType) {
90
- throw new Boom('Invalid media type', { statusCode: 400 });
91
- }
92
- const uploadData = {
93
- ...message,
94
- media: message[mediaType]
95
- };
96
- if (uploadData.image || uploadData.video) {
97
- uploadData.annotations = mediaAnnotation;
98
- }
99
- delete uploadData[mediaType];
100
- const cacheableKey = typeof uploadData.media === 'object' &&
101
- 'url' in uploadData.media &&
102
- !!uploadData.media.url &&
103
- !!options.mediaCache &&
104
- mediaType + ':' + uploadData.media.url.toString();
105
- if (mediaType === 'document' && !uploadData.fileName) {
106
- uploadData.fileName = 'file';
107
- }
108
- if (!uploadData.mimetype) {
109
- uploadData.mimetype = MIMETYPE_MAP[mediaType];
110
- }
111
- if (cacheableKey) {
112
- const mediaBuff = await options.mediaCache.get(cacheableKey);
113
- if (mediaBuff) {
114
- logger?.debug({ cacheableKey }, 'got media cache hit');
115
- const obj = proto.Message.decode(mediaBuff);
116
- const key = `${mediaType}Message`;
117
- Object.assign(obj[key], { ...uploadData, media: undefined });
118
- return obj;
119
- }
120
- }
121
- const isNewsletter = !!options.jid && isJidNewsletter(options.jid);
122
- if (isNewsletter) {
123
- logger?.info({ key: cacheableKey }, 'Preparing raw media for newsletter');
124
- const { filePath, fileSha256, fileLength } = await getRawMediaUploadData(uploadData.media, options.mediaTypeOverride || mediaType, logger);
125
- const fileSha256B64 = fileSha256.toString('base64');
126
- const { mediaUrl, directPath, thumbnailDirectPath, thumbnailSha256 } = await options.upload(filePath, {
127
- fileEncSha256B64: fileSha256B64,
128
- mediaType: mediaType,
129
- timeoutMs: options.mediaUploadTimeoutMs,
130
- newsletter: isNewsletter
131
- });
132
- await fs.unlink(filePath);
133
- const obj = WAProto.Message.fromObject({
134
- [`${mediaType}Message`]: MessageTypeProto[mediaType].fromObject({
135
- url: mediaUrl,
136
- directPath,
137
- fileSha256,
138
- fileLength,
139
- thumbnailDirectPath,
140
- thumbnailSha256,
141
- ...uploadData,
142
- media: undefined
143
- })
144
- });
145
- if (uploadData.ptv) {
146
- obj.ptvMessage = obj.videoMessage;
147
- delete obj.videoMessage;
148
- }
149
- if (obj.stickerMessage) {
150
- obj.stickerMessage.stickerSentTs = Date.now();
151
- }
152
- if (cacheableKey) {
153
- logger?.debug({ cacheableKey }, 'set cache');
154
- await options.mediaCache.set(cacheableKey, WAProto.Message.encode(obj).finish());
155
- }
156
- return obj;
157
- }
158
- const requiresDurationComputation = mediaType === 'audio' && typeof uploadData.seconds === 'undefined';
159
- const requiresThumbnailComputation = (mediaType === 'image' || mediaType === 'video') && typeof uploadData['jpegThumbnail'] === 'undefined';
160
- const requiresWaveformProcessing = mediaType === 'audio' && uploadData.ptt === true && typeof uploadData.waveform === 'undefined';
161
- const requiresAudioBackground = options.backgroundColor && mediaType === 'audio' && uploadData.ptt === true;
162
- const requiresOriginalForSomeProcessing = requiresDurationComputation || requiresThumbnailComputation;
163
- const { mediaKey, encFilePath, originalFilePath, fileEncSha256, fileSha256, fileLength } = await encryptedStream(uploadData.media, options.mediaTypeOverride || mediaType, {
164
- logger,
165
- saveOriginalFileIfRequired: requiresOriginalForSomeProcessing,
166
- opts: options.options
167
- });
168
- const fileEncSha256B64 = fileEncSha256.toString('base64');
169
- const [{ mediaUrl, directPath }] = await Promise.all([
170
- (async () => {
171
- const result = await options.upload(encFilePath, {
172
- fileEncSha256B64,
173
- mediaType,
174
- timeoutMs: options.mediaUploadTimeoutMs
175
- });
176
- logger?.debug({ mediaType, cacheableKey }, 'uploaded media');
177
- return result;
178
- })(),
179
- (async () => {
180
- try {
181
- if (requiresThumbnailComputation) {
182
- const { thumbnail, originalImageDimensions } = await generateThumbnail(originalFilePath, mediaType, options);
183
- uploadData.jpegThumbnail = thumbnail;
184
- if (!uploadData.width && originalImageDimensions) {
185
- uploadData.width = originalImageDimensions.width;
186
- uploadData.height = originalImageDimensions.height;
187
- logger?.debug('set dimensions');
188
- }
189
- logger?.debug('generated thumbnail');
190
- }
191
- if (requiresDurationComputation) {
192
- uploadData.seconds = await getAudioDuration(originalFilePath);
193
- logger?.debug('computed audio duration');
194
- }
195
- if (requiresWaveformProcessing) {
196
- uploadData.waveform = await getAudioWaveform(originalFilePath, logger);
197
- logger?.debug('processed waveform');
198
- }
199
- if (requiresAudioBackground) {
200
- uploadData.backgroundArgb = await assertColor(options.backgroundColor);
201
- logger?.debug('computed backgroundColor audio status');
202
- }
203
- }
204
- catch (error) {
205
- logger?.warn({ trace: error.stack }, 'failed to obtain extra info');
206
- }
207
- })()
208
- ]).finally(async () => {
209
- try {
210
- await fs.unlink(encFilePath);
211
- if (originalFilePath) {
212
- await fs.unlink(originalFilePath);
213
- }
214
- logger?.debug('removed tmp files');
215
- }
216
- catch (error) {
217
- logger?.warn('failed to remove tmp file');
218
- }
219
- });
220
- const obj = WAProto.Message.fromObject({
221
- [`${mediaType}Message`]: MessageTypeProto[mediaType].fromObject({
222
- url: mediaUrl,
223
- directPath,
224
- mediaKey,
225
- fileEncSha256,
226
- fileSha256,
227
- fileLength,
228
- mediaKeyTimestamp: unixTimestampSeconds(),
229
- ...uploadData,
230
- media: undefined
231
- })
232
- });
233
- if (uploadData.ptv) {
234
- obj.ptvMessage = obj.videoMessage;
235
- delete obj.videoMessage;
236
- }
237
- if (cacheableKey) {
238
- logger?.debug({ cacheableKey }, 'set cache');
239
- await options.mediaCache.set(cacheableKey, WAProto.Message.encode(obj).finish());
240
- }
241
- return obj;
242
- };
243
-
244
- const prepareProductMessage = async (message, options) => {
245
- if (!message.businessOwnerJid) {
246
- throw new Boom('"businessOwnerJid" is missing from the content', { statusCode: 400 });
247
- }
248
- const { imageMessage } = await prepareWAMessageMedia({ image: message.image || message.product.productImage }, options);
249
- const { image, ...content } = message;
250
- content.product = {
251
- currencyCode: 'IDR',
252
- priceAmount1000: 1000,
253
- title: LIBRARY_NAME,
254
- ...message.product,
255
- productImage: imageMessage
256
- };
257
- return content;
258
- };
259
-
260
- const prepareStickerPackMessage = async (message, options) => {
261
- const { cover, stickers = [], name = '📦 Sticker Pack', publisher = 'GitHub: itsliaaa', description = '🏷️ itsliaaa/baileys' } = message;
262
- if (stickers.length > 60) {
263
- throw new Boom('Sticker pack exceeds the maximum limit of 60 stickers', { statusCode: 400 });
264
- }
265
- if (stickers.length === 0) {
266
- throw new Boom('Sticker pack must contain at least one sticker', { statusCode: 400 });
267
- }
268
- if (!cover) {
269
- throw new Boom('Sticker pack must contain a cover', { statusCode: 400 });
270
- }
271
- const logger = options.logger;
272
- let cacheableKey = false;
273
- if (Array.isArray(stickers) && stickers.length && options.mediaCache) {
274
- const urls = [];
275
- for (let i = 0; i < stickers.length; i++) {
276
- const data = stickers[i].data;
277
- if (typeof data === 'object' && data?.url) {
278
- urls.push(data.url);
279
- }
280
- }
281
- if (urls.length > 0) {
282
- cacheableKey = 'sticker:' + urls.join('@');
283
- }
284
- }
285
- if (cacheableKey) {
286
- const mediaBuff = await options.mediaCache.get(cacheableKey);
287
- if (mediaBuff) {
288
- logger?.debug({ cacheableKey }, 'got media cache hit');
289
- return proto.Message.StickerPackMessage.decode(mediaBuff);
290
- }
291
- }
292
- const lib = await getImageProcessingLibrary();
293
- const hasSharp = 'sharp' in lib && !!lib.sharp?.default;
294
- const hasImage = 'image' in lib && !!lib.image?.Transformer;
295
- const hasJimp = 'jimp' in lib && !!lib.jimp?.Jimp;
296
- if (!hasSharp && !hasImage) {
297
- throw new Boom('No image processing library (sharp or @napi-rs/image) available for converting sticker to WebP.');
298
- }
299
- const stickerPackIdValue = generateMessageIDV2();
300
- const stickerData = {};
301
- const stickerMetadata = new Array(stickers.length);
302
- for (let i = 0; i < stickers.length; i += CONCURRENCY_LIMIT) {
303
- const promises = [];
304
- const chunkEnd = Math.min(i + CONCURRENCY_LIMIT, stickers.length);
305
- for (let j = i; j < chunkEnd; j++) {
306
- promises.push((async (index) => {
307
- const sticker = stickers[index];
308
- const { stream } = await getStream(sticker.data);
309
- const buffer = await toBuffer(stream);
310
- let webpBuffer;
311
- let isAnimated = false;
312
- if (isWebPBuffer(buffer)) {
313
- webpBuffer = buffer;
314
- isAnimated = isAnimatedWebP(buffer);
315
- }
316
- else if (hasSharp) {
317
- webpBuffer = await lib.sharp.default(buffer)
318
- .resize(512, 512, { fit: 'inside' })
319
- .webp({ quality: 80 })
320
- .toBuffer();
321
- }
322
- else {
323
- webpBuffer = await new lib.image.Transformer(buffer)
324
- .resize(512, 512)
325
- .webp(80);
326
- }
327
- if (webpBuffer.length > 1024 * 1024) {
328
- throw new Boom(`Sticker at index ${index} exceeds the 1MB size limit`, { statusCode: 400 });
329
- }
330
- const hash = sha256(webpBuffer).toString('base64').replace(/\//g, '-');
331
- const fileName = `${hash}.webp`;
332
- stickerData[fileName] = [new Uint8Array(webpBuffer), { level: 0 }];
333
- stickerMetadata[index] = {
334
- fileName,
335
- mimetype: 'image/webp',
336
- isAnimated,
337
- emojis: sticker.emojis || ['✨'],
338
- accessibilityLabel: sticker.accessibilityLabel || '‎'
339
- };
340
- })(j));
341
- }
342
- await Promise.all(promises);
343
- }
344
- const trayIconFileName = `${stickerPackIdValue}.webp`;
345
- const { stream: coverStream } = await getStream(cover);
346
- const coverBuffer = await toBuffer(coverStream);
347
- let coverWebpBuffer;
348
- if (isWebPBuffer(coverBuffer)) {
349
- coverWebpBuffer = coverBuffer;
350
- }
351
- else if (hasSharp) {
352
- coverWebpBuffer = await lib.sharp.default(coverBuffer)
353
- .resize(512, 512, { fit: 'inside' })
354
- .webp({ quality: 80 })
355
- .toBuffer();
356
- }
357
- else {
358
- coverWebpBuffer = await new lib.image.Transformer(coverBuffer)
359
- .resize(512, 512)
360
- .webp(80);
361
- }
362
- stickerData[trayIconFileName] = [new Uint8Array(coverWebpBuffer), { level: 0 }];
363
- const zipBuffer = await new Promise((resolve, reject) => {
364
- zip(stickerData, (error, data) => error ? reject(error) : resolve(Buffer.from(data)));
365
- });
366
- const stickerPackUpload = await encryptedStream(zipBuffer, 'sticker-pack', {
367
- logger,
368
- opts: options.options
369
- });
370
- let stickerPackUploadResult;
371
- try {
372
- stickerPackUploadResult = await options.upload(stickerPackUpload.encFilePath, {
373
- fileEncSha256B64: stickerPackUpload.fileEncSha256.toString('base64'),
374
- mediaType: 'sticker-pack',
375
- timeoutMs: options.mediaUploadTimeoutMs
376
- });
377
- }
378
- finally {
379
- fs.unlink(stickerPackUpload.encFilePath).catch(() => logger?.warn('failed to remove tmp file'));
380
- }
381
- const obj = {
382
- name,
383
- publisher,
384
- stickerPackId: stickerPackIdValue,
385
- packDescription: description,
386
- stickerPackOrigin: proto.Message.StickerPackMessage.StickerPackOrigin.USER_CREATED,
387
- stickerPackSize: zipBuffer.length,
388
- stickers: stickerMetadata,
389
- fileSha256: stickerPackUpload.fileSha256,
390
- fileEncSha256: stickerPackUpload.fileEncSha256,
391
- mediaKey: stickerPackUpload.mediaKey,
392
- directPath: stickerPackUploadResult.directPath,
393
- fileLength: stickerPackUpload.fileLength,
394
- mediaKeyTimestamp: unixTimestampSeconds(),
395
- trayIconFileName
396
- };
397
- try {
398
- let thumbnailBuffer;
399
- if (hasSharp) {
400
- thumbnailBuffer = await lib.sharp.default(coverBuffer).resize(252, 252).jpeg().toBuffer();
401
- }
402
- else if (hasImage) {
403
- thumbnailBuffer = await new lib.image.Transformer(coverBuffer).resize(252, 252).jpeg();
404
- }
405
- else if (hasJimp) {
406
- const jimpImage = await lib.jimp.Jimp.read(coverBuffer);
407
- thumbnailBuffer = await jimpImage.resize({ w: 252, h: 252 }).getBuffer('image/jpeg');
408
- }
409
- else {
410
- throw new Error('No image processing library available for thumbnail generation');
411
- }
412
- if (!thumbnailBuffer || thumbnailBuffer.length === 0) {
413
- throw new Error('Failed to generate thumbnail buffer');
414
- }
415
- const thumbUpload = await encryptedStream(thumbnailBuffer, 'thumbnail-sticker-pack', {
416
- logger,
417
- opts: options.options,
418
- mediaKey: stickerPackUpload.mediaKey
419
- });
420
- let thumbUploadResult;
421
- try {
422
- thumbUploadResult = await options.upload(thumbUpload.encFilePath, {
423
- fileEncSha256B64: thumbUpload.fileEncSha256.toString('base64'),
424
- mediaType: 'thumbnail-sticker-pack',
425
- timeoutMs: options.mediaUploadTimeoutMs
426
- });
427
- }
428
- finally {
429
- fs.unlink(thumbUpload.encFilePath).catch(() => logger?.warn('failed to remove tmp file'));
430
- }
431
- Object.assign(obj, {
432
- thumbnailDirectPath: thumbUploadResult.directPath,
433
- thumbnailSha256: thumbUpload.fileSha256,
434
- thumbnailEncSha256: thumbUpload.fileEncSha256,
435
- thumbnailHeight: 252,
436
- thumbnailWidth: 252,
437
- imageDataHash: sha256(thumbnailBuffer).toString('base64')
438
- });
439
- }
440
- catch (error) {
441
- logger?.warn(`Thumbnail generation failed: ${error}`);
442
- }
443
- if (cacheableKey) {
444
- logger?.debug({ cacheableKey }, 'set cache (background)');
445
- options.mediaCache.set(cacheableKey, WAProto.Message.StickerPackMessage.encode(obj).finish());
446
- }
447
- return WAProto.Message.StickerPackMessage.fromObject(obj);
448
- };
449
-
450
- const prepareNativeFlowButtons = (message) => {
451
- const buttons = message.nativeFlow;
452
- const isButtonsFieldArray = Array.isArray(buttons);
453
- const correctedField = isButtonsFieldArray ? buttons : buttons.buttons;
454
- const messageParamsJson = {};
455
- if (hasOptionalProperty(message, 'offerText') && !!message.offerText) {
456
- Object.assign(messageParamsJson, {
457
- limited_time_offer: {
458
- text: message.offerText || LIBRARY_NAME,
459
- url: message.offerUrl || DONATE_URL,
460
- copy_code: message.offerCode,
461
- expiration_time: message.offerExpiration
462
- }
463
- });
464
- }
465
- if (hasOptionalProperty(message, 'optionText') && !!message.optionText) {
466
- Object.assign(messageParamsJson, {
467
- bottom_sheet: {
468
- in_thread_buttons_limit: 1,
469
- divider_indices: Array.from({ length: correctedField.length }, (_, index) => index),
470
- list_title: message.optionTitle || '📄 Select Options',
471
- button_title: message.optionText
472
- }
473
- });
474
- }
475
- return {
476
- buttons: correctedField.map(button => {
477
- const buttonText = button.text || button.buttonText;
478
- const buttonIcon = button.icon?.toUpperCase();
479
- if (hasOptionalProperty(button, 'id') && !!button.id) {
480
- return {
481
- name: 'quick_reply',
482
- buttonParamsJson: JSON.stringify({
483
- display_text: buttonText || '👉🏻 Click',
484
- id: button.id,
485
- icon: buttonIcon
486
- })
487
- };
488
- }
489
- else if (hasOptionalProperty(button, 'copy') && !!button.copy) {
490
- return {
491
- name: 'cta_copy',
492
- buttonParamsJson: JSON.stringify({
493
- display_text: buttonText || '📋 Copy',
494
- copy_code: button.copy,
495
- icon: buttonIcon
496
- })
497
- };
498
- }
499
- else if (hasOptionalProperty(button, 'url') && !!button.url) {
500
- return {
501
- name: 'cta_url',
502
- buttonParamsJson: JSON.stringify({
503
- display_text: buttonText || '🌐 Visit',
504
- url: button.url,
505
- merchant_url: button.url,
506
- webview_interaction: button.useWebview,
507
- icon: buttonIcon
508
- })
509
- };
510
- }
511
- else if (hasOptionalProperty(button, 'call') && !!button.call) {
512
- return {
513
- name: 'cta_call',
514
- buttonParamsJson: JSON.stringify({
515
- display_text: buttonText || '📞 Call',
516
- phone_number: button.call,
517
- icon: buttonIcon
518
- })
519
- };
520
- }
521
- else if (hasOptionalProperty(button, 'sections') && !!button.sections) {
522
- return {
523
- name: 'single_select',
524
- buttonParamsJson: JSON.stringify({
525
- title: buttonText || '📋 Select',
526
- sections: button.sections,
527
- icon: buttonIcon
528
- })
529
- };
530
- }
531
- return button;
532
- }),
533
- messageParamsJson: JSON.stringify(messageParamsJson)
534
- };
535
- };
536
-
537
- export const prepareDisappearingMessageSettingContent = (ephemeralExpiration) => {
538
- ephemeralExpiration = ephemeralExpiration || 0;
539
- const content = {
540
- ephemeralMessage: {
541
- message: {
542
- protocolMessage: {
543
- type: WAProto.Message.ProtocolMessage.Type.EPHEMERAL_SETTING,
544
- ephemeralExpiration
545
- }
546
- }
547
- }
548
- };
549
- return WAProto.Message.fromObject(content);
550
- };
551
-
552
- export const generateForwardMessageContent = (message, forceForward) => {
553
- let content = message.message;
554
- if (!content) {
555
- throw new Boom('no content in message', { statusCode: 400 });
556
- }
557
- content = normalizeMessageContent(content);
558
- content = proto.Message.decode(proto.Message.encode(content).finish());
559
- let key = Object.keys(content)[0];
560
- let score = content?.[key]?.contextInfo?.forwardingScore || 0;
561
- score += message.key.fromMe && !forceForward ? 0 : 1;
562
- if (key === 'conversation') {
563
- content.extendedTextMessage = { text: content[key] };
564
- delete content.conversation;
565
- key = 'extendedTextMessage';
566
- }
567
- const key_ = content?.[key];
568
- if (score > 0) {
569
- key_.contextInfo = { forwardingScore: score, isForwarded: true };
570
- }
571
- else {
572
- key_.contextInfo = {};
573
- }
574
- return content;
575
- };
576
-
577
- export const hasNonNullishProperty = (message, key) => {
578
- return message != null &&
579
- typeof message === 'object' &&
580
- key in message &&
581
- message[key] != null;
582
- };
583
-
584
- export const hasOptionalProperty = (obj, key) => {
585
- return obj != null &&
586
- typeof obj === 'object' &&
587
- key in obj &&
588
- obj[key] != null;
589
- };
590
-
591
- export const hasValidAlbumMedia = (message) => {
592
- return !!(message.imageMessage ||
593
- message.videoMessage);
594
- };
595
-
596
- export const hasValidInteractiveHeader = (message) => {
597
- return !!(message.imageMessage ||
598
- message.videoMessage ||
599
- message.documentMessage ||
600
- message.productMessage ||
601
- message.locationMessage);
602
- };
603
-
604
- export const hasValidCarouselHeader = (message) => {
605
- return !!(message.imageMessage ||
606
- message.videoMessage ||
607
- message.productMessage);
608
- };
609
-
610
- export const generateWAMessageContent = async (message, options) => {
611
- var _a, _b;
612
- let m = {};
613
- if (hasNonNullishProperty(message, 'raw')) {
614
- delete message.raw;
615
- return message;
616
- }
617
- else if (hasNonNullishProperty(message, 'code') ||
618
- hasNonNullishProperty(message, 'links') ||
619
- hasNonNullishProperty(message, 'table') ||
620
- hasNonNullishProperty(message, 'richResponse')) {
621
- m = prepareRichResponseMessage(message);
622
- }
623
- else if (hasNonNullishProperty(message, 'text')) {
624
- const extContent = { text: message.text };
625
- let urlInfo = message.linkPreview;
626
- if (typeof urlInfo === 'undefined') {
627
- urlInfo = await generateLinkPreviewIfRequired(message.text, options.getUrlInfo, options.logger);
628
- }
629
- if (urlInfo) {
630
- extContent.matchedText = urlInfo['matched-text'];
631
- extContent.jpegThumbnail = urlInfo.jpegThumbnail;
632
- extContent.description = urlInfo.description;
633
- extContent.title = urlInfo.title;
634
- extContent.previewType = urlInfo.previewType ?? 0;
635
- extContent.linkPreviewMetadata = urlInfo.linkPreviewMetadata;
636
- const img = urlInfo.highQualityThumbnail;
637
- if (img) {
638
- extContent.thumbnailDirectPath = img.directPath;
639
- extContent.mediaKey = img.mediaKey;
640
- extContent.mediaKeyTimestamp = img.mediaKeyTimestamp;
641
- extContent.thumbnailWidth = img.width;
642
- extContent.thumbnailHeight = img.height;
643
- extContent.thumbnailSha256 = img.fileSha256;
644
- extContent.thumbnailEncSha256 = img.fileEncSha256;
645
- }
646
- }
647
- const faviconData = message.favicon;
648
- if (faviconData && typeof options.upload === 'function') {
649
- const { imageMessage } = await prepareWAMessageMedia({
650
- image: faviconData
651
- }, options).catch(() => ({ imageMessage: null }));
652
- if (imageMessage) extContent.faviconMMSMetadata = {
653
- thumbnailDirectPath: imageMessage.directPath,
654
- mediaKey: imageMessage.mediaKey,
655
- mediaKeyTimestamp: imageMessage.mediaKeyTimestamp,
656
- thumbnailWidth: 32,
657
- thumbnailHeight: 32,
658
- thumbnailSha256: imageMessage.fileSha256,
659
- thumbnailEncSha256: imageMessage.fileEncSha256
660
- };
661
- }
662
- if (options.backgroundColor) {
663
- extContent.backgroundArgb = await assertColor(options.backgroundColor);
664
- }
665
- if (options.font) {
666
- extContent.font = options.font;
667
- }
668
- m.extendedTextMessage = extContent;
669
- }
670
- else if (hasNonNullishProperty(message, 'contacts')) {
671
- const contactLen = message.contacts.contacts.length;
672
- if (!contactLen) {
673
- throw new Boom('require atleast 1 contact', { statusCode: 400 });
674
- }
675
- if (contactLen === 1) {
676
- m.contactMessage = WAProto.Message.ContactMessage.create(message.contacts.contacts[0]);
677
- }
678
- else {
679
- m.contactsArrayMessage = WAProto.Message.ContactsArrayMessage.create(message.contacts);
680
- }
681
- }
682
- else if (hasNonNullishProperty(message, 'location')) {
683
- m.locationMessage = WAProto.Message.LocationMessage.create(message.location);
684
- }
685
- else if (hasNonNullishProperty(message, 'react')) {
686
- if (!message.react.senderTimestampMs) {
687
- message.react.senderTimestampMs = Date.now();
688
- }
689
- m.reactionMessage = WAProto.Message.ReactionMessage.create(message.react);
690
- }
691
- else if (hasNonNullishProperty(message, 'delete')) {
692
- m.protocolMessage = {
693
- key: message.delete,
694
- type: WAProto.Message.ProtocolMessage.Type.REVOKE
695
- };
696
- }
697
- else if (hasNonNullishProperty(message, 'forward')) {
698
- m = generateForwardMessageContent(message.forward, message.force);
699
- }
700
- else if (hasNonNullishProperty(message, 'disappearingMessagesInChat')) {
701
- const exp = typeof message.disappearingMessagesInChat === 'boolean'
702
- ? message.disappearingMessagesInChat
703
- ? WA_DEFAULT_EPHEMERAL
704
- : 0
705
- : message.disappearingMessagesInChat;
706
- m = prepareDisappearingMessageSettingContent(exp);
707
- }
708
- else if (hasNonNullishProperty(message, 'groupInvite')) {
709
- m.groupInviteMessage = {};
710
- m.groupInviteMessage.inviteCode = message.groupInvite.inviteCode;
711
- m.groupInviteMessage.inviteExpiration = message.groupInvite.inviteExpiration;
712
- m.groupInviteMessage.caption = message.groupInvite.text;
713
- m.groupInviteMessage.groupJid = message.groupInvite.jid;
714
- m.groupInviteMessage.groupName = message.groupInvite.subject;
715
- if (options.getProfilePicUrl) {
716
- const pfpUrl = await options.getProfilePicUrl(message.groupInvite.jid, 'preview');
717
- if (pfpUrl) {
718
- const resp = await fetch(pfpUrl, { method: 'GET', dispatcher: options?.options?.dispatcher });
719
- if (resp.ok) {
720
- const buf = Buffer.from(await resp.arrayBuffer());
721
- m.groupInviteMessage.jpegThumbnail = buf;
722
- }
723
- }
724
- }
725
- }
726
- else if (hasNonNullishProperty(message, 'stickers')) {
727
- m.stickerPackMessage = await prepareStickerPackMessage(message, options);
728
- }
729
- else if (hasNonNullishProperty(message, 'pin')) {
730
- m.pinInChatMessage = {};
731
- m.messageContextInfo = {};
732
- m.pinInChatMessage.key = message.pin;
733
- m.pinInChatMessage.type = message.type;
734
- m.pinInChatMessage.senderTimestampMs = Date.now();
735
- m.messageContextInfo.messageAddOnDurationInSecs = message.type === 1 ? message.time || 86400 : 0;
736
- }
737
- else if (hasNonNullishProperty(message, 'keep')) {
738
- m.keepInChatMessage = {};
739
- m.keepInChatMessage.key = message.keep;
740
- m.keepInChatMessage.keepType = message.type;
741
- m.keepInChatMessage.timestampMs = Date.now();
742
- }
743
- else if (hasNonNullishProperty(message, 'flowReply')) {
744
- m.interactiveResponseMessage = {
745
- body: {
746
- format: message.flowReply.format || proto.Message.InteractiveResponseMessage.Body.Format.DEFAULT,
747
- text: message.flowReply.text
748
- },
749
- nativeFlowResponseMessage: {
750
- name: message.flowReply.name,
751
- paramsJson: message.flowReply.paramsJson || '{}',
752
- version: message.flowReply.version || 1
753
- }
754
- };
755
- }
756
- else if (hasNonNullishProperty(message, 'buttonReply')) {
757
- switch (message.type) {
758
- case 'template':
759
- m.templateButtonReplyMessage = {
760
- selectedDisplayText: message.buttonReply.displayText,
761
- selectedId: message.buttonReply.id,
762
- selectedIndex: message.buttonReply.index
763
- };
764
- break;
765
- case 'plain':
766
- m.buttonsResponseMessage = {
767
- selectedButtonId: message.buttonReply.id,
768
- selectedDisplayText: message.buttonReply.displayText,
769
- type: proto.Message.ButtonsResponseMessage.Type.DISPLAY_TEXT
770
- };
771
- break;
772
- }
773
- }
774
- else if (hasNonNullishProperty(message, 'listReply')) {
775
- m.listResponseMessage = {
776
- description: message.listReply.description,
777
- listType: proto.Message.ListResponseMessage.ListType.SINGLE_SELECT,
778
- singleSelectReply: {
779
- selectedRowId: message.listReply.id
780
- },
781
- title: message.listReply.title
782
- };
783
- }
784
- else if (hasOptionalProperty(message, 'ptv') && message.ptv) {
785
- const { videoMessage } = await prepareWAMessageMedia({ video: message.video }, options);
786
- m.ptvMessage = videoMessage;
787
- }
788
- else if (hasNonNullishProperty(message, 'product')) {
789
- m.productMessage = await prepareProductMessage(message, options);
790
- }
791
- else if (hasNonNullishProperty(message, 'event')) {
792
- m.eventMessage = {};
793
- const startTime = Math.floor(message.event.startDate.getTime() / 1000);
794
- if (message.event.call && options.getCallLink) {
795
- const token = await options.getCallLink(message.event.call, { startTime });
796
- m.eventMessage.joinLink = (message.event.call === 'audio' ? CALL_AUDIO_PREFIX : CALL_VIDEO_PREFIX) + token;
797
- }
798
- m.messageContextInfo = {
799
- messageSecret: message.event.messageSecret || randomBytes(32)
800
- };
801
- m.eventMessage.name = message.event.name;
802
- m.eventMessage.description = message.event.description;
803
- m.eventMessage.startTime = startTime;
804
- m.eventMessage.endTime = message.event.endDate ? message.event.endDate.getTime() / 1000 : undefined;
805
- m.eventMessage.isCanceled = message.event.isCancelled ?? false;
806
- m.eventMessage.extraGuestsAllowed = message.event.extraGuestsAllowed;
807
- m.eventMessage.isScheduleCall = message.event.isScheduleCall ?? false;
808
- m.eventMessage.location = message.event.location;
809
- }
810
- else if (hasNonNullishProperty(message, 'poll')) {
811
- (_a = message.poll).selectableCount || (_a.selectableCount = 0);
812
- (_b = message.poll).toAnnouncementGroup || (_b.toAnnouncementGroup = false);
813
- if (!Array.isArray(message.poll.values)) {
814
- throw new Boom('Invalid poll values', { statusCode: 400 });
815
- }
816
- if (message.poll.selectableCount < 0 || message.poll.selectableCount > message.poll.values.length) {
817
- throw new Boom(`poll.selectableCount in poll should be >= 0 and <= ${message.poll.values.length}`, {
818
- statusCode: 400
819
- });
820
- }
821
- const pollCreationMessage = {
822
- name: message.poll.name,
823
- selectableOptionsCount: message.poll.selectableCount,
824
- options: message.poll.values.map(optionName => ({ optionName })),
825
- endTime: message.poll.endDate ? message.poll.endDate.getTime() : undefined,
826
- hideParticipantName: message.poll.hideVoter ?? false,
827
- allowAddOption: message.poll.canAddOption ?? false
828
- };
829
- if (message.poll.toAnnouncementGroup) {
830
- m.pollCreationMessageV2 = pollCreationMessage;
831
- }
832
- else {
833
- if (message.poll.pollType === 1) {
834
- if (!message.poll.correctAnswer) {
835
- throw new Boom('No "correctAnswer" provided for quiz', { statusCode: 400 });
836
- }
837
- m.pollCreationMessageV5 = {
838
- ...pollCreationMessage,
839
- correctAnswer: {
840
- optionName: message.poll.correctAnswer.toString()
841
- },
842
- pollType: 1,
843
- selectableOptionsCount: 1
844
- };
845
- }
846
- else if (message.poll.selectableCount === 1) {
847
- m.pollCreationMessageV3 = pollCreationMessage;
848
- }
849
- else {
850
- m.pollCreationMessage = pollCreationMessage;
851
- }
852
- }
853
- m.messageContextInfo = {
854
- messageSecret: message.poll.messageSecret || randomBytes(32)
855
- };
856
- }
857
- else if (hasNonNullishProperty(message, 'pollResult')) {
858
- const pollResultSnapshotMessage = {
859
- name: message.pollResult.name,
860
- pollVotes: message.pollResult.votes.map(vote => ({
861
- optionName: vote.name,
862
- optionVoteCount: parseInt(vote.voteCount)
863
- }))
864
- };
865
- if (message.pollResult.pollType === 1) {
866
- pollResultSnapshotMessage.pollType = proto.Message.PollType.QUIZ;
867
- m.pollResultSnapshotMessageV3 = pollResultSnapshotMessage;
868
- }
869
- else {
870
- pollResultSnapshotMessage.pollType = proto.Message.PollType.POLL;
871
- m.pollResultSnapshotMessage = pollResultSnapshotMessage;
872
- }
873
- }
874
- else if (hasNonNullishProperty(message, 'pollUpdate')) {
875
- if (!message.pollUpdate.key) {
876
- throw new Boom('Message key is required', { statusCode: 400 });
877
- }
878
- if (!message.pollUpdate.vote) {
879
- throw new Boom('Encrypted vote payload is required', { statusCode: 400 });
880
- }
881
- m.pollUpdateMessage = {
882
- metadata: message.pollUpdate.metadata,
883
- pollCreationMessageKey: message.pollUpdate.key,
884
- senderTimestampMs: Date.now(),
885
- vote: message.pollUpdate.vote
886
- };
887
- }
888
- else if (hasNonNullishProperty(message, 'paymentInviteServiceType')) {
889
- m.paymentInviteMessage = {
890
- expiryTimestamp: Date.now(),
891
- serviceType: message.paymentInviteServiceType
892
- };
893
- }
894
- else if (hasNonNullishProperty(message, 'orderText')) {
895
- if (!Buffer.isBuffer(message.thumbnail)) {
896
- throw new Boom('Must provide thumbnail buffer in order message', { statusCode: 400 });
897
- }
898
- m.orderMessage = {
899
- itemCount: 1,
900
- messageVersion: 1,
901
- orderTitle: LIBRARY_NAME,
902
- status: proto.Message.OrderMessage.OrderStatus.INQUIRY,
903
- surface: proto.Message.OrderMessage.OrderSurface.CATALOG,
904
- token: generateMessageIDV2(),
905
- totalAmount1000: 1000,
906
- totalCurrencyCode: 'IDR',
907
- ...message,
908
- message: message.orderText
909
- };
910
- delete m.orderMessage.orderText;
911
- }
912
- else if (hasNonNullishProperty(message, 'album')) {
913
- if (!Array.isArray(message.album)) {
914
- throw new Boom('Invalid album type. Expected an array.', { statusCode: 400 });
915
- }
916
- let videoCount = 0;
917
- for (let i = 0; i < message.album.length; i++) {
918
- if (message.album[i].video) videoCount++;
919
- }
920
- let imageCount = 0;
921
- for (let i = 0; i < message.album.length; i++) {
922
- if (message.album[i].image) imageCount++;
923
- }
924
- if ((videoCount + imageCount) < 2) {
925
- throw new Boom('Minimum provide 2 media to upload album message', { statusCode: 400 });
926
- }
927
- m.albumMessage = {
928
- expectedImageCount: imageCount,
929
- expectedVideoCount: videoCount
930
- };
931
- }
932
- else if (hasNonNullishProperty(message, 'sharePhoneNumber')) {
933
- m.protocolMessage = {
934
- type: proto.Message.ProtocolMessage.Type.SHARE_PHONE_NUMBER
935
- };
936
- }
937
- else if (hasNonNullishProperty(message, 'requestPhoneNumber')) {
938
- m.requestPhoneNumberMessage = {};
939
- }
940
- else if (hasNonNullishProperty(message, 'limitSharing')) {
941
- m.protocolMessage = {
942
- type: proto.Message.ProtocolMessage.Type.LIMIT_SHARING,
943
- limitSharing: {
944
- sharingLimited: message.limitSharing === true,
945
- trigger: 1,
946
- limitSharingSettingTimestamp: Date.now(),
947
- initiatedByMe: true
948
- }
949
- };
950
- }
951
- else {
952
- m = await prepareWAMessageMedia(message, options);
953
- }
954
- if (hasNonNullishProperty(message, 'buttons')) {
955
- const buttonsMessage = {
956
- buttons: message.buttons.map(button => {
957
- const buttonText = button.text || button.buttonText;
958
- if (hasOptionalProperty(button, 'sections')) {
959
- return {
960
- nativeFlowInfo: {
961
- name: 'single_select',
962
- paramsJson: JSON.stringify({
963
- title: buttonText,
964
- sections: button.sections
965
- })
966
- },
967
- type: ButtonType.NATIVE_FLOW
968
- };
969
- }
970
- else if (hasOptionalProperty(button, 'name')) {
971
- return {
972
- nativeFlowInfo: {
973
- name: button.name,
974
- paramsJson: button.paramsJson
975
- },
976
- type: ButtonType.NATIVE_FLOW
977
- };
978
- }
979
- return {
980
- buttonId: button.id || button.buttonId,
981
- buttonText: typeof buttonText === 'string' ? { displayText: buttonText } : buttonText,
982
- type: button.type || ButtonType.RESPONSE
983
- };
984
- })
985
- };
986
- if (hasOptionalProperty(message, 'text')) {
987
- buttonsMessage.contentText = message.text;
988
- buttonsMessage.headerType = ButtonHeaderType.EMPTY;
989
- }
990
- else {
991
- if (hasOptionalProperty(message, 'caption')) {
992
- buttonsMessage.contentText = message.caption;
993
- }
994
- const type = Object.keys(m)[0].replace('Message', '').toUpperCase();
995
- buttonsMessage.headerType = ButtonHeaderType[type];
996
- Object.assign(buttonsMessage, m);
997
- }
998
- if (hasOptionalProperty(message, 'footer')) {
999
- buttonsMessage.footerText = message.footer;
1000
- }
1001
- m = { buttonsMessage };
1002
- }
1003
- else if (hasNonNullishProperty(message, 'sections')) {
1004
- const listMessage = {
1005
- sections: message.sections,
1006
- buttonText: message.buttonText,
1007
- title: message.title,
1008
- footerText: message.footer,
1009
- description: message.text,
1010
- listType: ListType.SINGLE_SELECT
1011
- };
1012
- m = { listMessage };
1013
- }
1014
- else if (hasNonNullishProperty(message, 'templateButtons')) {
1015
- const hydratedTemplate = {
1016
- hydratedButtons: message.templateButtons.map((button, i) => {
1017
- const buttonText = button.text || button.buttonText;
1018
- if (hasOptionalProperty(button, 'id')) {
1019
- return {
1020
- index: i,
1021
- quickReplyButton: {
1022
- displayText: buttonText || '👉🏻 Click',
1023
- id: button.id
1024
- }
1025
- };
1026
- }
1027
- else if (hasOptionalProperty(button, 'url')) {
1028
- return {
1029
- index: i,
1030
- urlButton: {
1031
- displayText: buttonText || '🌐 Visit',
1032
- url: button.url
1033
- }
1034
- };
1035
- }
1036
- else if (hasOptionalProperty(button, 'call')) {
1037
- return {
1038
- index: i,
1039
- callButton: {
1040
- displayText: buttonText || '📞 Call',
1041
- phoneNumber: button.call
1042
- }
1043
- };
1044
- }
1045
- button.index = button.index || i;
1046
- return button;
1047
- })
1048
- };
1049
- if (hasOptionalProperty(message, 'text')) {
1050
- hydratedTemplate.hydratedContentText = message.text;
1051
- }
1052
- else {
1053
- if (hasOptionalProperty(message, 'caption')) {
1054
- hydratedTemplate.hydratedTitleText = message.title;
1055
- hydratedTemplate.hydratedContentText = message.caption;
1056
- }
1057
- Object.assign(hydratedTemplate, m);
1058
- }
1059
- if (hasOptionalProperty(message, 'footer')) {
1060
- hydratedTemplate.hydratedFooterText = message.footer;
1061
- }
1062
- hydratedTemplate.templateId = message.id || 'template-' + Date.now();
1063
- m = {
1064
- templateMessage: {
1065
- hydratedFourRowTemplate: hydratedTemplate,
1066
- hydratedTemplate: hydratedTemplate
1067
- }
1068
- };
1069
- }
1070
- else if (hasNonNullishProperty(message, 'nativeFlow')) {
1071
- const interactiveMessage = {
1072
- nativeFlowMessage: prepareNativeFlowButtons(message)
1073
- };
1074
- if (hasOptionalProperty(message, 'bizJid')) {
1075
- interactiveMessage.collectionMessage = {
1076
- bizJid: message.bizJid,
1077
- id: message.id,
1078
- messageVersion: 1
1079
- };
1080
- }
1081
- else if (hasOptionalProperty(message, 'shopSurface')) {
1082
- interactiveMessage.shopStorefrontMessage = {
1083
- surface: message.shopSurface,
1084
- id: message.id,
1085
- messageVersion: 1
1086
- };
1087
- }
1088
- if (hasOptionalProperty(message, 'text')) {
1089
- interactiveMessage.body = { text: message.text };
1090
- }
1091
- else {
1092
- if (hasOptionalProperty(message, 'caption')) {
1093
- const isValidHeader = hasValidInteractiveHeader(m);
1094
- if (!isValidHeader) {
1095
- throw new Boom('Invalid media type for interactive message header', { statusCode: 400 });
1096
- }
1097
- interactiveMessage.header = {
1098
- title: message.title || '',
1099
- subtitle: message.subtitle || '',
1100
- hasMediaAttachment: isValidHeader
1101
- };
1102
- interactiveMessage.body = { text: message.caption };
1103
- }
1104
- if (hasOptionalProperty(message, 'thumbnail') && !!message.thumbnail) {
1105
- interactiveMessage.jpegThumbnail = message.thumbnail;
1106
- }
1107
- Object.assign(interactiveMessage.header, m);
1108
- }
1109
- if (hasOptionalProperty(message, 'audioFooter')) {
1110
- const { audioMessage } = await prepareWAMessageMedia({
1111
- audio: message.audioFooter
1112
- }, options);
1113
- interactiveMessage.footer = {
1114
- audioMessage,
1115
- hasMediaAttachment: true
1116
- };
1117
- }
1118
- else if (hasOptionalProperty(message, 'footer')) {
1119
- interactiveMessage.footer = { text: message.footer };
1120
- }
1121
- m = { interactiveMessage };
1122
- }
1123
- else if (hasNonNullishProperty(message, 'cards')) {
1124
- const interactiveMessage = {
1125
- carouselMessage: {
1126
- cards: await Promise.all(message.cards.map(async (card) => {
1127
- let carouselHeader = {};
1128
- if (hasNonNullishProperty(card, 'product')) {
1129
- carouselHeader.productMessage = await prepareProductMessage(card, options);
1130
- }
1131
- else {
1132
- carouselHeader = await prepareWAMessageMedia(card, options).catch(() => ({}));
1133
- }
1134
- const isValidHeader = hasValidCarouselHeader(carouselHeader);
1135
- if (!isValidHeader) {
1136
- throw new Boom('Invalid media type for carousel card', { statusCode: 400 });
1137
- }
1138
- const carouselCard = {
1139
- nativeFlowMessage: prepareNativeFlowButtons(card.nativeFlow ? card : [])
1140
- };
1141
- if (hasOptionalProperty(card, 'text')) {
1142
- carouselCard.body = { text: card.text };
1143
- }
1144
- else {
1145
- if (hasOptionalProperty(card, 'caption')) {
1146
- carouselCard.header = {
1147
- title: card.title || '',
1148
- subtitle: card.subtitle || '',
1149
- hasMediaAttachment: isValidHeader
1150
- };
1151
- carouselCard.body = { text: card.caption };
1152
- }
1153
- if (hasOptionalProperty(card, 'thumbnail') && !!card.thumbnail) {
1154
- carouselCard.jpegThumbnail = card.thumbnail;
1155
- }
1156
- Object.assign(carouselCard.header, carouselHeader);
1157
- }
1158
- if (hasOptionalProperty(card, 'audioFooter')) {
1159
- const { audioMessage } = await prepareWAMessageMedia({
1160
- audio: card.audioFooter
1161
- }, options);
1162
- carouselCard.footer = {
1163
- audioMessage,
1164
- hasMediaAttachment: true
1165
- };
1166
- }
1167
- else if (hasOptionalProperty(card, 'footer')) {
1168
- carouselCard.footer = { text: card.footer };
1169
- }
1170
- return carouselCard;
1171
- })),
1172
- carouselCardType: CarouselCardType.UNKNOWN,
1173
- messageVersion: 1
1174
- }
1175
- };
1176
- if (hasOptionalProperty(message, 'text')) {
1177
- interactiveMessage.body = { text: message.text };
1178
- }
1179
- if (hasOptionalProperty(message, 'footer')) {
1180
- interactiveMessage.footer = { text: message.footer };
1181
- }
1182
- m = { interactiveMessage };
1183
- }
1184
- else if (hasNonNullishProperty(message, 'requestPaymentFrom')) {
1185
- const requestPaymentMessage = {
1186
- amount: {
1187
- currencyCode: 'IDR',
1188
- offset: 1000,
1189
- value: 1000
1190
- },
1191
- amount1000: 1000,
1192
- currencyCodeIso4217: 'IDR',
1193
- expiryTimestamp: Date.now(),
1194
- noteMessage: m,
1195
- requestFrom: message.requestPaymentFrom,
1196
- ...message
1197
- };
1198
- delete requestPaymentMessage.requestPaymentFrom;
1199
- if (hasNonNullishProperty(m, 'extendedTextMessage') || hasNonNullishProperty(m, 'stickerMessage')) {
1200
- Object.assign(requestPaymentMessage.noteMessage, m);
1201
- }
1202
- else {
1203
- throw new Boom('Invalid message type for request payment note message', { statusCode: 400 });
1204
- }
1205
- m = { requestPaymentMessage };
1206
- }
1207
- else if (hasNonNullishProperty(message, 'invoiceNote')) {
1208
- const attachment = m.imageMessage || m.documentMessage;
1209
- const type = Object.keys(m)[0].replace('Message', '').toUpperCase();
1210
- const invoiceMessage = {
1211
- attachmentType: proto.Message.InvoiceMessage.AttachmentType[type === 'DOCUMENT' ? 'PDF' : 'IMAGE'],
1212
- note: message.invoiceNote
1213
- };
1214
- if (attachment) {
1215
- const { directPath, fileEncSha256, fileSha256, jpegThumbnail = undefined, mediaKey, mediaKeyTimestamp, mimetype } = attachment;
1216
- Object.assign(invoiceMessage, {
1217
- attachmentDirectPath: directPath,
1218
- attachmentFileEncSha256: fileEncSha256,
1219
- attachmentFileSha256: fileSha256,
1220
- attachmentJpegThumbnail: jpegThumbnail,
1221
- attachmentMediaKey: mediaKey,
1222
- attachmentMediaKeyTimestamp: mediaKeyTimestamp,
1223
- attachmentMimetype: mimetype,
1224
- token: generateMessageIDV2()
1225
- });
1226
- }
1227
- else {
1228
- throw new Boom('Invalid media type for invoice message', { statusCode: 400 });
1229
- }
1230
- m = { invoiceMessage };
1231
- }
1232
- if (hasOptionalProperty(message, 'externalAdReply') && !!message.externalAdReply) {
1233
- const messageType = Object.keys(m)[0];
1234
- const key = m[messageType];
1235
- const content = message.externalAdReply;
1236
- if ('thumbnail' in content && !Buffer.isBuffer(content.thumbnail)) {
1237
- throw new Boom('Thumbnail must in buffer type', { statusCode: 400 });
1238
- }
1239
- if (!content.url || typeof content.url !== 'string') {
1240
- content.url = DONATE_URL;
1241
- }
1242
- const externalAdReply = {
1243
- ...content,
1244
- body: content.body,
1245
- mediaType: content.mediaType || 1,
1246
- mediaUrl: content.url,
1247
- renderLargerThumbnail: content.largeThumbnail,
1248
- sourceUrl: content.url,
1249
- thumbnail: content.thumbnail,
1250
- thumbnailUrl: content.url + '?update=' + Date.now(),
1251
- title: content.title || LIBRARY_NAME
1252
- };
1253
- delete externalAdReply.subTitle;
1254
- delete externalAdReply.largeThumbnail;
1255
- delete externalAdReply.url;
1256
- if ('contextInfo' in key && !!key.contextInfo) {
1257
- key.contextInfo.externalAdReply = { ...key.contextInfo.externalAdReply, ...externalAdReply };
1258
- }
1259
- else if (key) {
1260
- key.contextInfo = { externalAdReply };
1261
- }
1262
- }
1263
- if ((hasOptionalProperty(message, 'mentions') && message.mentions?.length) ||
1264
- (hasOptionalProperty(message, 'mentionAll') && message.mentionAll)) {
1265
- const messageType = Object.keys(m)[0];
1266
- const key = m[messageType];
1267
- if (key && 'contextInfo' in key) {
1268
- key.contextInfo = key.contextInfo || {};
1269
- if (message.mentions?.length) {
1270
- key.contextInfo.mentionedJid = message.mentions;
1271
- }
1272
- if (message.mentionAll) {
1273
- key.contextInfo.nonJidMentions = 1;
1274
- }
1275
- }
1276
- else if (key) {
1277
- key.contextInfo = {
1278
- mentionedJid: message.mentions,
1279
- nonJidMentions: message.mentionAll ? 1 : 0
1280
- };
1281
- }
1282
- }
1283
- if (hasOptionalProperty(message, 'contextInfo') && !!message.contextInfo) {
1284
- const messageType = Object.keys(m)[0];
1285
- const key = m[messageType];
1286
- if ('contextInfo' in key && !!key.contextInfo) {
1287
- key.contextInfo = { ...key.contextInfo, ...message.contextInfo };
1288
- }
1289
- else if (key) {
1290
- key.contextInfo = message.contextInfo;
1291
- }
1292
- }
1293
- if (hasOptionalProperty(message, 'groupStatus') && !!message.groupStatus) {
1294
- const messageType = Object.keys(m)[0];
1295
- const key = m[messageType];
1296
- if ('contextInfo' in key && !!key.contextInfo) {
1297
- key.contextInfo.isGroupStatus = message.groupStatus;
1298
- }
1299
- else if (key) {
1300
- key.contextInfo = {
1301
- isGroupStatus: message.groupStatus
1302
- };
1303
- }
1304
- m = { groupStatusMessageV2: { message: m } };
1305
- delete message.groupStatus;
1306
- }
1307
- if (hasOptionalProperty(message, 'spoiler') && !!message.spoiler) {
1308
- const messageType = Object.keys(m)[0];
1309
- const key = m[messageType];
1310
- if ('contextInfo' in key && !!key.contextInfo) {
1311
- key.contextInfo.isSpoiler = message.spoiler;
1312
- }
1313
- else if (key) {
1314
- key.contextInfo = {
1315
- isSpoiler: message.spoiler
1316
- };
1317
- }
1318
- m = { spoilerMessage: { message: m } };
1319
- delete message.spoiler;
1320
- }
1321
- else if (hasOptionalProperty(message, 'interactiveAsTemplate') && !!message.interactiveAsTemplate) {
1322
- if (!m.interactiveMessage) {
1323
- throw new Boom('Invalid message type for template', { statusCode: 400 });
1324
- }
1325
- m = {
1326
- templateMessage: {
1327
- interactiveMessageTemplate: m.interactiveMessage,
1328
- templateId: message.id || 'template-' + Date.now()
1329
- }
1330
- };
1331
- delete message.interactiveAsTemplate;
1332
- }
1333
- if (hasOptionalProperty(message, 'ephemeral') && !!message.ephemeral) {
1334
- m = { ephemeralMessage: { message: m } };
1335
- delete message.ephemeral;
1336
- }
1337
- if (hasOptionalProperty(message, 'isLottie') && !!message.isLottie) {
1338
- m = { lottieStickerMessage: { message: m } };
1339
- }
1340
- else if (hasOptionalProperty(message, 'viewOnce') && !!message.viewOnce) {
1341
- m = { viewOnceMessage: { message: m } };
1342
- }
1343
- else if (hasOptionalProperty(message, 'viewOnceV2') && !!message.viewOnceV2) {
1344
- m = { viewOnceMessageV2: { message: m } };
1345
- delete message.viewOnceV2;
1346
- }
1347
- else if (hasOptionalProperty(message, 'viewOnceV2Extension') && !!message.viewOnceV2Extension) {
1348
- m = { viewOnceMessageV2Extension: { message: m } };
1349
- delete message.viewOnceV2Extension;
1350
- }
1351
- if (hasOptionalProperty(message, 'edit')) {
1352
- m = {
1353
- protocolMessage: {
1354
- key: message.edit,
1355
- editedMessage: m,
1356
- timestampMs: Date.now(),
1357
- type: WAProto.Message.ProtocolMessage.Type.MESSAGE_EDIT
1358
- }
1359
- };
1360
- }
1361
- if (options?.messageSecret && !m.messageContextInfo?.messageSecret) {
1362
- m.messageContextInfo = { ...(m.messageContextInfo ?? {}), messageSecret: options.messageSecret };
1363
- }
1364
- if (shouldIncludeReportingToken(m)) {
1365
- m.messageContextInfo = m.messageContextInfo || {};
1366
- if (!m.messageContextInfo.messageSecret) {
1367
- m.messageContextInfo.messageSecret = randomBytes(32);
1368
- }
1369
- }
1370
- return WAProto.Message.create(m);
1371
- };
1372
-
1373
- export const generateWAMessageFromContent = (jid, message, options) => {
1374
- if (!options.timestamp) {
1375
- options.timestamp = new Date();
1376
- }
1377
- const innerMessage = normalizeMessageContent(message);
1378
- const messageContextInfo = message.messageContextInfo;
1379
- const key = getContentType(innerMessage);
1380
- const timestamp = unixTimestampSeconds(options.timestamp);
1381
- const isNewsletter = isJidNewsletter(jid);
1382
- const { quoted, userJid } = options;
1383
- if (quoted) {
1384
- const participant = quoted.key.fromMe
1385
- ? userJid
1386
- : quoted.participant || quoted.key.participant || quoted.key.remoteJid;
1387
- let quotedMsg = normalizeMessageContent(quoted.message);
1388
- const msgType = getContentType(quotedMsg);
1389
- quotedMsg = proto.Message.create({ [msgType]: quotedMsg[msgType] });
1390
- const quotedContent = quotedMsg[msgType];
1391
- if (typeof quotedContent === 'object' && quotedContent && 'contextInfo' in quotedContent) {
1392
- delete quotedContent.contextInfo;
1393
- }
1394
- const contextInfo = ('contextInfo' in innerMessage[key] && innerMessage[key]?.contextInfo) || {};
1395
- contextInfo.participant = jidNormalizedUser(participant);
1396
- contextInfo.stanzaId = quoted.key.id;
1397
- contextInfo.quotedMessage = quotedMsg;
1398
- if (!isNewsletter && jid !== quoted.key.remoteJid) {
1399
- contextInfo.remoteJid = quoted.key.remoteJid;
1400
- }
1401
- if (contextInfo && innerMessage[key]) {
1402
- innerMessage[key].contextInfo = contextInfo;
1403
- }
1404
- }
1405
- if (!!options?.ephemeralExpiration &&
1406
- key !== 'protocolMessage' &&
1407
- key !== 'ephemeralMessage' &&
1408
- !isNewsletter) {
1409
- innerMessage[key].contextInfo = {
1410
- ...(innerMessage[key].contextInfo || {}),
1411
- expiration: options.ephemeralExpiration || WA_DEFAULT_EPHEMERAL
1412
- };
1413
- }
1414
- if (messageContextInfo?.messageSecret && (isPnUser(jid) || isLidUser(jid))) {
1415
- messageContextInfo.deviceListMetadata = {
1416
- recipientKeyHash: randomBytes(10),
1417
- recipientTimestamp: unixTimestampSeconds()
1418
- };
1419
- messageContextInfo.deviceListMetadataVersion = 2;
1420
- }
1421
- message = WAProto.Message.create(message);
1422
- const messageJSON = {
1423
- key: {
1424
- remoteJid: jid,
1425
- fromMe: true,
1426
- id: options?.messageId || generateMessageIDV2()
1427
- },
1428
- message: message,
1429
- messageTimestamp: timestamp,
1430
- messageStubParameters: [],
1431
- participant: isJidGroup(jid) || isJidStatusBroadcast(jid) ? userJid : undefined,
1432
- status: WAMessageStatus.PENDING
1433
- };
1434
- return WAProto.WebMessageInfo.fromObject(messageJSON);
1435
- };
1436
-
1437
- export const generateWAMessage = async (jid, content, options) => {
1438
- options.logger = options?.logger?.child({ msgId: options.messageId });
1439
- if (jid) {
1440
- options.jid = jid;
1441
- }
1442
- return generateWAMessageFromContent(jid, await generateWAMessageContent(content, options), options);
1443
- };
1444
-
1445
- export const getContentType = (content) => {
1446
- if (content) {
1447
- const keys = Object.keys(content);
1448
- const key = keys.find(k => (k === 'conversation' || k.includes('Message')) && k !== 'senderKeyDistributionMessage');
1449
- return key;
1450
- }
1451
- };
1452
-
1453
- export const normalizeMessageContent = (content) => {
1454
- if (!content) {
1455
- return undefined;
1456
- }
1457
- for (let i = 0; i < 5; i++) {
1458
- const inner = getFutureProofMessage(content);
1459
- if (!inner) {
1460
- break;
1461
- }
1462
- content = inner.message;
1463
- }
1464
- return content;
1465
- function getFutureProofMessage(message) {
1466
- return (message?.associatedChildMessage ||
1467
- message?.botForwardedMessage ||
1468
- message?.botInvokeMessage ||
1469
- message?.botTaskMessage ||
1470
- message?.documentWithCaptionMessage ||
1471
- message?.editedMessage ||
1472
- message?.ephemeralMessage ||
1473
- message?.eventCoverImage ||
1474
- message?.groupMentionedMessage ||
1475
- message?.groupStatusMentionMessage ||
1476
- message?.groupStatusMessage ||
1477
- message?.groupStatusMessageV2 ||
1478
- message?.limitSharingMessage ||
1479
- message?.lottieStickerMessage ||
1480
- message?.newsletterAdminProfileMessage ||
1481
- message?.newsletterAdminProfileMessageV2 ||
1482
- message?.newsletterAdminProfileStatusMessage ||
1483
- message?.pollCreationMessageV4 ||
1484
- message?.pollCreationOptionImageMessage ||
1485
- message?.questionMessage ||
1486
- message?.questionReplyMessage ||
1487
- message?.spoilerMessage ||
1488
- message?.statusAddYours ||
1489
- message?.statusMentionMessage ||
1490
- message?.viewOnceMessage ||
1491
- message?.viewOnceMessageV2 ||
1492
- message?.viewOnceMessageV2Extension);
1493
- }
1494
- };
1495
-
1496
- export const extractMessageContent = (content) => {
1497
- const extractFromTemplateMessage = (msg) => {
1498
- if (msg.imageMessage) {
1499
- return { imageMessage: msg.imageMessage };
1500
- }
1501
- else if (msg.documentMessage) {
1502
- return { documentMessage: msg.documentMessage };
1503
- }
1504
- else if (msg.videoMessage) {
1505
- return { videoMessage: msg.videoMessage };
1506
- }
1507
- else if (msg.locationMessage) {
1508
- return { locationMessage: msg.locationMessage };
1509
- }
1510
- else {
1511
- return {
1512
- conversation: 'contentText' in msg ? msg.contentText : 'hydratedContentText' in msg ? msg.hydratedContentText : ''
1513
- };
1514
- }
1515
- };
1516
- content = normalizeMessageContent(content);
1517
- if (content?.buttonsMessage) {
1518
- return extractFromTemplateMessage(content.buttonsMessage);
1519
- }
1520
- if (content?.templateMessage?.hydratedFourRowTemplate) {
1521
- return extractFromTemplateMessage(content?.templateMessage?.hydratedFourRowTemplate);
1522
- }
1523
- if (content?.templateMessage?.hydratedTemplate) {
1524
- return extractFromTemplateMessage(content?.templateMessage?.hydratedTemplate);
1525
- }
1526
- if (content?.templateMessage?.fourRowTemplate) {
1527
- return extractFromTemplateMessage(content?.templateMessage?.fourRowTemplate);
1528
- }
1529
- return content;
1530
- };
1531
-
1532
- export const getDevice = (id) => /^3A.{18}$/.test(id)
1533
- ? 'ios'
1534
- : /^3E.{20}$/.test(id)
1535
- ? 'web'
1536
- : /^(.{21}|.{32})$/.test(id)
1537
- ? 'android'
1538
- : /^(3F|.{18}$)/.test(id)
1539
- ? 'desktop'
1540
- : 'unknown';
1541
-
1542
- export const updateMessageWithReceipt = (msg, receipt) => {
1543
- msg.userReceipt = msg.userReceipt || [];
1544
- const recp = msg.userReceipt.find(m => m.userJid === receipt.userJid);
1545
- if (recp) {
1546
- Object.assign(recp, receipt);
1547
- }
1548
- else {
1549
- msg.userReceipt.push(receipt);
1550
- }
1551
- };
1552
-
1553
- export const updateMessageWithReaction = (msg, reaction) => {
1554
- const authorID = getKeyAuthor(reaction.key);
1555
- const reactions = (msg.reactions || []).filter(r => getKeyAuthor(r.key) !== authorID);
1556
- reaction.text = reaction.text || '';
1557
- reactions.push(reaction);
1558
- msg.reactions = reactions;
1559
- };
1560
-
1561
- export const updateMessageWithPollUpdate = (msg, update) => {
1562
- const authorID = getKeyAuthor(update.pollUpdateMessageKey);
1563
- const reactions = (msg.pollUpdates || []).filter(r => getKeyAuthor(r.pollUpdateMessageKey) !== authorID);
1564
- if (update.vote?.selectedOptions?.length) {
1565
- reactions.push(update);
1566
- }
1567
- msg.pollUpdates = reactions;
1568
- };
1569
-
1570
- export const updateMessageWithEventResponse = (msg, update) => {
1571
- const authorID = getKeyAuthor(update.eventResponseMessageKey);
1572
- const responses = (msg.eventResponses || []).filter(r => getKeyAuthor(r.eventResponseMessageKey) !== authorID);
1573
- responses.push(update);
1574
- msg.eventResponses = responses;
1575
- };
1576
-
1577
- export function getAggregateVotesInPollMessage({ message, pollUpdates }, meId) {
1578
- const opts = message?.pollCreationMessage?.options ||
1579
- message?.pollCreationMessageV2?.options ||
1580
- message?.pollCreationMessageV3?.options ||
1581
- [];
1582
- const voteHashMap = opts.reduce((acc, opt) => {
1583
- const hash = sha256(Buffer.from(opt.optionName || '')).toString();
1584
- acc[hash] = {
1585
- name: opt.optionName || '',
1586
- voters: []
1587
- };
1588
- return acc;
1589
- }, {});
1590
- for (const update of pollUpdates || []) {
1591
- const { vote } = update;
1592
- if (!vote) {
1593
- continue;
1594
- }
1595
- for (const option of vote.selectedOptions || []) {
1596
- const hash = option.toString();
1597
- let data = voteHashMap[hash];
1598
- if (!data) {
1599
- voteHashMap[hash] = {
1600
- name: 'Unknown',
1601
- voters: []
1602
- };
1603
- data = voteHashMap[hash];
1604
- }
1605
- voteHashMap[hash].voters.push(getKeyAuthor(update.pollUpdateMessageKey, meId));
1606
- }
1607
- }
1608
- return Object.values(voteHashMap);
1609
- }
1610
-
1611
- export function getAggregateResponsesInEventMessage({ eventResponses }, meId) {
1612
- const responseTypes = ['GOING', 'NOT_GOING', 'MAYBE'];
1613
- const responseMap = {};
1614
- for (const type of responseTypes) {
1615
- responseMap[type] = {
1616
- response: type,
1617
- responders: []
1618
- };
1619
- }
1620
- for (const update of eventResponses || []) {
1621
- const responseType = update.eventResponse || 'UNKNOWN';
1622
- if (responseType !== 'UNKNOWN' && responseMap[responseType]) {
1623
- responseMap[responseType].responders.push(getKeyAuthor(update.eventResponseMessageKey, meId));
1624
- }
1625
- }
1626
- return Object.values(responseMap);
1627
- }
1628
-
1629
- export const aggregateMessageKeysNotFromMe = (keys) => {
1630
- const keyMap = {};
1631
- for (const { remoteJid, id, participant, fromMe } of keys) {
1632
- if (!fromMe) {
1633
- const uqKey = `${remoteJid}:${participant || ''}`;
1634
- if (!keyMap[uqKey]) {
1635
- keyMap[uqKey] = {
1636
- jid: remoteJid,
1637
- participant: participant,
1638
- messageIds: []
1639
- };
1640
- }
1641
- keyMap[uqKey].messageIds.push(id);
1642
- }
1643
- }
1644
- return Object.values(keyMap);
1645
- };
1646
-
1647
- const REUPLOAD_REQUIRED_STATUS = [410, 404];
1648
-
1649
- export const downloadMediaMessage = async (message, type, options, ctx) => {
1650
- const result = await downloadMsg().catch(async (error) => {
1651
- if (ctx &&
1652
- typeof error?.status === 'number' &&
1653
- REUPLOAD_REQUIRED_STATUS.includes(error.status)) {
1654
- ctx.logger.info({ key: message.key }, 'sending reupload media request...');
1655
- message = await ctx.reuploadRequest(message);
1656
- const result = await downloadMsg();
1657
- return result;
1658
- }
1659
- throw error;
1660
- });
1661
- return result;
1662
- async function downloadMsg() {
1663
- const mContent = extractMessageContent(message.message);
1664
- if (!mContent) {
1665
- throw new Boom('No message present', { statusCode: 400, data: message });
1666
- }
1667
- const contentType = getContentType(mContent);
1668
- let mediaType = contentType?.replace('Message', '');
1669
- const media = mContent[contentType];
1670
- if (!media || typeof media !== 'object' || (!('url' in media) && !('thumbnailDirectPath' in media))) {
1671
- throw new Boom(`"${contentType}" message is not a media message`);
1672
- }
1673
- let download;
1674
- if ('thumbnailDirectPath' in media && !('url' in media)) {
1675
- download = {
1676
- directPath: media.thumbnailDirectPath,
1677
- mediaKey: media.mediaKey
1678
- };
1679
- mediaType = 'thumbnail-link';
1680
- }
1681
- else {
1682
- download = media;
1683
- }
1684
- const stream = await downloadContentFromMessage(download, mediaType, options);
1685
- if (type === 'buffer') {
1686
- const bufferArray = [];
1687
- for await (const chunk of stream) {
1688
- bufferArray.push(chunk);
1689
- }
1690
- return Buffer.concat(bufferArray);
1691
- }
1692
- return stream;
1693
- }
1694
- };
1695
-
1696
- export const assertMediaContent = (content) => {
1697
- content = extractMessageContent(content);
1698
- const mediaContent = content?.documentMessage ||
1699
- content?.imageMessage ||
1700
- content?.videoMessage ||
1701
- content?.audioMessage ||
1702
- content?.stickerMessage;
1703
- if (!mediaContent) {
1704
- throw new Boom('given message is not a media message', { statusCode: 400, data: content });
1705
- }
1706
- return mediaContent;
1707
- };
1708
-
1709
- const isAnimatedWebP = (buffer) => {
1710
- if (buffer.length < 12 ||
1711
- buffer[0] !== 0x52 ||
1712
- buffer[1] !== 0x49 ||
1713
- buffer[2] !== 0x46 ||
1714
- buffer[3] !== 0x46 ||
1715
- buffer[8] !== 0x57 ||
1716
- buffer[9] !== 0x45 ||
1717
- buffer[10] !== 0x42 ||
1718
- buffer[11] !== 0x50) {
1719
- return false;
1720
- }
1721
- let offset = 12;
1722
- while (offset < buffer.length - 8) {
1723
- const chunkFourCC = buffer.toString('ascii', offset, offset + 4);
1724
- const chunkSize = buffer.readUInt32LE(offset + 4);
1725
- if (chunkFourCC === 'VP8X') {
1726
- const flagsOffset = offset + 8;
1727
- if (flagsOffset < buffer.length) {
1728
- const flags = buffer[flagsOffset];
1729
- if (flags & 0x02) {
1730
- return true;
1731
- }
1732
- }
1733
- }
1734
- else if (chunkFourCC === 'ANIM' || chunkFourCC === 'ANMF') {
1735
- return true;
1736
- }
1737
- offset += 8 + chunkSize + (chunkSize % 2);
1738
- }
1739
- return false;
1740
- };
1741
-
1742
- const isWebPBuffer = (buffer) => {
1743
- return (buffer.length >= 12 &&
1744
- buffer[0] === 0x52 &&
1745
- buffer[1] === 0x49 &&
1746
- buffer[2] === 0x46 &&
1747
- buffer[3] === 0x46 &&
1748
- buffer[8] === 0x57 &&
1749
- buffer[9] === 0x45 &&
1750
- buffer[10] === 0x42 &&
1751
- buffer[11] === 0x50);
1752
- };
1753
-
1754
- export const shouldIncludeBizBinaryNode = (message) => !!(message.buttonsMessage ||
1755
- message.listMessage ||
1756
- message.templateMessage ||
1757
- (message.interactiveMessage &&
1758
- message.interactiveMessage.nativeFlowMessage));
1759
- //# sourceMappingURL=messages.js.map
1
+ import{Boom}from"\u0040\u0068\u0061\u0070\u0069\u002F\u0062\u006F\u006F\u006D";import{randomBytes}from"\u0063\u0072\u0079\u0070\u0074\u006F";import{zip}from"\u0066\u0066\u006C\u0061\u0074\u0065";import{promises as fs}from"\u0066\u0073";import{proto}from"\u002E\u002E\u002F\u002E\u002E\u002F\u0057\u0041\u0050\u0072\u006F\u0074\u006F\u002F\u0069\u006E\u0064\u0065\u0078\u002E\u006A\u0073";import{CALL_AUDIO_PREFIX,CALL_VIDEO_PREFIX,DONATE_URL,LIBRARY_NAME,MEDIA_KEYS,URL_REGEX,WA_DEFAULT_EPHEMERAL}from"\u002E\u002E\u002F\u0044\u0065\u0066\u0061\u0075\u006C\u0074\u0073\u002F\u0069\u006E\u0064\u0065\u0078\u002E\u006A\u0073";import{AssociationType,ButtonHeaderType,ButtonType,CarouselCardType,ListType,ProtocolType,WAMessageStatus,WAProto}from"\u002E\u002E\u002F\u0054\u0079\u0070\u0065\u0073\u002F\u0069\u006E\u0064\u0065\u0078\u002E\u006A\u0073";import{isLidUser,isPnUser,isJidGroup,isJidNewsletter,isJidStatusBroadcast,jidNormalizedUser}from"\u002E\u002E\u002F\u0057\u0041\u0042\u0069\u006E\u0061\u0072\u0079\u002F\u0069\u006E\u0064\u0065\u0078\u002E\u006A\u0073";import{sha256}from"\u002E\u002F\u0063\u0072\u0079\u0070\u0074\u006F\u002E\u006A\u0073";import{generateMessageIDV2,getKeyAuthor,unixTimestampSeconds}from"\u002E\u002F\u0067\u0065\u006E\u0065\u0072\u0069\u0063\u0073\u002E\u006A\u0073";import{downloadContentFromMessage,encryptedStream,generateThumbnail,getAudioDuration,getAudioWaveform,getImageProcessingLibrary,getRawMediaUploadData,getStream,toBuffer}from"\u002E\u002F\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0073\u002D\u006D\u0065\u0064\u0069\u0061\u002E\u006A\u0073";import{prepareRichResponseMessage}from"\u002E\u002F\u0072\u0069\u0063\u0068\u002D\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u002D\u0075\u0074\u0069\u006C\u0073\u002E\u006A\u0073";import{shouldIncludeReportingToken}from"\u002E\u002F\u0072\u0065\u0070\u006F\u0072\u0074\u0069\u006E\u0067\u002D\u0075\u0074\u0069\u006C\u0073\u002E\u006A\u0073";let _0xac74eb;const CONCURRENCY_LIMIT=655313^655326;_0xac74eb=290715^290706;let _0xebbea;const MIMETYPE_MAP={"image":"\u0069\u006D\u0061\u0067\u0065\u002F\u006A\u0070\u0065\u0067",'\u0076\u0069\u0064\u0065\u006F':'video/mp4',"document":"\u0061\u0070\u0070\u006C\u0069\u0063\u0061\u0074\u0069\u006F\u006E\u002F\u0070\u0064\u0066",'\u0061\u0075\u0064\u0069\u006F':'audio/ogg; codecs=opus',"sticker":"\u0069\u006D\u0061\u0067\u0065\u002F\u0077\u0065\u0062\u0070","\u0070\u0072\u006F\u0064\u0075\u0063\u0074\u002D\u0063\u0061\u0074\u0061\u006C\u006F\u0067\u002D\u0069\u006D\u0061\u0067\u0065":"\u0069\u006D\u0061\u0067\u0065\u002F\u006A\u0070\u0065\u0067"};_0xebbea=201706^201705;const MessageTypeProto={"image":WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0049\u006D\u0061\u0067\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065'],'\u0076\u0069\u0064\u0065\u006F':WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0056\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065'],"audio":WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0041\u0075\u0064\u0069\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065'],'\u0073\u0074\u0069\u0063\u006B\u0065\u0072':WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0053\u0074\u0069\u0063\u006B\u0065\u0072\u004D\u0065\u0073\u0073\u0061\u0067\u0065'],'\u0064\u006F\u0063\u0075\u006D\u0065\u006E\u0074':WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0044\u006F\u0063\u0075\u006D\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']};var _0x93b0a=(894905^894910)+(269308^269310);const mediaAnnotation=[{"polygonVertices":[{'\u0078':60.71664810180664,'\u0079':-36.39784622192383},{'\u0078':-16.710189819335938,'\u0079':49.263675689697266},{'\u0078':-56.585853576660156,'\u0079':37.85963439941406},{'\u0078':20.840980529785156,'\u0079':-47.80188751220703}],"newsletter":{'\u006E\u0065\u0077\u0073\u006C\u0065\u0074\u0074\u0065\u0072\u004A\u0069\u0064':process['\u0065\u006E\u0076']['\u004E\u0045\u0057\u0053\u004C\u0045\u0054\u0054\u0045\u0052\u005F\u0049\u0044']||"\u0031\u0032\u0030\u0033\u0036\u0033\u0034\u0032\u0037\u0031\u0037\u0036\u0036\u0035\u0034\u0035\u0037\u0039\u0040\u006E\u0065\u0077\u0073\u006C\u0065\u0074\u0074\u0065\u0072",'\u006E\u0065\u0077\u0073\u006C\u0065\u0074\u0074\u0065\u0072\u004E\u0061\u006D\u0065':process['\u0065\u006E\u0076']['\u004E\u0045\u0057\u0053\u004C\u0045\u0054\u0054\u0045\u0052\u005F\u004E\u0041\u004D\u0045']||"SYELIAB-AGEM".split("").reverse().join(""),'\u0063\u006F\u006E\u0074\u0065\u006E\u0074\u0054\u0079\u0070\u0065':proto['\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']['\u0046\u006F\u0072\u0077\u0061\u0072\u0064\u0065\u0064\u004E\u0065\u0077\u0073\u006C\u0065\u0074\u0074\u0065\u0072\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0049\u006E\u0066\u006F']['\u0043\u006F\u006E\u0074\u0065\u006E\u0074\u0054\u0079\u0070\u0065']['\u0055\u0050\u0044\u0041\u0054\u0045'],'\u0061\u0063\u0063\u0065\u0073\u0073\u0069\u0062\u0069\u006C\u0069\u0074\u0079\u0054\u0065\u0078\u0074':process['\u0065\u006E\u0076']['\u004E\u0045\u0057\u0053\u004C\u0045\u0054\u0054\u0045\u0052\u005F\u0041\u0043\u0043\u0045\u0053\u0053\u0049\u0042\u0049\u004C\u0049\u0054\u0059\u005F\u0054\u0045\u0058\u0054']||"SYELIAB-AGEM@".split("").reverse().join("")}}];_0x93b0a="ilggmk".split("").reverse().join("");export const extractUrlFromText=text=>text['\u006D\u0061\u0074\u0063\u0068'](URL_REGEX)?.[280288^280288];let _0x4f_0x759;export const generateLinkPreviewIfRequired=async(text,getUrlInfo,logger)=>{let _0xa85efe;const url=extractUrlFromText(text);_0xa85efe=923948^923940;if(!!getUrlInfo&&url){try{const urlInfo=await getUrlInfo(url);return urlInfo;}catch(error){logger?.warn({"trace":error['\u0073\u0074\u0061\u0063\u006B']},"\u0075\u0072\u006C\u0020\u0067\u0065\u006E\u0065\u0072\u0061\u0074\u0069\u006F\u006E\u0020\u0066\u0061\u0069\u006C\u0065\u0064");}}};_0x4f_0x759=(743089^743094)+(253623^253617);var _0xf1d=(141637^141645)+(230711^230710);const assertColor=async color=>{let assertedColor;if(typeof color==="\u006E\u0075\u006D\u0062\u0065\u0072"){assertedColor=color>(932065^932065)?color:0xffffffff+Number(color)+(800815^800814);}else{let _0x91b1c;let hex=color['\u0074\u0072\u0069\u006D']()['\u0072\u0065\u0070\u006C\u0061\u0063\u0065']("\u0023",'');_0x91b1c=(477340^477341)+(881502^881501);if(hex['\u006C\u0065\u006E\u0067\u0074\u0068']<=(970512^970518)){hex="FF".split("").reverse().join("")+hex['\u0070\u0061\u0064\u0053\u0074\u0061\u0072\u0074'](294048^294054,"\u0030");}assertedColor=parseInt(hex,869363^869347);return assertedColor;}};_0xf1d=(315524^315527)+(805108^805116);export const prepareWAMessageMedia=async(message,options)=>{const logger=options['\u006C\u006F\u0067\u0067\u0065\u0072'];let mediaType;for(const key of MEDIA_KEYS){if(key in message){mediaType=key;}}if(!mediaType){throw new Boom("epyt aidem dilavnI".split("").reverse().join(""),{"statusCode":400});}var _0x_0xa5d=(434426^434431)+(456744^456744);const uploadData={...message,'\u006D\u0065\u0064\u0069\u0061':message[mediaType]};_0x_0xa5d="ccaqio".split("").reverse().join("");if(uploadData['\u0069\u006D\u0061\u0067\u0065']||uploadData['\u0076\u0069\u0064\u0065\u006F']){uploadData['\u0061\u006E\u006E\u006F\u0074\u0061\u0074\u0069\u006F\u006E\u0073']=mediaAnnotation;}delete uploadData[mediaType];const cacheableKey=typeof uploadData['\u006D\u0065\u0064\u0069\u0061']==="tcejbo".split("").reverse().join("")&&"\u0075\u0072\u006C"in uploadData['\u006D\u0065\u0064\u0069\u0061']&&!!uploadData['\u006D\u0065\u0064\u0069\u0061']['\u0075\u0072\u006C']&&!!options['\u006D\u0065\u0064\u0069\u0061\u0043\u0061\u0063\u0068\u0065']&&mediaType+"\u003A"+uploadData['\u006D\u0065\u0064\u0069\u0061']['\u0075\u0072\u006C']['\u0074\u006F\u0053\u0074\u0072\u0069\u006E\u0067']();if(mediaType==="tnemucod".split("").reverse().join("")&&!uploadData['\u0066\u0069\u006C\u0065\u004E\u0061\u006D\u0065']){uploadData['\u0066\u0069\u006C\u0065\u004E\u0061\u006D\u0065']="\u0066\u0069\u006C\u0065";}if(!uploadData['\u006D\u0069\u006D\u0065\u0074\u0079\u0070\u0065']){uploadData['\u006D\u0069\u006D\u0065\u0074\u0079\u0070\u0065']=MIMETYPE_MAP[mediaType];}if(cacheableKey){let _0xfb537a;const mediaBuff=await options['\u006D\u0065\u0064\u0069\u0061\u0043\u0061\u0063\u0068\u0065']['\u0067\u0065\u0074'](cacheableKey);_0xfb537a="agoekl".split("").reverse().join("");if(mediaBuff){logger?.debug({'\u0063\u0061\u0063\u0068\u0065\u0061\u0062\u006C\u0065\u004B\u0065\u0079':cacheableKey},"\u0067\u006F\u0074\u0020\u006D\u0065\u0064\u0069\u0061\u0020\u0063\u0061\u0063\u0068\u0065\u0020\u0068\u0069\u0074");let _0x38cc;const obj=proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0064\u0065\u0063\u006F\u0064\u0065'](mediaBuff);_0x38cc=(497307^497311)+(855561^855563);var _0x29d=(467975^467970)+(675683^675681);const key=`${mediaType}Message`;_0x29d=310414^310413;Object['\u0061\u0073\u0073\u0069\u0067\u006E'](obj[key],{...uploadData,"media":undefined});return obj;}}const isNewsletter=!!options['\u006A\u0069\u0064']&&isJidNewsletter(options['\u006A\u0069\u0064']);if(isNewsletter){logger?.info({"key":cacheableKey},"\u0050\u0072\u0065\u0070\u0061\u0072\u0069\u006E\u0067\u0020\u0072\u0061\u0077\u0020\u006D\u0065\u0064\u0069\u0061\u0020\u0066\u006F\u0072\u0020\u006E\u0065\u0077\u0073\u006C\u0065\u0074\u0074\u0065\u0072");const{"filePath":filePath,"fileSha256":fileSha256,'\u0066\u0069\u006C\u0065\u004C\u0065\u006E\u0067\u0074\u0068':fileLength}=await getRawMediaUploadData(uploadData['\u006D\u0065\u0064\u0069\u0061'],options['\u006D\u0065\u0064\u0069\u0061\u0054\u0079\u0070\u0065\u004F\u0076\u0065\u0072\u0072\u0069\u0064\u0065']||mediaType,logger);let _0xa769a;const fileSha256B64=fileSha256['\u0074\u006F\u0053\u0074\u0072\u0069\u006E\u0067']("\u0062\u0061\u0073\u0065\u0036\u0034");_0xa769a=(126102^126099)+(570363^570362);const{"mediaUrl":mediaUrl,"directPath":directPath,"thumbnailDirectPath":thumbnailDirectPath,'\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0053\u0068\u0061\u0032\u0035\u0036':thumbnailSha256}=await options['\u0075\u0070\u006C\u006F\u0061\u0064'](filePath,{'\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036\u0042\u0036\u0034':fileSha256B64,'\u006D\u0065\u0064\u0069\u0061\u0054\u0079\u0070\u0065':mediaType,'\u0074\u0069\u006D\u0065\u006F\u0075\u0074\u004D\u0073':options['\u006D\u0065\u0064\u0069\u0061\u0055\u0070\u006C\u006F\u0061\u0064\u0054\u0069\u006D\u0065\u006F\u0075\u0074\u004D\u0073'],"newsletter":isNewsletter});await fs['\u0075\u006E\u006C\u0069\u006E\u006B'](filePath);var _0xg6a87b=(508349^508344)+(589572^589575);const obj=WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0066\u0072\u006F\u006D\u004F\u0062\u006A\u0065\u0063\u0074']({[`${mediaType}Message`]:MessageTypeProto[mediaType]['\u0066\u0072\u006F\u006D\u004F\u0062\u006A\u0065\u0063\u0074']({'\u0075\u0072\u006C':mediaUrl,'\u0064\u0069\u0072\u0065\u0063\u0074\u0050\u0061\u0074\u0068':directPath,'\u0066\u0069\u006C\u0065\u0053\u0068\u0061\u0032\u0035\u0036':fileSha256,'\u0066\u0069\u006C\u0065\u004C\u0065\u006E\u0067\u0074\u0068':fileLength,"thumbnailDirectPath":thumbnailDirectPath,"thumbnailSha256":thumbnailSha256,...uploadData,'\u006D\u0065\u0064\u0069\u0061':undefined})});_0xg6a87b=(635045^635045)+(656133^656132);if(uploadData['\u0070\u0074\u0076']){obj['\u0070\u0074\u0076\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=obj['\u0076\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065'];delete obj['\u0076\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065'];}if(obj['\u0073\u0074\u0069\u0063\u006B\u0065\u0072\u004D\u0065\u0073\u0073\u0061\u0067\u0065']){obj['\u0073\u0074\u0069\u0063\u006B\u0065\u0072\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0073\u0074\u0069\u0063\u006B\u0065\u0072\u0053\u0065\u006E\u0074\u0054\u0073']=Date['\u006E\u006F\u0077']();}if(cacheableKey){logger?.debug({'\u0063\u0061\u0063\u0068\u0065\u0061\u0062\u006C\u0065\u004B\u0065\u0079':cacheableKey},"ehcac tes".split("").reverse().join(""));await options['\u006D\u0065\u0064\u0069\u0061\u0043\u0061\u0063\u0068\u0065']['\u0073\u0065\u0074'](cacheableKey,WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0065\u006E\u0063\u006F\u0064\u0065'](obj)['\u0066\u0069\u006E\u0069\u0073\u0068']());}return obj;}var _0xb7g=(606426^606428)+(470588^470590);const requiresDurationComputation=mediaType==="oidua".split("").reverse().join("")&&typeof uploadData['\u0073\u0065\u0063\u006F\u006E\u0064\u0073']==="denifednu".split("").reverse().join("");_0xb7g="jpdpkd".split("").reverse().join("");const requiresThumbnailComputation=(mediaType==="egami".split("").reverse().join("")||mediaType==="oediv".split("").reverse().join(""))&&typeof uploadData["\u006A\u0070\u0065\u0067\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C"]==="\u0075\u006E\u0064\u0065\u0066\u0069\u006E\u0065\u0064";const requiresWaveformProcessing=mediaType==="oidua".split("").reverse().join("")&&uploadData['\u0070\u0074\u0074']===!![]&&typeof uploadData['\u0077\u0061\u0076\u0065\u0066\u006F\u0072\u006D']==="\u0075\u006E\u0064\u0065\u0066\u0069\u006E\u0065\u0064";const requiresAudioBackground=options['\u0062\u0061\u0063\u006B\u0067\u0072\u006F\u0075\u006E\u0064\u0043\u006F\u006C\u006F\u0072']&&mediaType==="\u0061\u0075\u0064\u0069\u006F"&&uploadData['\u0070\u0074\u0074']===!![];const requiresOriginalForSomeProcessing=requiresDurationComputation||requiresThumbnailComputation;const{'\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079':mediaKey,'\u0065\u006E\u0063\u0046\u0069\u006C\u0065\u0050\u0061\u0074\u0068':encFilePath,'\u006F\u0072\u0069\u0067\u0069\u006E\u0061\u006C\u0046\u0069\u006C\u0065\u0050\u0061\u0074\u0068':originalFilePath,'\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036':fileEncSha256,'\u0066\u0069\u006C\u0065\u0053\u0068\u0061\u0032\u0035\u0036':fileSha256,'\u0066\u0069\u006C\u0065\u004C\u0065\u006E\u0067\u0074\u0068':fileLength}=await encryptedStream(uploadData['\u006D\u0065\u0064\u0069\u0061'],options['\u006D\u0065\u0064\u0069\u0061\u0054\u0079\u0070\u0065\u004F\u0076\u0065\u0072\u0072\u0069\u0064\u0065']||mediaType,{'\u006C\u006F\u0067\u0067\u0065\u0072':logger,'\u0073\u0061\u0076\u0065\u004F\u0072\u0069\u0067\u0069\u006E\u0061\u006C\u0046\u0069\u006C\u0065\u0049\u0066\u0052\u0065\u0071\u0075\u0069\u0072\u0065\u0064':requiresOriginalForSomeProcessing,"opts":options['\u006F\u0070\u0074\u0069\u006F\u006E\u0073']});const fileEncSha256B64=fileEncSha256['\u0074\u006F\u0053\u0074\u0072\u0069\u006E\u0067']("46esab".split("").reverse().join(""));const[{"mediaUrl":mediaUrl,"directPath":directPath}]=await Promise['\u0061\u006C\u006C']([(async()=>{var _0x4ef9b=(459760^459763)+(588318^588315);const result=await options['\u0075\u0070\u006C\u006F\u0061\u0064'](encFilePath,{'\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036\u0042\u0036\u0034':fileEncSha256B64,'\u006D\u0065\u0064\u0069\u0061\u0054\u0079\u0070\u0065':mediaType,"timeoutMs":options['\u006D\u0065\u0064\u0069\u0061\u0055\u0070\u006C\u006F\u0061\u0064\u0054\u0069\u006D\u0065\u006F\u0075\u0074\u004D\u0073']});_0x4ef9b=(193767^193760)+(148827^148825);logger?.debug({"mediaType":mediaType,"cacheableKey":cacheableKey},"aidem dedaolpu".split("").reverse().join(""));return result;})(),(async()=>{try{if(requiresThumbnailComputation){const{"thumbnail":thumbnail,'\u006F\u0072\u0069\u0067\u0069\u006E\u0061\u006C\u0049\u006D\u0061\u0067\u0065\u0044\u0069\u006D\u0065\u006E\u0073\u0069\u006F\u006E\u0073':originalImageDimensions}=await generateThumbnail(originalFilePath,mediaType,options);uploadData['\u006A\u0070\u0065\u0067\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C']=thumbnail;if(!uploadData['\u0077\u0069\u0064\u0074\u0068']&&originalImageDimensions){uploadData['\u0077\u0069\u0064\u0074\u0068']=originalImageDimensions['\u0077\u0069\u0064\u0074\u0068'];uploadData['\u0068\u0065\u0069\u0067\u0068\u0074']=originalImageDimensions['\u0068\u0065\u0069\u0067\u0068\u0074'];logger?.debug("\u0073\u0065\u0074\u0020\u0064\u0069\u006D\u0065\u006E\u0073\u0069\u006F\u006E\u0073");}logger?.debug("\u0067\u0065\u006E\u0065\u0072\u0061\u0074\u0065\u0064\u0020\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C");}if(requiresDurationComputation){uploadData['\u0073\u0065\u0063\u006F\u006E\u0064\u0073']=await getAudioDuration(originalFilePath);logger?.debug("noitarud oidua detupmoc".split("").reverse().join(""));}if(requiresWaveformProcessing){uploadData['\u0077\u0061\u0076\u0065\u0066\u006F\u0072\u006D']=await getAudioWaveform(originalFilePath,logger);logger?.debug("mrofevaw dessecorp".split("").reverse().join(""));}if(requiresAudioBackground){uploadData['\u0062\u0061\u0063\u006B\u0067\u0072\u006F\u0075\u006E\u0064\u0041\u0072\u0067\u0062']=await assertColor(options['\u0062\u0061\u0063\u006B\u0067\u0072\u006F\u0075\u006E\u0064\u0043\u006F\u006C\u006F\u0072']);logger?.debug("\u0063\u006F\u006D\u0070\u0075\u0074\u0065\u0064\u0020\u0062\u0061\u0063\u006B\u0067\u0072\u006F\u0075\u006E\u0064\u0043\u006F\u006C\u006F\u0072\u0020\u0061\u0075\u0064\u0069\u006F\u0020\u0073\u0074\u0061\u0074\u0075\u0073");}}catch(error){logger?.warn({'\u0074\u0072\u0061\u0063\u0065':error['\u0073\u0074\u0061\u0063\u006B']},"ofni artxe niatbo ot deliaf".split("").reverse().join(""));}})()])['\u0066\u0069\u006E\u0061\u006C\u006C\u0079'](async()=>{try{await fs['\u0075\u006E\u006C\u0069\u006E\u006B'](encFilePath);if(originalFilePath){await fs['\u0075\u006E\u006C\u0069\u006E\u006B'](originalFilePath);}logger?.debug("\u0072\u0065\u006D\u006F\u0076\u0065\u0064\u0020\u0074\u006D\u0070\u0020\u0066\u0069\u006C\u0065\u0073");}catch(error){logger?.warn("elif pmt evomer ot deliaf".split("").reverse().join(""));}});const obj=WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0066\u0072\u006F\u006D\u004F\u0062\u006A\u0065\u0063\u0074']({[`${mediaType}Message`]:MessageTypeProto[mediaType]['\u0066\u0072\u006F\u006D\u004F\u0062\u006A\u0065\u0063\u0074']({"url":mediaUrl,"directPath":directPath,'\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079':mediaKey,'\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036':fileEncSha256,'\u0066\u0069\u006C\u0065\u0053\u0068\u0061\u0032\u0035\u0036':fileSha256,'\u0066\u0069\u006C\u0065\u004C\u0065\u006E\u0067\u0074\u0068':fileLength,"mediaKeyTimestamp":unixTimestampSeconds(),...uploadData,"media":undefined})});if(uploadData['\u0070\u0074\u0076']){obj['\u0070\u0074\u0076\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=obj['\u0076\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065'];delete obj['\u0076\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065'];}if(cacheableKey){logger?.debug({"cacheableKey":cacheableKey},"ehcac tes".split("").reverse().join(""));await options['\u006D\u0065\u0064\u0069\u0061\u0043\u0061\u0063\u0068\u0065']['\u0073\u0065\u0074'](cacheableKey,WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0065\u006E\u0063\u006F\u0064\u0065'](obj)['\u0066\u0069\u006E\u0069\u0073\u0068']());}return obj;};var _0x594d5b=(855280^855289)+(412738^412738);const prepareProductMessage=async(message,options)=>{if(!message['\u0062\u0075\u0073\u0069\u006E\u0065\u0073\u0073\u004F\u0077\u006E\u0065\u0072\u004A\u0069\u0064']){throw new Boom("tnetnoc eht morf gnissim si \"diJrenwOssenisub\"".split("").reverse().join(""),{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}const{'\u0069\u006D\u0061\u0067\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065':imageMessage}=await prepareWAMessageMedia({'\u0069\u006D\u0061\u0067\u0065':message['\u0069\u006D\u0061\u0067\u0065']||message['\u0070\u0072\u006F\u0064\u0075\u0063\u0074']['\u0070\u0072\u006F\u0064\u0075\u0063\u0074\u0049\u006D\u0061\u0067\u0065']},options);const{'\u0069\u006D\u0061\u0067\u0065':image,...content}=message;content['\u0070\u0072\u006F\u0064\u0075\u0063\u0074']={"currencyCode":'IDR',"priceAmount1000":1000,"title":LIBRARY_NAME,...message['\u0070\u0072\u006F\u0064\u0075\u0063\u0074'],'\u0070\u0072\u006F\u0064\u0075\u0063\u0074\u0049\u006D\u0061\u0067\u0065':imageMessage};return content;};_0x594d5b='\u0069\u006F\u0064\u006B\u0064\u0065';let _0xdgfa;const prepareStickerPackMessage=async(message,options)=>{const{"cover":cover,'\u0073\u0074\u0069\u0063\u006B\u0065\u0072\u0073':stickers=[],"name":name="kcaP rekcitS \uDCE6\uD83D".split("").reverse().join(""),'\u0070\u0075\u0062\u006C\u0069\u0073\u0068\u0065\u0072':publisher="\u0047\u0069\u0074\u0048\u0075\u0062\u003A\u0020\u0069\u0074\u0073\u006C\u0069\u0061\u0061\u0061","description":description="syeliab/aaailsti \uFE0F\uDFF7\uD83C".split("").reverse().join("")}=message;if(stickers['\u006C\u0065\u006E\u0067\u0074\u0068']>(765997^765969)){throw new Boom("\u0053\u0074\u0069\u0063\u006B\u0065\u0072\u0020\u0070\u0061\u0063\u006B\u0020\u0065\u0078\u0063\u0065\u0065\u0064\u0073\u0020\u0074\u0068\u0065\u0020\u006D\u0061\u0078\u0069\u006D\u0075\u006D\u0020\u006C\u0069\u006D\u0069\u0074\u0020\u006F\u0066\u0020\u0036\u0030\u0020\u0073\u0074\u0069\u0063\u006B\u0065\u0072\u0073",{"statusCode":400});}if(stickers['\u006C\u0065\u006E\u0067\u0074\u0068']===(599485^599485)){throw new Boom("\u0053\u0074\u0069\u0063\u006B\u0065\u0072\u0020\u0070\u0061\u0063\u006B\u0020\u006D\u0075\u0073\u0074\u0020\u0063\u006F\u006E\u0074\u0061\u0069\u006E\u0020\u0061\u0074\u0020\u006C\u0065\u0061\u0073\u0074\u0020\u006F\u006E\u0065\u0020\u0073\u0074\u0069\u0063\u006B\u0065\u0072",{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}if(!cover){throw new Boom("revoc a niatnoc tsum kcap rekcitS".split("").reverse().join(""),{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}var _0x64d=(941008^941011)+(617691^617693);const logger=options['\u006C\u006F\u0067\u0067\u0065\u0072'];_0x64d=915398^915398;var _0x9bf65c=(454608^454617)+(194271^194265);let cacheableKey=false;_0x9bf65c='\u0065\u0061\u0065\u006D\u0071\u0068';if(Array['\u0069\u0073\u0041\u0072\u0072\u0061\u0079'](stickers)&&stickers['\u006C\u0065\u006E\u0067\u0074\u0068']&&options['\u006D\u0065\u0064\u0069\u0061\u0043\u0061\u0063\u0068\u0065']){const urls=[];for(let i=928326^928326;i<stickers['\u006C\u0065\u006E\u0067\u0074\u0068'];i++){const data=stickers[i]['\u0064\u0061\u0074\u0061'];if(typeof data==="\u006F\u0062\u006A\u0065\u0063\u0074"&&data?.url){urls['\u0070\u0075\u0073\u0068'](data['\u0075\u0072\u006C']);}}if(urls['\u006C\u0065\u006E\u0067\u0074\u0068']>(802355^802355)){cacheableKey=":rekcits".split("").reverse().join("")+urls['\u006A\u006F\u0069\u006E']("\u0040");}}if(cacheableKey){var _0xd_0x87e=(618421^618419)+(820418^820422);const mediaBuff=await options['\u006D\u0065\u0064\u0069\u0061\u0043\u0061\u0063\u0068\u0065']['\u0067\u0065\u0074'](cacheableKey);_0xd_0x87e=137114^137119;if(mediaBuff){logger?.debug({'\u0063\u0061\u0063\u0068\u0065\u0061\u0062\u006C\u0065\u004B\u0065\u0079':cacheableKey},"\u0067\u006F\u0074\u0020\u006D\u0065\u0064\u0069\u0061\u0020\u0063\u0061\u0063\u0068\u0065\u0020\u0068\u0069\u0074");return proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0053\u0074\u0069\u0063\u006B\u0065\u0072\u0050\u0061\u0063\u006B\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0064\u0065\u0063\u006F\u0064\u0065'](mediaBuff);}}var _0x214fe=(970568^970569)+(597260^597262);const lib=await getImageProcessingLibrary();_0x214fe=(230445^230445)+(757131^757122);var _0xcb67a=(120093^120092)+(782971^782962);const hasSharp="prahs".split("").reverse().join("")in lib&&!!lib['\u0073\u0068\u0061\u0072\u0070']?.default;_0xcb67a=(955614^955607)+(352267^352265);const hasImage="egami".split("").reverse().join("")in lib&&!!lib['\u0069\u006D\u0061\u0067\u0065']?.Transformer;const hasJimp="pmij".split("").reverse().join("")in lib&&!!lib['\u006A\u0069\u006D\u0070']?.Jimp;if(!hasSharp&&!hasImage){throw new Boom("\u004E\u006F\u0020\u0069\u006D\u0061\u0067\u0065\u0020\u0070\u0072\u006F\u0063\u0065\u0073\u0073\u0069\u006E\u0067\u0020\u006C\u0069\u0062\u0072\u0061\u0072\u0079\u0020\u0028\u0073\u0068\u0061\u0072\u0070\u0020\u006F\u0072\u0020\u0040\u006E\u0061\u0070\u0069\u002D\u0072\u0073\u002F\u0069\u006D\u0061\u0067\u0065\u0029\u0020\u0061\u0076\u0061\u0069\u006C\u0061\u0062\u006C\u0065\u0020\u0066\u006F\u0072\u0020\u0063\u006F\u006E\u0076\u0065\u0072\u0074\u0069\u006E\u0067\u0020\u0073\u0074\u0069\u0063\u006B\u0065\u0072\u0020\u0074\u006F\u0020\u0057\u0065\u0062\u0050\u002E");}const stickerPackIdValue=generateMessageIDV2();const stickerData={};const stickerMetadata=new Array(stickers['\u006C\u0065\u006E\u0067\u0074\u0068']);for(let i=859775^859775;i<stickers['\u006C\u0065\u006E\u0067\u0074\u0068'];i+=CONCURRENCY_LIMIT){var _0xa_0xa0e=(667590^667598)+(876055^876048);const promises=[];_0xa_0xa0e=(625121^625126)+(634423^634420);let _0xdfbc1d;const chunkEnd=Math['\u006D\u0069\u006E'](i+CONCURRENCY_LIMIT,stickers['\u006C\u0065\u006E\u0067\u0074\u0068']);_0xdfbc1d=487974^487974;for(let j=i;j<chunkEnd;j++){promises['\u0070\u0075\u0073\u0068']((async index=>{let _0x46fe3c;const sticker=stickers[index];_0x46fe3c=(796572^796575)+(708985^708991);const{"stream":stream}=await getStream(sticker['\u0064\u0061\u0074\u0061']);var _0x2acfd=(944559^944552)+(911098^911100);const buffer=await toBuffer(stream);_0x2acfd=(545450^545443)+(134479^134479);var _0x4916b=(932094^932095)+(189906^189910);let webpBuffer;_0x4916b=(676623^676617)+(953633^953638);let _0x40c98c;let isAnimated=false;_0x40c98c=(978274^978275)+(529218^529221);if(isWebPBuffer(buffer)){webpBuffer=buffer;isAnimated=isAnimatedWebP(buffer);}else if(hasSharp){webpBuffer=await lib['\u0073\u0068\u0061\u0072\u0070']['\u0064\u0065\u0066\u0061\u0075\u006C\u0074'](buffer)['\u0072\u0065\u0073\u0069\u007A\u0065'](631395^630883,191109^190597,{'\u0066\u0069\u0074':"\u0069\u006E\u0073\u0069\u0064\u0065"})['\u0077\u0065\u0062\u0070']({"quality":80})['\u0074\u006F\u0042\u0075\u0066\u0066\u0065\u0072']();}else{webpBuffer=await new lib['\u0069\u006D\u0061\u0067\u0065']['\u0054\u0072\u0061\u006E\u0073\u0066\u006F\u0072\u006D\u0065\u0072'](buffer)['\u0072\u0065\u0073\u0069\u007A\u0065'](190195^189683,270559^271071)['\u0077\u0065\u0062\u0070'](446736^446784);}if(webpBuffer['\u006C\u0065\u006E\u0067\u0074\u0068']>(314177^315201)*(871665^870641)){throw new Boom(`Sticker at index ${index} exceeds the 1MB size limit`,{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}const hash=sha256(webpBuffer)['\u0074\u006F\u0053\u0074\u0072\u0069\u006E\u0067']("\u0062\u0061\u0073\u0065\u0036\u0034")['\u0072\u0065\u0070\u006C\u0061\u0063\u0065'](new RegExp('\u005C\u002F','\u0067'),"\u002D");var _0x6e_0x28d=(582153^582144)+(435176^435182);const fileName=`${hash}.webp`;_0x6e_0x28d=(163586^163587)+(972928^972936);stickerData[fileName]=[new Uint8Array(webpBuffer),{'\u006C\u0065\u0076\u0065\u006C':0}];stickerMetadata[index]={'\u0066\u0069\u006C\u0065\u004E\u0061\u006D\u0065':fileName,"mimetype":"\u0069\u006D\u0061\u0067\u0065\u002F\u0077\u0065\u0062\u0070","isAnimated":isAnimated,'\u0065\u006D\u006F\u006A\u0069\u0073':sticker['\u0065\u006D\u006F\u006A\u0069\u0073']||["\u2728"],"accessibilityLabel":sticker['\u0061\u0063\u0063\u0065\u0073\u0073\u0069\u0062\u0069\u006C\u0069\u0074\u0079\u004C\u0061\u0062\u0065\u006C']||"\u200E"};})(j));}await Promise['\u0061\u006C\u006C'](promises);}const trayIconFileName=`${stickerPackIdValue}.webp`;const{'\u0073\u0074\u0072\u0065\u0061\u006D':coverStream}=await getStream(cover);const coverBuffer=await toBuffer(coverStream);let coverWebpBuffer;if(isWebPBuffer(coverBuffer)){coverWebpBuffer=coverBuffer;}else if(hasSharp){coverWebpBuffer=await lib['\u0073\u0068\u0061\u0072\u0070']['\u0064\u0065\u0066\u0061\u0075\u006C\u0074'](coverBuffer)['\u0072\u0065\u0073\u0069\u007A\u0065'](233393^232881,642099^642611,{"fit":"\u0069\u006E\u0073\u0069\u0064\u0065"})['\u0077\u0065\u0062\u0070']({'\u0071\u0075\u0061\u006C\u0069\u0074\u0079':80})['\u0074\u006F\u0042\u0075\u0066\u0066\u0065\u0072']();}else{coverWebpBuffer=await new lib['\u0069\u006D\u0061\u0067\u0065']['\u0054\u0072\u0061\u006E\u0073\u0066\u006F\u0072\u006D\u0065\u0072'](coverBuffer)['\u0072\u0065\u0073\u0069\u007A\u0065'](917882^918394,427746^427234)['\u0077\u0065\u0062\u0070'](842031^842111);}stickerData[trayIconFileName]=[new Uint8Array(coverWebpBuffer),{"level":0}];var _0xc7ec9b=(468146^468145)+(348623^348621);const zipBuffer=await new Promise((resolve,reject)=>{zip(stickerData,(error,data)=>error?reject(error):resolve(Buffer['\u0066\u0072\u006F\u006D'](data)));});_0xc7ec9b='\u0065\u0061\u0065\u0069\u006D\u006A';let _0xd639f;const stickerPackUpload=await encryptedStream(zipBuffer,"kcap-rekcits".split("").reverse().join(""),{"logger":logger,"opts":options['\u006F\u0070\u0074\u0069\u006F\u006E\u0073']});_0xd639f=334125^334120;let _0x2f5b;let stickerPackUploadResult;_0x2f5b=(443836^443832)+(823774^823770);try{stickerPackUploadResult=await options['\u0075\u0070\u006C\u006F\u0061\u0064'](stickerPackUpload['\u0065\u006E\u0063\u0046\u0069\u006C\u0065\u0050\u0061\u0074\u0068'],{'\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036\u0042\u0036\u0034':stickerPackUpload['\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036']['\u0074\u006F\u0053\u0074\u0072\u0069\u006E\u0067']("\u0062\u0061\u0073\u0065\u0036\u0034"),'\u006D\u0065\u0064\u0069\u0061\u0054\u0079\u0070\u0065':'sticker-pack',"timeoutMs":options['\u006D\u0065\u0064\u0069\u0061\u0055\u0070\u006C\u006F\u0061\u0064\u0054\u0069\u006D\u0065\u006F\u0075\u0074\u004D\u0073']});}finally{fs['\u0075\u006E\u006C\u0069\u006E\u006B'](stickerPackUpload['\u0065\u006E\u0063\u0046\u0069\u006C\u0065\u0050\u0061\u0074\u0068'])['\u0063\u0061\u0074\u0063\u0068'](()=>logger?.warn("\u0066\u0061\u0069\u006C\u0065\u0064\u0020\u0074\u006F\u0020\u0072\u0065\u006D\u006F\u0076\u0065\u0020\u0074\u006D\u0070\u0020\u0066\u0069\u006C\u0065"));}const obj={"name":name,'\u0070\u0075\u0062\u006C\u0069\u0073\u0068\u0065\u0072':publisher,"stickerPackId":stickerPackIdValue,'\u0070\u0061\u0063\u006B\u0044\u0065\u0073\u0063\u0072\u0069\u0070\u0074\u0069\u006F\u006E':description,'\u0073\u0074\u0069\u0063\u006B\u0065\u0072\u0050\u0061\u0063\u006B\u004F\u0072\u0069\u0067\u0069\u006E':proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0053\u0074\u0069\u0063\u006B\u0065\u0072\u0050\u0061\u0063\u006B\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0053\u0074\u0069\u0063\u006B\u0065\u0072\u0050\u0061\u0063\u006B\u004F\u0072\u0069\u0067\u0069\u006E']['\u0055\u0053\u0045\u0052\u005F\u0043\u0052\u0045\u0041\u0054\u0045\u0044'],"stickerPackSize":zipBuffer['\u006C\u0065\u006E\u0067\u0074\u0068'],'\u0073\u0074\u0069\u0063\u006B\u0065\u0072\u0073':stickerMetadata,"fileSha256":stickerPackUpload['\u0066\u0069\u006C\u0065\u0053\u0068\u0061\u0032\u0035\u0036'],'\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036':stickerPackUpload['\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036'],"mediaKey":stickerPackUpload['\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079'],"directPath":stickerPackUploadResult['\u0064\u0069\u0072\u0065\u0063\u0074\u0050\u0061\u0074\u0068'],"fileLength":stickerPackUpload['\u0066\u0069\u006C\u0065\u004C\u0065\u006E\u0067\u0074\u0068'],"mediaKeyTimestamp":unixTimestampSeconds(),'\u0074\u0072\u0061\u0079\u0049\u0063\u006F\u006E\u0046\u0069\u006C\u0065\u004E\u0061\u006D\u0065':trayIconFileName};try{let thumbnailBuffer;if(hasSharp){thumbnailBuffer=await lib['\u0073\u0068\u0061\u0072\u0070']['\u0064\u0065\u0066\u0061\u0075\u006C\u0074'](coverBuffer)['\u0072\u0065\u0073\u0069\u007A\u0065'](549165^549329,410077^409889)['\u006A\u0070\u0065\u0067']()['\u0074\u006F\u0042\u0075\u0066\u0066\u0065\u0072']();}else if(hasImage){thumbnailBuffer=await new lib['\u0069\u006D\u0061\u0067\u0065']['\u0054\u0072\u0061\u006E\u0073\u0066\u006F\u0072\u006D\u0065\u0072'](coverBuffer)['\u0072\u0065\u0073\u0069\u007A\u0065'](470253^470033,139799^140011)['\u006A\u0070\u0065\u0067']();}else if(hasJimp){var _0x9c8aa=(667254^667255)+(549553^549558);const jimpImage=await lib['\u006A\u0069\u006D\u0070']['\u004A\u0069\u006D\u0070']['\u0072\u0065\u0061\u0064'](coverBuffer);_0x9c8aa=(695857^695860)+(831174^831183);thumbnailBuffer=await jimpImage['\u0072\u0065\u0073\u0069\u007A\u0065']({'\u0077':252,'\u0068':252})['\u0067\u0065\u0074\u0042\u0075\u0066\u0066\u0065\u0072']("\u0069\u006D\u0061\u0067\u0065\u002F\u006A\u0070\u0065\u0067");}else{throw new Error("\u004E\u006F\u0020\u0069\u006D\u0061\u0067\u0065\u0020\u0070\u0072\u006F\u0063\u0065\u0073\u0073\u0069\u006E\u0067\u0020\u006C\u0069\u0062\u0072\u0061\u0072\u0079\u0020\u0061\u0076\u0061\u0069\u006C\u0061\u0062\u006C\u0065\u0020\u0066\u006F\u0072\u0020\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0020\u0067\u0065\u006E\u0065\u0072\u0061\u0074\u0069\u006F\u006E");}if(!thumbnailBuffer||thumbnailBuffer['\u006C\u0065\u006E\u0067\u0074\u0068']===(701796^701796)){throw new Error("\u0046\u0061\u0069\u006C\u0065\u0064\u0020\u0074\u006F\u0020\u0067\u0065\u006E\u0065\u0072\u0061\u0074\u0065\u0020\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0020\u0062\u0075\u0066\u0066\u0065\u0072");}let _0x0c58ce;const thumbUpload=await encryptedStream(thumbnailBuffer,"\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u002D\u0073\u0074\u0069\u0063\u006B\u0065\u0072\u002D\u0070\u0061\u0063\u006B",{'\u006C\u006F\u0067\u0067\u0065\u0072':logger,'\u006F\u0070\u0074\u0073':options['\u006F\u0070\u0074\u0069\u006F\u006E\u0073'],'\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079':stickerPackUpload['\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079']});_0x0c58ce="lpcmde".split("").reverse().join("");var _0xd55a6e=(625941^625940)+(748153^748145);let thumbUploadResult;_0xd55a6e=419064^419066;try{thumbUploadResult=await options['\u0075\u0070\u006C\u006F\u0061\u0064'](thumbUpload['\u0065\u006E\u0063\u0046\u0069\u006C\u0065\u0050\u0061\u0074\u0068'],{"fileEncSha256B64":thumbUpload['\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036']['\u0074\u006F\u0053\u0074\u0072\u0069\u006E\u0067']("\u0062\u0061\u0073\u0065\u0036\u0034"),"mediaType":'thumbnail-sticker-pack',"timeoutMs":options['\u006D\u0065\u0064\u0069\u0061\u0055\u0070\u006C\u006F\u0061\u0064\u0054\u0069\u006D\u0065\u006F\u0075\u0074\u004D\u0073']});}finally{fs['\u0075\u006E\u006C\u0069\u006E\u006B'](thumbUpload['\u0065\u006E\u0063\u0046\u0069\u006C\u0065\u0050\u0061\u0074\u0068'])['\u0063\u0061\u0074\u0063\u0068'](()=>logger?.warn("\u0066\u0061\u0069\u006C\u0065\u0064\u0020\u0074\u006F\u0020\u0072\u0065\u006D\u006F\u0076\u0065\u0020\u0074\u006D\u0070\u0020\u0066\u0069\u006C\u0065"));}Object['\u0061\u0073\u0073\u0069\u0067\u006E'](obj,{"thumbnailDirectPath":thumbUploadResult['\u0064\u0069\u0072\u0065\u0063\u0074\u0050\u0061\u0074\u0068'],'\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0053\u0068\u0061\u0032\u0035\u0036':thumbUpload['\u0066\u0069\u006C\u0065\u0053\u0068\u0061\u0032\u0035\u0036'],'\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036':thumbUpload['\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036'],'\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0048\u0065\u0069\u0067\u0068\u0074':252,"thumbnailWidth":252,"imageDataHash":sha256(thumbnailBuffer)['\u0074\u006F\u0053\u0074\u0072\u0069\u006E\u0067']("\u0062\u0061\u0073\u0065\u0036\u0034")});}catch(error){logger?.warn(`Thumbnail generation failed: ${error}`);}if(cacheableKey){logger?.debug({'\u0063\u0061\u0063\u0068\u0065\u0061\u0062\u006C\u0065\u004B\u0065\u0079':cacheableKey},")dnuorgkcab( ehcac tes".split("").reverse().join(""));options['\u006D\u0065\u0064\u0069\u0061\u0043\u0061\u0063\u0068\u0065']['\u0073\u0065\u0074'](cacheableKey,WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0053\u0074\u0069\u0063\u006B\u0065\u0072\u0050\u0061\u0063\u006B\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0065\u006E\u0063\u006F\u0064\u0065'](obj)['\u0066\u0069\u006E\u0069\u0073\u0068']());}return WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0053\u0074\u0069\u0063\u006B\u0065\u0072\u0050\u0061\u0063\u006B\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0066\u0072\u006F\u006D\u004F\u0062\u006A\u0065\u0063\u0074'](obj);};_0xdgfa='\u0065\u006E\u0065\u0061\u0066\u0070';let _0x6eea;const prepareNativeFlowButtons=message=>{const buttons=message['\u006E\u0061\u0074\u0069\u0076\u0065\u0046\u006C\u006F\u0077'];const isButtonsFieldArray=Array['\u0069\u0073\u0041\u0072\u0072\u0061\u0079'](buttons);var _0x73799b=(713802^713806)+(398516^398524);const correctedField=isButtonsFieldArray?buttons:buttons['\u0062\u0075\u0074\u0074\u006F\u006E\u0073'];_0x73799b='\u006D\u006F\u0071\u0064\u0068\u006C';var _0xe_0x4e8=(175099^175100)+(431467^431466);const messageParamsJson={};_0xe_0x4e8=(542413^542408)+(716444^716441);if(hasOptionalProperty(message,"\u006F\u0066\u0066\u0065\u0072\u0054\u0065\u0078\u0074")&&!!message['\u006F\u0066\u0066\u0065\u0072\u0054\u0065\u0078\u0074']){Object['\u0061\u0073\u0073\u0069\u0067\u006E'](messageParamsJson,{"limited_time_offer":{"text":message['\u006F\u0066\u0066\u0065\u0072\u0054\u0065\u0078\u0074']||LIBRARY_NAME,'\u0075\u0072\u006C':message['\u006F\u0066\u0066\u0065\u0072\u0055\u0072\u006C']||DONATE_URL,'\u0063\u006F\u0070\u0079\u005F\u0063\u006F\u0064\u0065':message['\u006F\u0066\u0066\u0065\u0072\u0043\u006F\u0064\u0065'],"expiration_time":message['\u006F\u0066\u0066\u0065\u0072\u0045\u0078\u0070\u0069\u0072\u0061\u0074\u0069\u006F\u006E']}});}if(hasOptionalProperty(message,"txeTnoitpo".split("").reverse().join(""))&&!!message['\u006F\u0070\u0074\u0069\u006F\u006E\u0054\u0065\u0078\u0074']){Object['\u0061\u0073\u0073\u0069\u0067\u006E'](messageParamsJson,{'\u0062\u006F\u0074\u0074\u006F\u006D\u005F\u0073\u0068\u0065\u0065\u0074':{'\u0069\u006E\u005F\u0074\u0068\u0072\u0065\u0061\u0064\u005F\u0062\u0075\u0074\u0074\u006F\u006E\u0073\u005F\u006C\u0069\u006D\u0069\u0074':1,"divider_indices":Array['\u0066\u0072\u006F\u006D']({'\u006C\u0065\u006E\u0067\u0074\u0068':correctedField['\u006C\u0065\u006E\u0067\u0074\u0068']},(_,index)=>index),'\u006C\u0069\u0073\u0074\u005F\u0074\u0069\u0074\u006C\u0065':message['\u006F\u0070\u0074\u0069\u006F\u006E\u0054\u0069\u0074\u006C\u0065']||"\uD83D\uDCC4\u0020\u0053\u0065\u006C\u0065\u0063\u0074\u0020\u004F\u0070\u0074\u0069\u006F\u006E\u0073","button_title":message['\u006F\u0070\u0074\u0069\u006F\u006E\u0054\u0065\u0078\u0074']}});}return{'\u0062\u0075\u0074\u0074\u006F\u006E\u0073':correctedField['\u006D\u0061\u0070'](button=>{const buttonText=button['\u0074\u0065\u0078\u0074']||button['\u0062\u0075\u0074\u0074\u006F\u006E\u0054\u0065\u0078\u0074'];let _0xc955e;const buttonIcon=button['\u0069\u0063\u006F\u006E']?.toUpperCase();_0xc955e="oiackp".split("").reverse().join("");if(hasOptionalProperty(button,"\u0069\u0064")&&!!button['\u0069\u0064']){return{'\u006E\u0061\u006D\u0065':"\u0071\u0075\u0069\u0063\u006B\u005F\u0072\u0065\u0070\u006C\u0079","buttonParamsJson":JSON['\u0073\u0074\u0072\u0069\u006E\u0067\u0069\u0066\u0079']({"display_text":buttonText||"\uD83D\uDC49\uD83C\uDFFB\u0020\u0043\u006C\u0069\u0063\u006B",'\u0069\u0064':button['\u0069\u0064'],"icon":buttonIcon})};}else if(hasOptionalProperty(button,"\u0063\u006F\u0070\u0079")&&!!button['\u0063\u006F\u0070\u0079']){return{'\u006E\u0061\u006D\u0065':"\u0063\u0074\u0061\u005F\u0063\u006F\u0070\u0079",'\u0062\u0075\u0074\u0074\u006F\u006E\u0050\u0061\u0072\u0061\u006D\u0073\u004A\u0073\u006F\u006E':JSON['\u0073\u0074\u0072\u0069\u006E\u0067\u0069\u0066\u0079']({"display_text":buttonText||"\uD83D\uDCCB\u0020\u0043\u006F\u0070\u0079","copy_code":button['\u0063\u006F\u0070\u0079'],'\u0069\u0063\u006F\u006E':buttonIcon})};}else if(hasOptionalProperty(button,"lru".split("").reverse().join(""))&&!!button['\u0075\u0072\u006C']){return{"name":'cta_url','\u0062\u0075\u0074\u0074\u006F\u006E\u0050\u0061\u0072\u0061\u006D\u0073\u004A\u0073\u006F\u006E':JSON['\u0073\u0074\u0072\u0069\u006E\u0067\u0069\u0066\u0079']({"display_text":buttonText||"\uD83C\uDF10\u0020\u0056\u0069\u0073\u0069\u0074","url":button['\u0075\u0072\u006C'],'\u006D\u0065\u0072\u0063\u0068\u0061\u006E\u0074\u005F\u0075\u0072\u006C':button['\u0075\u0072\u006C'],'\u0077\u0065\u0062\u0076\u0069\u0065\u0077\u005F\u0069\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u006F\u006E':button['\u0075\u0073\u0065\u0057\u0065\u0062\u0076\u0069\u0065\u0077'],'\u0069\u0063\u006F\u006E':buttonIcon})};}else if(hasOptionalProperty(button,"llac".split("").reverse().join(""))&&!!button['\u0063\u0061\u006C\u006C']){return{"name":"\u0063\u0074\u0061\u005F\u0063\u0061\u006C\u006C",'\u0062\u0075\u0074\u0074\u006F\u006E\u0050\u0061\u0072\u0061\u006D\u0073\u004A\u0073\u006F\u006E':JSON['\u0073\u0074\u0072\u0069\u006E\u0067\u0069\u0066\u0079']({'\u0064\u0069\u0073\u0070\u006C\u0061\u0079\u005F\u0074\u0065\u0078\u0074':buttonText||"\uD83D\uDCDE\u0020\u0043\u0061\u006C\u006C",'\u0070\u0068\u006F\u006E\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072':button['\u0063\u0061\u006C\u006C'],'\u0069\u0063\u006F\u006E':buttonIcon})};}else if(hasOptionalProperty(button,"\u0073\u0065\u0063\u0074\u0069\u006F\u006E\u0073")&&!!button['\u0073\u0065\u0063\u0074\u0069\u006F\u006E\u0073']){return{'\u006E\u0061\u006D\u0065':"\u0073\u0069\u006E\u0067\u006C\u0065\u005F\u0073\u0065\u006C\u0065\u0063\u0074",'\u0062\u0075\u0074\u0074\u006F\u006E\u0050\u0061\u0072\u0061\u006D\u0073\u004A\u0073\u006F\u006E':JSON['\u0073\u0074\u0072\u0069\u006E\u0067\u0069\u0066\u0079']({"title":buttonText||"tceleS \uDCCB\uD83D".split("").reverse().join(""),"sections":button['\u0073\u0065\u0063\u0074\u0069\u006F\u006E\u0073'],"icon":buttonIcon})};}return button;}),'\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0050\u0061\u0072\u0061\u006D\u0073\u004A\u0073\u006F\u006E':JSON['\u0073\u0074\u0072\u0069\u006E\u0067\u0069\u0066\u0079'](messageParamsJson)};};_0x6eea="kbqmpd".split("").reverse().join("");export const prepareDisappearingMessageSettingContent=ephemeralExpiration=>{ephemeralExpiration=ephemeralExpiration||887512^887512;let _0x5eeeag;const content={'\u0065\u0070\u0068\u0065\u006D\u0065\u0072\u0061\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065':{'\u006D\u0065\u0073\u0073\u0061\u0067\u0065':{'\u0070\u0072\u006F\u0074\u006F\u0063\u006F\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065':{"type":WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0050\u0072\u006F\u0074\u006F\u0063\u006F\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0054\u0079\u0070\u0065']['\u0045\u0050\u0048\u0045\u004D\u0045\u0052\u0041\u004C\u005F\u0053\u0045\u0054\u0054\u0049\u004E\u0047'],"ephemeralExpiration":ephemeralExpiration}}}};_0x5eeeag="kboibm".split("").reverse().join("");return WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0066\u0072\u006F\u006D\u004F\u0062\u006A\u0065\u0063\u0074'](content);};var _0xg6bff=(929253^929249)+(207996^207998);export const generateForwardMessageContent=(message,forceForward)=>{var _0xf_0x469=(972931^972934)+(710502^710498);let content=message['\u006D\u0065\u0073\u0073\u0061\u0067\u0065'];_0xf_0x469=(221336^221328)+(701985^701990);if(!content){throw new Boom("\u006E\u006F\u0020\u0063\u006F\u006E\u0074\u0065\u006E\u0074\u0020\u0069\u006E\u0020\u006D\u0065\u0073\u0073\u0061\u0067\u0065",{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}content=normalizeMessageContent(content);content=proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0064\u0065\u0063\u006F\u0064\u0065'](proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0065\u006E\u0063\u006F\u0064\u0065'](content)['\u0066\u0069\u006E\u0069\u0073\u0068']());let _0xa526a;let key=Object['\u006B\u0065\u0079\u0073'](content)[568244^568244];_0xa526a=(154202^154194)+(873181^873173);let _0x3951c;let score=content?.[key]?.contextInfo?.forwardingScore||967215^967215;_0x3951c=(841098^841101)+(390456^390461);score+=message['\u006B\u0065\u0079']['\u0066\u0072\u006F\u006D\u004D\u0065']&&!forceForward?664045^664045:875615^875614;if(key==="noitasrevnoc".split("").reverse().join("")){content['\u0065\u0078\u0074\u0065\u006E\u0064\u0065\u0064\u0054\u0065\u0078\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={"text":content[key]};delete content['\u0063\u006F\u006E\u0076\u0065\u0072\u0073\u0061\u0074\u0069\u006F\u006E'];key="egasseMtxeTdednetxe".split("").reverse().join("");}var _0xa40c7a=(720672^720679)+(694072^694065);const key_=content?.[key];_0xa40c7a=(370871^370871)+(765183^765179);if(score>(605468^605468)){key_['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={'\u0066\u006F\u0072\u0077\u0061\u0072\u0064\u0069\u006E\u0067\u0053\u0063\u006F\u0072\u0065':score,"isForwarded":!![]};}else{key_['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={};}return content;};_0xg6bff=386823^386818;let _0xe12eb;export const hasNonNullishProperty=(message,key)=>{return message!=null&&typeof message==="\u006F\u0062\u006A\u0065\u0063\u0074"&&key in message&&message[key]!=null;};_0xe12eb=111630^111623;var _0x649e=(278252^278248)+(434015^434009);export const hasOptionalProperty=(obj,key)=>{return obj!=null&&typeof obj==="\u006F\u0062\u006A\u0065\u0063\u0074"&&key in obj&&obj[key]!=null;};_0x649e=788987^788988;export const hasValidAlbumMedia=message=>{return!!(message['\u0069\u006D\u0061\u0067\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||message['\u0076\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065']);};let _0xgd124d;export const hasValidInteractiveHeader=message=>{return!!(message['\u0069\u006D\u0061\u0067\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||message['\u0076\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||message['\u0064\u006F\u0063\u0075\u006D\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||message['\u0070\u0072\u006F\u0064\u0075\u0063\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||message['\u006C\u006F\u0063\u0061\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065']);};_0xgd124d=712842^712844;var _0xagc8eb=(538070^538071)+(358263^358271);export const hasValidCarouselHeader=message=>{return!!(message['\u0069\u006D\u0061\u0067\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||message['\u0076\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||message['\u0070\u0072\u006F\u0064\u0075\u0063\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']);};_0xagc8eb=(933102^933094)+(968729^968720);var _0xab43b=(408346^408338)+(968276^968284);export const generateWAMessageContent=async(message,options)=>{var _a,_b;var _0x8f8ga=(230794^230794)+(951630^951623);let m={};_0x8f8ga=(332675^332672)+(566522^566514);if(hasNonNullishProperty(message,"war".split("").reverse().join(""))){delete message['\u0072\u0061\u0077'];return message;}else if(hasNonNullishProperty(message,"\u0063\u006F\u0064\u0065")||hasNonNullishProperty(message,"sknil".split("").reverse().join(""))||hasNonNullishProperty(message,"\u0074\u0061\u0062\u006C\u0065")||hasNonNullishProperty(message,"esnopseRhcir".split("").reverse().join(""))){m=prepareRichResponseMessage(message);}else if(hasNonNullishProperty(message,"txet".split("").reverse().join(""))){const extContent={'\u0074\u0065\u0078\u0074':message['\u0074\u0065\u0078\u0074']};let urlInfo=message['\u006C\u0069\u006E\u006B\u0050\u0072\u0065\u0076\u0069\u0065\u0077'];if(typeof urlInfo==="denifednu".split("").reverse().join("")){urlInfo=await generateLinkPreviewIfRequired(message['\u0074\u0065\u0078\u0074'],options['\u0067\u0065\u0074\u0055\u0072\u006C\u0049\u006E\u0066\u006F'],options['\u006C\u006F\u0067\u0067\u0065\u0072']);}if(urlInfo){extContent['\u006D\u0061\u0074\u0063\u0068\u0065\u0064\u0054\u0065\u0078\u0074']=urlInfo['matched-text'];extContent['\u006A\u0070\u0065\u0067\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C']=urlInfo['\u006A\u0070\u0065\u0067\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C'];extContent['\u0064\u0065\u0073\u0063\u0072\u0069\u0070\u0074\u0069\u006F\u006E']=urlInfo['\u0064\u0065\u0073\u0063\u0072\u0069\u0070\u0074\u0069\u006F\u006E'];extContent['\u0074\u0069\u0074\u006C\u0065']=urlInfo['\u0074\u0069\u0074\u006C\u0065'];extContent['\u0070\u0072\u0065\u0076\u0069\u0065\u0077\u0054\u0079\u0070\u0065']=urlInfo['\u0070\u0072\u0065\u0076\u0069\u0065\u0077\u0054\u0079\u0070\u0065']??172663^172663;extContent['\u006C\u0069\u006E\u006B\u0050\u0072\u0065\u0076\u0069\u0065\u0077\u004D\u0065\u0074\u0061\u0064\u0061\u0074\u0061']=urlInfo['\u006C\u0069\u006E\u006B\u0050\u0072\u0065\u0076\u0069\u0065\u0077\u004D\u0065\u0074\u0061\u0064\u0061\u0074\u0061'];const img=urlInfo['\u0068\u0069\u0067\u0068\u0051\u0075\u0061\u006C\u0069\u0074\u0079\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C'];if(img){extContent['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0044\u0069\u0072\u0065\u0063\u0074\u0050\u0061\u0074\u0068']=img['\u0064\u0069\u0072\u0065\u0063\u0074\u0050\u0061\u0074\u0068'];extContent['\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079']=img['\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079'];extContent['\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070']=img['\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070'];extContent['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0057\u0069\u0064\u0074\u0068']=img['\u0077\u0069\u0064\u0074\u0068'];extContent['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0048\u0065\u0069\u0067\u0068\u0074']=img['\u0068\u0065\u0069\u0067\u0068\u0074'];extContent['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0053\u0068\u0061\u0032\u0035\u0036']=img['\u0066\u0069\u006C\u0065\u0053\u0068\u0061\u0032\u0035\u0036'];extContent['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036']=img['\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036'];}}const faviconData=message['\u0066\u0061\u0076\u0069\u0063\u006F\u006E'];if(faviconData&&typeof options['\u0075\u0070\u006C\u006F\u0061\u0064']==="noitcnuf".split("").reverse().join("")){const{"imageMessage":imageMessage}=await prepareWAMessageMedia({"image":faviconData},options)['\u0063\u0061\u0074\u0063\u0068'](()=>({'\u0069\u006D\u0061\u0067\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065':null}));if(imageMessage)extContent['\u0066\u0061\u0076\u0069\u0063\u006F\u006E\u004D\u004D\u0053\u004D\u0065\u0074\u0061\u0064\u0061\u0074\u0061']={'\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0044\u0069\u0072\u0065\u0063\u0074\u0050\u0061\u0074\u0068':imageMessage['\u0064\u0069\u0072\u0065\u0063\u0074\u0050\u0061\u0074\u0068'],'\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079':imageMessage['\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079'],'\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070':imageMessage['\u006D\u0065\u0064\u0069\u0061\u004B\u0065\u0079\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070'],'\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0057\u0069\u0064\u0074\u0068':32,'\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0048\u0065\u0069\u0067\u0068\u0074':32,"thumbnailSha256":imageMessage['\u0066\u0069\u006C\u0065\u0053\u0068\u0061\u0032\u0035\u0036'],"thumbnailEncSha256":imageMessage['\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036']};}if(options['\u0062\u0061\u0063\u006B\u0067\u0072\u006F\u0075\u006E\u0064\u0043\u006F\u006C\u006F\u0072']){extContent['\u0062\u0061\u0063\u006B\u0067\u0072\u006F\u0075\u006E\u0064\u0041\u0072\u0067\u0062']=await assertColor(options['\u0062\u0061\u0063\u006B\u0067\u0072\u006F\u0075\u006E\u0064\u0043\u006F\u006C\u006F\u0072']);}if(options['\u0066\u006F\u006E\u0074']){extContent['\u0066\u006F\u006E\u0074']=options['\u0066\u006F\u006E\u0074'];}m['\u0065\u0078\u0074\u0065\u006E\u0064\u0065\u0064\u0054\u0065\u0078\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=extContent;}else if(hasNonNullishProperty(message,"\u0063\u006F\u006E\u0074\u0061\u0063\u0074\u0073")){var _0x78ga=(138926^138922)+(550927^550921);const contactLen=message['\u0063\u006F\u006E\u0074\u0061\u0063\u0074\u0073']['\u0063\u006F\u006E\u0074\u0061\u0063\u0074\u0073']['\u006C\u0065\u006E\u0067\u0074\u0068'];_0x78ga=(859643^859635)+(115210^115208);if(!contactLen){throw new Boom("\u0072\u0065\u0071\u0075\u0069\u0072\u0065\u0020\u0061\u0074\u006C\u0065\u0061\u0073\u0074\u0020\u0031\u0020\u0063\u006F\u006E\u0074\u0061\u0063\u0074",{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}if(contactLen===(587892^587893)){m['\u0063\u006F\u006E\u0074\u0061\u0063\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0043\u006F\u006E\u0074\u0061\u0063\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0063\u0072\u0065\u0061\u0074\u0065'](message['\u0063\u006F\u006E\u0074\u0061\u0063\u0074\u0073']['\u0063\u006F\u006E\u0074\u0061\u0063\u0074\u0073'][620563^620563]);}else{m['\u0063\u006F\u006E\u0074\u0061\u0063\u0074\u0073\u0041\u0072\u0072\u0061\u0079\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0043\u006F\u006E\u0074\u0061\u0063\u0074\u0073\u0041\u0072\u0072\u0061\u0079\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0063\u0072\u0065\u0061\u0074\u0065'](message['\u0063\u006F\u006E\u0074\u0061\u0063\u0074\u0073']);}}else if(hasNonNullishProperty(message,"noitacol".split("").reverse().join(""))){m['\u006C\u006F\u0063\u0061\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u004C\u006F\u0063\u0061\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0063\u0072\u0065\u0061\u0074\u0065'](message['\u006C\u006F\u0063\u0061\u0074\u0069\u006F\u006E']);}else if(hasNonNullishProperty(message,"tcaer".split("").reverse().join(""))){if(!message['\u0072\u0065\u0061\u0063\u0074']['\u0073\u0065\u006E\u0064\u0065\u0072\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070\u004D\u0073']){message['\u0072\u0065\u0061\u0063\u0074']['\u0073\u0065\u006E\u0064\u0065\u0072\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070\u004D\u0073']=Date['\u006E\u006F\u0077']();}m['\u0072\u0065\u0061\u0063\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0052\u0065\u0061\u0063\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0063\u0072\u0065\u0061\u0074\u0065'](message['\u0072\u0065\u0061\u0063\u0074']);}else if(hasNonNullishProperty(message,"eteled".split("").reverse().join(""))){m['\u0070\u0072\u006F\u0074\u006F\u0063\u006F\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={"key":message['\u0064\u0065\u006C\u0065\u0074\u0065'],'\u0074\u0079\u0070\u0065':WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0050\u0072\u006F\u0074\u006F\u0063\u006F\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0054\u0079\u0070\u0065']['\u0052\u0045\u0056\u004F\u004B\u0045']};}else if(hasNonNullishProperty(message,"drawrof".split("").reverse().join(""))){m=generateForwardMessageContent(message['\u0066\u006F\u0072\u0077\u0061\u0072\u0064'],message['\u0066\u006F\u0072\u0063\u0065']);}else if(hasNonNullishProperty(message,"\u0064\u0069\u0073\u0061\u0070\u0070\u0065\u0061\u0072\u0069\u006E\u0067\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0073\u0049\u006E\u0043\u0068\u0061\u0074")){var _0xf5e36c=(582933^582941)+(242928^242928);const exp=typeof message['\u0064\u0069\u0073\u0061\u0070\u0070\u0065\u0061\u0072\u0069\u006E\u0067\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0073\u0049\u006E\u0043\u0068\u0061\u0074']==="naeloob".split("").reverse().join("")?message['\u0064\u0069\u0073\u0061\u0070\u0070\u0065\u0061\u0072\u0069\u006E\u0067\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0073\u0049\u006E\u0043\u0068\u0061\u0074']?WA_DEFAULT_EPHEMERAL:796124^796124:message['\u0064\u0069\u0073\u0061\u0070\u0070\u0065\u0061\u0072\u0069\u006E\u0067\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0073\u0049\u006E\u0043\u0068\u0061\u0074'];_0xf5e36c='\u0069\u0062\u006E\u0065\u0065\u006F';m=prepareDisappearingMessageSettingContent(exp);}else if(hasNonNullishProperty(message,"\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065")){m['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={};m['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0069\u006E\u0076\u0069\u0074\u0065\u0043\u006F\u0064\u0065']=message['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065']['\u0069\u006E\u0076\u0069\u0074\u0065\u0043\u006F\u0064\u0065'];m['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0069\u006E\u0076\u0069\u0074\u0065\u0045\u0078\u0070\u0069\u0072\u0061\u0074\u0069\u006F\u006E']=message['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065']['\u0069\u006E\u0076\u0069\u0074\u0065\u0045\u0078\u0070\u0069\u0072\u0061\u0074\u0069\u006F\u006E'];m['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0063\u0061\u0070\u0074\u0069\u006F\u006E']=message['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065']['\u0074\u0065\u0078\u0074'];m['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0067\u0072\u006F\u0075\u0070\u004A\u0069\u0064']=message['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065']['\u006A\u0069\u0064'];m['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0067\u0072\u006F\u0075\u0070\u004E\u0061\u006D\u0065']=message['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065']['\u0073\u0075\u0062\u006A\u0065\u0063\u0074'];if(options['\u0067\u0065\u0074\u0050\u0072\u006F\u0066\u0069\u006C\u0065\u0050\u0069\u0063\u0055\u0072\u006C']){var _0xb56ege=(784046^784038)+(844838^844832);const pfpUrl=await options['\u0067\u0065\u0074\u0050\u0072\u006F\u0066\u0069\u006C\u0065\u0050\u0069\u0063\u0055\u0072\u006C'](message['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065']['\u006A\u0069\u0064'],"weiverp".split("").reverse().join(""));_0xb56ege=(939845^939852)+(823637^823633);if(pfpUrl){var _0xf67a5f=(410308^410305)+(453759^453754);const resp=await fetch(pfpUrl,{"method":'GET',"dispatcher":options?.options?.dispatcher});_0xf67a5f=(813715^813717)+(411495^411503);if(resp['\u006F\u006B']){var _0xdc9b4c=(372844^372836)+(788841^788843);const buf=Buffer['\u0066\u0072\u006F\u006D'](await resp['\u0061\u0072\u0072\u0061\u0079\u0042\u0075\u0066\u0066\u0065\u0072']());_0xdc9b4c=103184^103190;m['\u0067\u0072\u006F\u0075\u0070\u0049\u006E\u0076\u0069\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u006A\u0070\u0065\u0067\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C']=buf;}}}}else if(hasNonNullishProperty(message,"srekcits".split("").reverse().join(""))){m['\u0073\u0074\u0069\u0063\u006B\u0065\u0072\u0050\u0061\u0063\u006B\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=await prepareStickerPackMessage(message,options);}else if(hasNonNullishProperty(message,"\u0070\u0069\u006E")){m['\u0070\u0069\u006E\u0049\u006E\u0043\u0068\u0061\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={};m['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={};m['\u0070\u0069\u006E\u0049\u006E\u0043\u0068\u0061\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u006B\u0065\u0079']=message['\u0070\u0069\u006E'];m['\u0070\u0069\u006E\u0049\u006E\u0043\u0068\u0061\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0074\u0079\u0070\u0065']=message['\u0074\u0079\u0070\u0065'];m['\u0070\u0069\u006E\u0049\u006E\u0043\u0068\u0061\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0073\u0065\u006E\u0064\u0065\u0072\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070\u004D\u0073']=Date['\u006E\u006F\u0077']();m['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0041\u0064\u0064\u004F\u006E\u0044\u0075\u0072\u0061\u0074\u0069\u006F\u006E\u0049\u006E\u0053\u0065\u0063\u0073']=message['\u0074\u0079\u0070\u0065']===(575784^575785)?message['\u0074\u0069\u006D\u0065']||86400:572751^572751;}else if(hasNonNullishProperty(message,"\u006B\u0065\u0065\u0070")){m['\u006B\u0065\u0065\u0070\u0049\u006E\u0043\u0068\u0061\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={};m['\u006B\u0065\u0065\u0070\u0049\u006E\u0043\u0068\u0061\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u006B\u0065\u0079']=message['\u006B\u0065\u0065\u0070'];m['\u006B\u0065\u0065\u0070\u0049\u006E\u0043\u0068\u0061\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u006B\u0065\u0065\u0070\u0054\u0079\u0070\u0065']=message['\u0074\u0079\u0070\u0065'];m['\u006B\u0065\u0065\u0070\u0049\u006E\u0043\u0068\u0061\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0074\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070\u004D\u0073']=Date['\u006E\u006F\u0077']();}else if(hasNonNullishProperty(message,"\u0066\u006C\u006F\u0077\u0052\u0065\u0070\u006C\u0079")){m['\u0069\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u0076\u0065\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={"body":{"format":message['\u0066\u006C\u006F\u0077\u0052\u0065\u0070\u006C\u0079']['\u0066\u006F\u0072\u006D\u0061\u0074']||proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0049\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u0076\u0065\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0042\u006F\u0064\u0079']['\u0046\u006F\u0072\u006D\u0061\u0074']['\u0044\u0045\u0046\u0041\u0055\u004C\u0054'],'\u0074\u0065\u0078\u0074':message['\u0066\u006C\u006F\u0077\u0052\u0065\u0070\u006C\u0079']['\u0074\u0065\u0078\u0074']},'\u006E\u0061\u0074\u0069\u0076\u0065\u0046\u006C\u006F\u0077\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065':{'\u006E\u0061\u006D\u0065':message['\u0066\u006C\u006F\u0077\u0052\u0065\u0070\u006C\u0079']['\u006E\u0061\u006D\u0065'],"paramsJson":message['\u0066\u006C\u006F\u0077\u0052\u0065\u0070\u006C\u0079']['\u0070\u0061\u0072\u0061\u006D\u0073\u004A\u0073\u006F\u006E']||"}{".split("").reverse().join(""),"version":message['\u0066\u006C\u006F\u0077\u0052\u0065\u0070\u006C\u0079']['\u0076\u0065\u0072\u0073\u0069\u006F\u006E']||353755^353754}};}else if(hasNonNullishProperty(message,"ylpeRnottub".split("").reverse().join(""))){switch(message['\u0074\u0079\u0070\u0065']){case"\u0074\u0065\u006D\u0070\u006C\u0061\u0074\u0065":m['\u0074\u0065\u006D\u0070\u006C\u0061\u0074\u0065\u0042\u0075\u0074\u0074\u006F\u006E\u0052\u0065\u0070\u006C\u0079\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={'\u0073\u0065\u006C\u0065\u0063\u0074\u0065\u0064\u0044\u0069\u0073\u0070\u006C\u0061\u0079\u0054\u0065\u0078\u0074':message['\u0062\u0075\u0074\u0074\u006F\u006E\u0052\u0065\u0070\u006C\u0079']['\u0064\u0069\u0073\u0070\u006C\u0061\u0079\u0054\u0065\u0078\u0074'],"selectedId":message['\u0062\u0075\u0074\u0074\u006F\u006E\u0052\u0065\u0070\u006C\u0079']['\u0069\u0064'],'\u0073\u0065\u006C\u0065\u0063\u0074\u0065\u0064\u0049\u006E\u0064\u0065\u0078':message['\u0062\u0075\u0074\u0074\u006F\u006E\u0052\u0065\u0070\u006C\u0079']['\u0069\u006E\u0064\u0065\u0078']};break;case"\u0070\u006C\u0061\u0069\u006E":m['\u0062\u0075\u0074\u0074\u006F\u006E\u0073\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={'\u0073\u0065\u006C\u0065\u0063\u0074\u0065\u0064\u0042\u0075\u0074\u0074\u006F\u006E\u0049\u0064':message['\u0062\u0075\u0074\u0074\u006F\u006E\u0052\u0065\u0070\u006C\u0079']['\u0069\u0064'],"selectedDisplayText":message['\u0062\u0075\u0074\u0074\u006F\u006E\u0052\u0065\u0070\u006C\u0079']['\u0064\u0069\u0073\u0070\u006C\u0061\u0079\u0054\u0065\u0078\u0074'],'\u0074\u0079\u0070\u0065':proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0042\u0075\u0074\u0074\u006F\u006E\u0073\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0054\u0079\u0070\u0065']['\u0044\u0049\u0053\u0050\u004C\u0041\u0059\u005F\u0054\u0045\u0058\u0054']};break;}}else if(hasNonNullishProperty(message,"\u006C\u0069\u0073\u0074\u0052\u0065\u0070\u006C\u0079")){m['\u006C\u0069\u0073\u0074\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={'\u0064\u0065\u0073\u0063\u0072\u0069\u0070\u0074\u0069\u006F\u006E':message['\u006C\u0069\u0073\u0074\u0052\u0065\u0070\u006C\u0079']['\u0064\u0065\u0073\u0063\u0072\u0069\u0070\u0074\u0069\u006F\u006E'],"listType":proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u004C\u0069\u0073\u0074\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u004C\u0069\u0073\u0074\u0054\u0079\u0070\u0065']['\u0053\u0049\u004E\u0047\u004C\u0045\u005F\u0053\u0045\u004C\u0045\u0043\u0054'],'\u0073\u0069\u006E\u0067\u006C\u0065\u0053\u0065\u006C\u0065\u0063\u0074\u0052\u0065\u0070\u006C\u0079':{"selectedRowId":message['\u006C\u0069\u0073\u0074\u0052\u0065\u0070\u006C\u0079']['\u0069\u0064']},"title":message['\u006C\u0069\u0073\u0074\u0052\u0065\u0070\u006C\u0079']['\u0074\u0069\u0074\u006C\u0065']};}else if(hasOptionalProperty(message,"vtp".split("").reverse().join(""))&&message['\u0070\u0074\u0076']){const{'\u0076\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065':videoMessage}=await prepareWAMessageMedia({"video":message['\u0076\u0069\u0064\u0065\u006F']},options);m['\u0070\u0074\u0076\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=videoMessage;}else if(hasNonNullishProperty(message,"\u0070\u0072\u006F\u0064\u0075\u0063\u0074")){m['\u0070\u0072\u006F\u0064\u0075\u0063\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=await prepareProductMessage(message,options);}else if(hasNonNullishProperty(message,"\u0065\u0076\u0065\u006E\u0074")){m['\u0065\u0076\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={};var _0x31fb=(351486^351487)+(125985^125991);const startTime=Math['\u0066\u006C\u006F\u006F\u0072'](message['\u0065\u0076\u0065\u006E\u0074']['\u0073\u0074\u0061\u0072\u0074\u0044\u0061\u0074\u0065']['\u0067\u0065\u0074\u0054\u0069\u006D\u0065']()/(356129^355529));_0x31fb=(618914^618922)+(494236^494235);if(message['\u0065\u0076\u0065\u006E\u0074']['\u0063\u0061\u006C\u006C']&&options['\u0067\u0065\u0074\u0043\u0061\u006C\u006C\u004C\u0069\u006E\u006B']){var _0xacadd=(600338^600342)+(246009^246011);const token=await options['\u0067\u0065\u0074\u0043\u0061\u006C\u006C\u004C\u0069\u006E\u006B'](message['\u0065\u0076\u0065\u006E\u0074']['\u0063\u0061\u006C\u006C'],{'\u0073\u0074\u0061\u0072\u0074\u0054\u0069\u006D\u0065':startTime});_0xacadd='\u0065\u006C\u0070\u0064\u0065\u006B';m['\u0065\u0076\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u006A\u006F\u0069\u006E\u004C\u0069\u006E\u006B']=(message['\u0065\u0076\u0065\u006E\u0074']['\u0063\u0061\u006C\u006C']==="oidua".split("").reverse().join("")?CALL_AUDIO_PREFIX:CALL_VIDEO_PREFIX)+token;}m['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={"messageSecret":message['\u0065\u0076\u0065\u006E\u0074']['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0053\u0065\u0063\u0072\u0065\u0074']||randomBytes(214713^214681)};m['\u0065\u0076\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u006E\u0061\u006D\u0065']=message['\u0065\u0076\u0065\u006E\u0074']['\u006E\u0061\u006D\u0065'];m['\u0065\u0076\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0064\u0065\u0073\u0063\u0072\u0069\u0070\u0074\u0069\u006F\u006E']=message['\u0065\u0076\u0065\u006E\u0074']['\u0064\u0065\u0073\u0063\u0072\u0069\u0070\u0074\u0069\u006F\u006E'];m['\u0065\u0076\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0073\u0074\u0061\u0072\u0074\u0054\u0069\u006D\u0065']=startTime;m['\u0065\u0076\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0065\u006E\u0064\u0054\u0069\u006D\u0065']=message['\u0065\u0076\u0065\u006E\u0074']['\u0065\u006E\u0064\u0044\u0061\u0074\u0065']?message['\u0065\u0076\u0065\u006E\u0074']['\u0065\u006E\u0064\u0044\u0061\u0074\u0065']['\u0067\u0065\u0074\u0054\u0069\u006D\u0065']()/(777366^778110):undefined;m['\u0065\u0076\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0069\u0073\u0043\u0061\u006E\u0063\u0065\u006C\u0065\u0064']=message['\u0065\u0076\u0065\u006E\u0074']['\u0069\u0073\u0043\u0061\u006E\u0063\u0065\u006C\u006C\u0065\u0064']??false;m['\u0065\u0076\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0065\u0078\u0074\u0072\u0061\u0047\u0075\u0065\u0073\u0074\u0073\u0041\u006C\u006C\u006F\u0077\u0065\u0064']=message['\u0065\u0076\u0065\u006E\u0074']['\u0065\u0078\u0074\u0072\u0061\u0047\u0075\u0065\u0073\u0074\u0073\u0041\u006C\u006C\u006F\u0077\u0065\u0064'];m['\u0065\u0076\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0069\u0073\u0053\u0063\u0068\u0065\u0064\u0075\u006C\u0065\u0043\u0061\u006C\u006C']=message['\u0065\u0076\u0065\u006E\u0074']['\u0069\u0073\u0053\u0063\u0068\u0065\u0064\u0075\u006C\u0065\u0043\u0061\u006C\u006C']??false;m['\u0065\u0076\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u006C\u006F\u0063\u0061\u0074\u0069\u006F\u006E']=message['\u0065\u0076\u0065\u006E\u0074']['\u006C\u006F\u0063\u0061\u0074\u0069\u006F\u006E'];}else if(hasNonNullishProperty(message,"\u0070\u006F\u006C\u006C")){(_a=message['\u0070\u006F\u006C\u006C'])['\u0073\u0065\u006C\u0065\u0063\u0074\u0061\u0062\u006C\u0065\u0043\u006F\u0075\u006E\u0074']||(_a['\u0073\u0065\u006C\u0065\u0063\u0074\u0061\u0062\u006C\u0065\u0043\u006F\u0075\u006E\u0074']=385559^385559);(_b=message['\u0070\u006F\u006C\u006C'])['\u0074\u006F\u0041\u006E\u006E\u006F\u0075\u006E\u0063\u0065\u006D\u0065\u006E\u0074\u0047\u0072\u006F\u0075\u0070']||(_b['\u0074\u006F\u0041\u006E\u006E\u006F\u0075\u006E\u0063\u0065\u006D\u0065\u006E\u0074\u0047\u0072\u006F\u0075\u0070']=false);if(!Array['\u0069\u0073\u0041\u0072\u0072\u0061\u0079'](message['\u0070\u006F\u006C\u006C']['\u0076\u0061\u006C\u0075\u0065\u0073'])){throw new Boom("seulav llop dilavnI".split("").reverse().join(""),{"statusCode":400});}if(message['\u0070\u006F\u006C\u006C']['\u0073\u0065\u006C\u0065\u0063\u0074\u0061\u0062\u006C\u0065\u0043\u006F\u0075\u006E\u0074']<(507382^507382)||message['\u0070\u006F\u006C\u006C']['\u0073\u0065\u006C\u0065\u0063\u0074\u0061\u0062\u006C\u0065\u0043\u006F\u0075\u006E\u0074']>message['\u0070\u006F\u006C\u006C']['\u0076\u0061\u006C\u0075\u0065\u0073']['\u006C\u0065\u006E\u0067\u0074\u0068']){throw new Boom(`poll.selectableCount in poll should be >= 0 and <= ${message['\u0070\u006F\u006C\u006C']['\u0076\u0061\u006C\u0075\u0065\u0073']['\u006C\u0065\u006E\u0067\u0074\u0068']}`,{"statusCode":400});}let _0xe7e;const pollCreationMessage={"name":message['\u0070\u006F\u006C\u006C']['\u006E\u0061\u006D\u0065'],'\u0073\u0065\u006C\u0065\u0063\u0074\u0061\u0062\u006C\u0065\u004F\u0070\u0074\u0069\u006F\u006E\u0073\u0043\u006F\u0075\u006E\u0074':message['\u0070\u006F\u006C\u006C']['\u0073\u0065\u006C\u0065\u0063\u0074\u0061\u0062\u006C\u0065\u0043\u006F\u0075\u006E\u0074'],'\u006F\u0070\u0074\u0069\u006F\u006E\u0073':message['\u0070\u006F\u006C\u006C']['\u0076\u0061\u006C\u0075\u0065\u0073']['\u006D\u0061\u0070'](optionName=>({'\u006F\u0070\u0074\u0069\u006F\u006E\u004E\u0061\u006D\u0065':optionName})),"endTime":message['\u0070\u006F\u006C\u006C']['\u0065\u006E\u0064\u0044\u0061\u0074\u0065']?message['\u0070\u006F\u006C\u006C']['\u0065\u006E\u0064\u0044\u0061\u0074\u0065']['\u0067\u0065\u0074\u0054\u0069\u006D\u0065']():undefined,'\u0068\u0069\u0064\u0065\u0050\u0061\u0072\u0074\u0069\u0063\u0069\u0070\u0061\u006E\u0074\u004E\u0061\u006D\u0065':message['\u0070\u006F\u006C\u006C']['\u0068\u0069\u0064\u0065\u0056\u006F\u0074\u0065\u0072']??false,'\u0061\u006C\u006C\u006F\u0077\u0041\u0064\u0064\u004F\u0070\u0074\u0069\u006F\u006E':message['\u0070\u006F\u006C\u006C']['\u0063\u0061\u006E\u0041\u0064\u0064\u004F\u0070\u0074\u0069\u006F\u006E']??false};_0xe7e=(430684^430677)+(998254^998251);if(message['\u0070\u006F\u006C\u006C']['\u0074\u006F\u0041\u006E\u006E\u006F\u0075\u006E\u0063\u0065\u006D\u0065\u006E\u0074\u0047\u0072\u006F\u0075\u0070']){m['\u0070\u006F\u006C\u006C\u0043\u0072\u0065\u0061\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0056\u0032']=pollCreationMessage;}else{if(message['\u0070\u006F\u006C\u006C']['\u0070\u006F\u006C\u006C\u0054\u0079\u0070\u0065']===(289811^289810)){if(!message['\u0070\u006F\u006C\u006C']['\u0063\u006F\u0072\u0072\u0065\u0063\u0074\u0041\u006E\u0073\u0077\u0065\u0072']){throw new Boom("ziuq rof dedivorp \"rewsnAtcerroc\" oN".split("").reverse().join(""),{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}m['\u0070\u006F\u006C\u006C\u0043\u0072\u0065\u0061\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0056\u0035']={...pollCreationMessage,'\u0063\u006F\u0072\u0072\u0065\u0063\u0074\u0041\u006E\u0073\u0077\u0065\u0072':{'\u006F\u0070\u0074\u0069\u006F\u006E\u004E\u0061\u006D\u0065':message['\u0070\u006F\u006C\u006C']['\u0063\u006F\u0072\u0072\u0065\u0063\u0074\u0041\u006E\u0073\u0077\u0065\u0072']['\u0074\u006F\u0053\u0074\u0072\u0069\u006E\u0067']()},'\u0070\u006F\u006C\u006C\u0054\u0079\u0070\u0065':1,"selectableOptionsCount":1};}else if(message['\u0070\u006F\u006C\u006C']['\u0073\u0065\u006C\u0065\u0063\u0074\u0061\u0062\u006C\u0065\u0043\u006F\u0075\u006E\u0074']===(899034^899035)){m['\u0070\u006F\u006C\u006C\u0043\u0072\u0065\u0061\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0056\u0033']=pollCreationMessage;}else{m['\u0070\u006F\u006C\u006C\u0043\u0072\u0065\u0061\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=pollCreationMessage;}}m['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={'\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0053\u0065\u0063\u0072\u0065\u0074':message['\u0070\u006F\u006C\u006C']['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0053\u0065\u0063\u0072\u0065\u0074']||randomBytes(954719^954751)};}else if(hasNonNullishProperty(message,"\u0070\u006F\u006C\u006C\u0052\u0065\u0073\u0075\u006C\u0074")){var _0x9daa8d=(995072^995074)+(198086^198095);const pollResultSnapshotMessage={'\u006E\u0061\u006D\u0065':message['\u0070\u006F\u006C\u006C\u0052\u0065\u0073\u0075\u006C\u0074']['\u006E\u0061\u006D\u0065'],'\u0070\u006F\u006C\u006C\u0056\u006F\u0074\u0065\u0073':message['\u0070\u006F\u006C\u006C\u0052\u0065\u0073\u0075\u006C\u0074']['\u0076\u006F\u0074\u0065\u0073']['\u006D\u0061\u0070'](vote=>({'\u006F\u0070\u0074\u0069\u006F\u006E\u004E\u0061\u006D\u0065':vote['\u006E\u0061\u006D\u0065'],"optionVoteCount":parseInt(vote['\u0076\u006F\u0074\u0065\u0043\u006F\u0075\u006E\u0074'])}))};_0x9daa8d=(849705^849710)+(497086^497080);if(message['\u0070\u006F\u006C\u006C\u0052\u0065\u0073\u0075\u006C\u0074']['\u0070\u006F\u006C\u006C\u0054\u0079\u0070\u0065']===(340874^340875)){pollResultSnapshotMessage['\u0070\u006F\u006C\u006C\u0054\u0079\u0070\u0065']=proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0050\u006F\u006C\u006C\u0054\u0079\u0070\u0065']['\u0051\u0055\u0049\u005A'];m['\u0070\u006F\u006C\u006C\u0052\u0065\u0073\u0075\u006C\u0074\u0053\u006E\u0061\u0070\u0073\u0068\u006F\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0056\u0033']=pollResultSnapshotMessage;}else{pollResultSnapshotMessage['\u0070\u006F\u006C\u006C\u0054\u0079\u0070\u0065']=proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0050\u006F\u006C\u006C\u0054\u0079\u0070\u0065']['\u0050\u004F\u004C\u004C'];m['\u0070\u006F\u006C\u006C\u0052\u0065\u0073\u0075\u006C\u0074\u0053\u006E\u0061\u0070\u0073\u0068\u006F\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=pollResultSnapshotMessage;}}else if(hasNonNullishProperty(message,"etadpUllop".split("").reverse().join(""))){if(!message['\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065']['\u006B\u0065\u0079']){throw new Boom("\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0020\u006B\u0065\u0079\u0020\u0069\u0073\u0020\u0072\u0065\u0071\u0075\u0069\u0072\u0065\u0064",{"statusCode":400});}if(!message['\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065']['\u0076\u006F\u0074\u0065']){throw new Boom("\u0045\u006E\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0020\u0076\u006F\u0074\u0065\u0020\u0070\u0061\u0079\u006C\u006F\u0061\u0064\u0020\u0069\u0073\u0020\u0072\u0065\u0071\u0075\u0069\u0072\u0065\u0064",{"statusCode":400});}m['\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={"metadata":message['\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065']['\u006D\u0065\u0074\u0061\u0064\u0061\u0074\u0061'],'\u0070\u006F\u006C\u006C\u0043\u0072\u0065\u0061\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u004B\u0065\u0079':message['\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065']['\u006B\u0065\u0079'],"senderTimestampMs":Date['\u006E\u006F\u0077'](),"vote":message['\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065']['\u0076\u006F\u0074\u0065']};}else if(hasNonNullishProperty(message,"\u0070\u0061\u0079\u006D\u0065\u006E\u0074\u0049\u006E\u0076\u0069\u0074\u0065\u0053\u0065\u0072\u0076\u0069\u0063\u0065\u0054\u0079\u0070\u0065")){m['\u0070\u0061\u0079\u006D\u0065\u006E\u0074\u0049\u006E\u0076\u0069\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={'\u0065\u0078\u0070\u0069\u0072\u0079\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070':Date['\u006E\u006F\u0077'](),'\u0073\u0065\u0072\u0076\u0069\u0063\u0065\u0054\u0079\u0070\u0065':message['\u0070\u0061\u0079\u006D\u0065\u006E\u0074\u0049\u006E\u0076\u0069\u0074\u0065\u0053\u0065\u0072\u0076\u0069\u0063\u0065\u0054\u0079\u0070\u0065']};}else if(hasNonNullishProperty(message,"\u006F\u0072\u0064\u0065\u0072\u0054\u0065\u0078\u0074")){if(!Buffer['\u0069\u0073\u0042\u0075\u0066\u0066\u0065\u0072'](message['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C'])){throw new Boom("\u004D\u0075\u0073\u0074\u0020\u0070\u0072\u006F\u0076\u0069\u0064\u0065\u0020\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0020\u0062\u0075\u0066\u0066\u0065\u0072\u0020\u0069\u006E\u0020\u006F\u0072\u0064\u0065\u0072\u0020\u006D\u0065\u0073\u0073\u0061\u0067\u0065",{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}m['\u006F\u0072\u0064\u0065\u0072\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={'\u0069\u0074\u0065\u006D\u0043\u006F\u0075\u006E\u0074':1,"messageVersion":1,'\u006F\u0072\u0064\u0065\u0072\u0054\u0069\u0074\u006C\u0065':LIBRARY_NAME,'\u0073\u0074\u0061\u0074\u0075\u0073':proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u004F\u0072\u0064\u0065\u0072\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u004F\u0072\u0064\u0065\u0072\u0053\u0074\u0061\u0074\u0075\u0073']['\u0049\u004E\u0051\u0055\u0049\u0052\u0059'],"surface":proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u004F\u0072\u0064\u0065\u0072\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u004F\u0072\u0064\u0065\u0072\u0053\u0075\u0072\u0066\u0061\u0063\u0065']['\u0043\u0041\u0054\u0041\u004C\u004F\u0047'],'\u0074\u006F\u006B\u0065\u006E':generateMessageIDV2(),'\u0074\u006F\u0074\u0061\u006C\u0041\u006D\u006F\u0075\u006E\u0074\u0031\u0030\u0030\u0030':1000,"totalCurrencyCode":"\u0049\u0044\u0052",...message,"message":message['\u006F\u0072\u0064\u0065\u0072\u0054\u0065\u0078\u0074']};delete m['\u006F\u0072\u0064\u0065\u0072\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u006F\u0072\u0064\u0065\u0072\u0054\u0065\u0078\u0074'];}else if(hasNonNullishProperty(message,"\u0061\u006C\u0062\u0075\u006D")){if(!Array['\u0069\u0073\u0041\u0072\u0072\u0061\u0079'](message['\u0061\u006C\u0062\u0075\u006D'])){throw new Boom("\u0049\u006E\u0076\u0061\u006C\u0069\u0064\u0020\u0061\u006C\u0062\u0075\u006D\u0020\u0074\u0079\u0070\u0065\u002E\u0020\u0045\u0078\u0070\u0065\u0063\u0074\u0065\u0064\u0020\u0061\u006E\u0020\u0061\u0072\u0072\u0061\u0079\u002E",{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}let videoCount=512280^512280;for(let i=555170^555170;i<message['\u0061\u006C\u0062\u0075\u006D']['\u006C\u0065\u006E\u0067\u0074\u0068'];i++){if(message['\u0061\u006C\u0062\u0075\u006D'][i]['\u0076\u0069\u0064\u0065\u006F'])videoCount++;}let _0xcbg95a;let imageCount=886467^886467;_0xcbg95a=210292^210301;for(let i=627672^627672;i<message['\u0061\u006C\u0062\u0075\u006D']['\u006C\u0065\u006E\u0067\u0074\u0068'];i++){if(message['\u0061\u006C\u0062\u0075\u006D'][i]['\u0069\u006D\u0061\u0067\u0065'])imageCount++;}if(videoCount+imageCount<(511253^511255)){throw new Boom("egassem mubla daolpu ot aidem 2 edivorp muminiM".split("").reverse().join(""),{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}m['\u0061\u006C\u0062\u0075\u006D\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={"expectedImageCount":imageCount,'\u0065\u0078\u0070\u0065\u0063\u0074\u0065\u0064\u0056\u0069\u0064\u0065\u006F\u0043\u006F\u0075\u006E\u0074':videoCount};}else if(hasNonNullishProperty(message,"\u0073\u0068\u0061\u0072\u0065\u0050\u0068\u006F\u006E\u0065\u004E\u0075\u006D\u0062\u0065\u0072")){m['\u0070\u0072\u006F\u0074\u006F\u0063\u006F\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={'\u0074\u0079\u0070\u0065':proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0050\u0072\u006F\u0074\u006F\u0063\u006F\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0054\u0079\u0070\u0065']['\u0053\u0048\u0041\u0052\u0045\u005F\u0050\u0048\u004F\u004E\u0045\u005F\u004E\u0055\u004D\u0042\u0045\u0052']};}else if(hasNonNullishProperty(message,"\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0050\u0068\u006F\u006E\u0065\u004E\u0075\u006D\u0062\u0065\u0072")){m['\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0050\u0068\u006F\u006E\u0065\u004E\u0075\u006D\u0062\u0065\u0072\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={};}else if(hasNonNullishProperty(message,"gnirahStimil".split("").reverse().join(""))){m['\u0070\u0072\u006F\u0074\u006F\u0063\u006F\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={'\u0074\u0079\u0070\u0065':proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0050\u0072\u006F\u0074\u006F\u0063\u006F\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0054\u0079\u0070\u0065']['\u004C\u0049\u004D\u0049\u0054\u005F\u0053\u0048\u0041\u0052\u0049\u004E\u0047'],'\u006C\u0069\u006D\u0069\u0074\u0053\u0068\u0061\u0072\u0069\u006E\u0067':{"sharingLimited":message['\u006C\u0069\u006D\u0069\u0074\u0053\u0068\u0061\u0072\u0069\u006E\u0067']===!![],'\u0074\u0072\u0069\u0067\u0067\u0065\u0072':1,'\u006C\u0069\u006D\u0069\u0074\u0053\u0068\u0061\u0072\u0069\u006E\u0067\u0053\u0065\u0074\u0074\u0069\u006E\u0067\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070':Date['\u006E\u006F\u0077'](),"initiatedByMe":!![]}};}else{m=await prepareWAMessageMedia(message,options);}if(hasNonNullishProperty(message,"\u0062\u0075\u0074\u0074\u006F\u006E\u0073")){let _0xaf_0x206;const buttonsMessage={'\u0062\u0075\u0074\u0074\u006F\u006E\u0073':message['\u0062\u0075\u0074\u0074\u006F\u006E\u0073']['\u006D\u0061\u0070'](button=>{var _0xd13c=(700083^700085)+(206821^206817);const buttonText=button['\u0074\u0065\u0078\u0074']||button['\u0062\u0075\u0074\u0074\u006F\u006E\u0054\u0065\u0078\u0074'];_0xd13c='\u006E\u0067\u0070\u0065\u0063\u006E';if(hasOptionalProperty(button,"\u0073\u0065\u0063\u0074\u0069\u006F\u006E\u0073")){return{'\u006E\u0061\u0074\u0069\u0076\u0065\u0046\u006C\u006F\u0077\u0049\u006E\u0066\u006F':{'\u006E\u0061\u006D\u0065':'single_select','\u0070\u0061\u0072\u0061\u006D\u0073\u004A\u0073\u006F\u006E':JSON['\u0073\u0074\u0072\u0069\u006E\u0067\u0069\u0066\u0079']({'\u0074\u0069\u0074\u006C\u0065':buttonText,'\u0073\u0065\u0063\u0074\u0069\u006F\u006E\u0073':button['\u0073\u0065\u0063\u0074\u0069\u006F\u006E\u0073']})},'\u0074\u0079\u0070\u0065':ButtonType['\u004E\u0041\u0054\u0049\u0056\u0045\u005F\u0046\u004C\u004F\u0057']};}else if(hasOptionalProperty(button,"\u006E\u0061\u006D\u0065")){return{'\u006E\u0061\u0074\u0069\u0076\u0065\u0046\u006C\u006F\u0077\u0049\u006E\u0066\u006F':{"name":button['\u006E\u0061\u006D\u0065'],'\u0070\u0061\u0072\u0061\u006D\u0073\u004A\u0073\u006F\u006E':button['\u0070\u0061\u0072\u0061\u006D\u0073\u004A\u0073\u006F\u006E']},'\u0074\u0079\u0070\u0065':ButtonType['\u004E\u0041\u0054\u0049\u0056\u0045\u005F\u0046\u004C\u004F\u0057']};}return{'\u0062\u0075\u0074\u0074\u006F\u006E\u0049\u0064':button['\u0069\u0064']||button['\u0062\u0075\u0074\u0074\u006F\u006E\u0049\u0064'],'\u0062\u0075\u0074\u0074\u006F\u006E\u0054\u0065\u0078\u0074':typeof buttonText==="\u0073\u0074\u0072\u0069\u006E\u0067"?{'\u0064\u0069\u0073\u0070\u006C\u0061\u0079\u0054\u0065\u0078\u0074':buttonText}:buttonText,'\u0074\u0079\u0070\u0065':button['\u0074\u0079\u0070\u0065']||ButtonType['\u0052\u0045\u0053\u0050\u004F\u004E\u0053\u0045']};})};_0xaf_0x206=979469^979469;if(hasOptionalProperty(message,"\u0074\u0065\u0078\u0074")){buttonsMessage['\u0063\u006F\u006E\u0074\u0065\u006E\u0074\u0054\u0065\u0078\u0074']=message['\u0074\u0065\u0078\u0074'];buttonsMessage['\u0068\u0065\u0061\u0064\u0065\u0072\u0054\u0079\u0070\u0065']=ButtonHeaderType['\u0045\u004D\u0050\u0054\u0059'];}else{if(hasOptionalProperty(message,"\u0063\u0061\u0070\u0074\u0069\u006F\u006E")){buttonsMessage['\u0063\u006F\u006E\u0074\u0065\u006E\u0074\u0054\u0065\u0078\u0074']=message['\u0063\u0061\u0070\u0074\u0069\u006F\u006E'];}const type=Object['\u006B\u0065\u0079\u0073'](m)[323177^323177]['\u0072\u0065\u0070\u006C\u0061\u0063\u0065']("egasseM".split("").reverse().join(""),'')['\u0074\u006F\u0055\u0070\u0070\u0065\u0072\u0043\u0061\u0073\u0065']();buttonsMessage['\u0068\u0065\u0061\u0064\u0065\u0072\u0054\u0079\u0070\u0065']=ButtonHeaderType[type];Object['\u0061\u0073\u0073\u0069\u0067\u006E'](buttonsMessage,m);}if(hasOptionalProperty(message,"retoof".split("").reverse().join(""))){buttonsMessage['\u0066\u006F\u006F\u0074\u0065\u0072\u0054\u0065\u0078\u0074']=message['\u0066\u006F\u006F\u0074\u0065\u0072'];}m={"buttonsMessage":buttonsMessage};}else if(hasNonNullishProperty(message,"snoitces".split("").reverse().join(""))){const listMessage={'\u0073\u0065\u0063\u0074\u0069\u006F\u006E\u0073':message['\u0073\u0065\u0063\u0074\u0069\u006F\u006E\u0073'],'\u0062\u0075\u0074\u0074\u006F\u006E\u0054\u0065\u0078\u0074':message['\u0062\u0075\u0074\u0074\u006F\u006E\u0054\u0065\u0078\u0074'],"title":message['\u0074\u0069\u0074\u006C\u0065'],"footerText":message['\u0066\u006F\u006F\u0074\u0065\u0072'],'\u0064\u0065\u0073\u0063\u0072\u0069\u0070\u0074\u0069\u006F\u006E':message['\u0074\u0065\u0078\u0074'],'\u006C\u0069\u0073\u0074\u0054\u0079\u0070\u0065':ListType['\u0053\u0049\u004E\u0047\u004C\u0045\u005F\u0053\u0045\u004C\u0045\u0043\u0054']};m={'\u006C\u0069\u0073\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065':listMessage};}else if(hasNonNullishProperty(message,"snottuBetalpmet".split("").reverse().join(""))){const hydratedTemplate={'\u0068\u0079\u0064\u0072\u0061\u0074\u0065\u0064\u0042\u0075\u0074\u0074\u006F\u006E\u0073':message['\u0074\u0065\u006D\u0070\u006C\u0061\u0074\u0065\u0042\u0075\u0074\u0074\u006F\u006E\u0073']['\u006D\u0061\u0070']((button,i)=>{let _0x2fb7b;const buttonText=button['\u0074\u0065\u0078\u0074']||button['\u0062\u0075\u0074\u0074\u006F\u006E\u0054\u0065\u0078\u0074'];_0x2fb7b=(335540^335538)+(889104^889108);if(hasOptionalProperty(button,"\u0069\u0064")){return{"index":i,'\u0071\u0075\u0069\u0063\u006B\u0052\u0065\u0070\u006C\u0079\u0042\u0075\u0074\u0074\u006F\u006E':{'\u0064\u0069\u0073\u0070\u006C\u0061\u0079\u0054\u0065\u0078\u0074':buttonText||"\uD83D\uDC49\uD83C\uDFFB\u0020\u0043\u006C\u0069\u0063\u006B",'\u0069\u0064':button['\u0069\u0064']}};}else if(hasOptionalProperty(button,"\u0075\u0072\u006C")){return{'\u0069\u006E\u0064\u0065\u0078':i,'\u0075\u0072\u006C\u0042\u0075\u0074\u0074\u006F\u006E':{"displayText":buttonText||"\uD83C\uDF10\u0020\u0056\u0069\u0073\u0069\u0074",'\u0075\u0072\u006C':button['\u0075\u0072\u006C']}};}else if(hasOptionalProperty(button,"\u0063\u0061\u006C\u006C")){return{"index":i,'\u0063\u0061\u006C\u006C\u0042\u0075\u0074\u0074\u006F\u006E':{"displayText":buttonText||"llaC \uDCDE\uD83D".split("").reverse().join(""),'\u0070\u0068\u006F\u006E\u0065\u004E\u0075\u006D\u0062\u0065\u0072':button['\u0063\u0061\u006C\u006C']}};}button['\u0069\u006E\u0064\u0065\u0078']=button['\u0069\u006E\u0064\u0065\u0078']||i;return button;})};if(hasOptionalProperty(message,"txet".split("").reverse().join(""))){hydratedTemplate['\u0068\u0079\u0064\u0072\u0061\u0074\u0065\u0064\u0043\u006F\u006E\u0074\u0065\u006E\u0074\u0054\u0065\u0078\u0074']=message['\u0074\u0065\u0078\u0074'];}else{if(hasOptionalProperty(message,"\u0063\u0061\u0070\u0074\u0069\u006F\u006E")){hydratedTemplate['\u0068\u0079\u0064\u0072\u0061\u0074\u0065\u0064\u0054\u0069\u0074\u006C\u0065\u0054\u0065\u0078\u0074']=message['\u0074\u0069\u0074\u006C\u0065'];hydratedTemplate['\u0068\u0079\u0064\u0072\u0061\u0074\u0065\u0064\u0043\u006F\u006E\u0074\u0065\u006E\u0074\u0054\u0065\u0078\u0074']=message['\u0063\u0061\u0070\u0074\u0069\u006F\u006E'];}Object['\u0061\u0073\u0073\u0069\u0067\u006E'](hydratedTemplate,m);}if(hasOptionalProperty(message,"\u0066\u006F\u006F\u0074\u0065\u0072")){hydratedTemplate['\u0068\u0079\u0064\u0072\u0061\u0074\u0065\u0064\u0046\u006F\u006F\u0074\u0065\u0072\u0054\u0065\u0078\u0074']=message['\u0066\u006F\u006F\u0074\u0065\u0072'];}hydratedTemplate['\u0074\u0065\u006D\u0070\u006C\u0061\u0074\u0065\u0049\u0064']=message['\u0069\u0064']||"-etalpmet".split("").reverse().join("")+Date['\u006E\u006F\u0077']();m={'\u0074\u0065\u006D\u0070\u006C\u0061\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065':{'\u0068\u0079\u0064\u0072\u0061\u0074\u0065\u0064\u0046\u006F\u0075\u0072\u0052\u006F\u0077\u0054\u0065\u006D\u0070\u006C\u0061\u0074\u0065':hydratedTemplate,'\u0068\u0079\u0064\u0072\u0061\u0074\u0065\u0064\u0054\u0065\u006D\u0070\u006C\u0061\u0074\u0065':hydratedTemplate}};}else if(hasNonNullishProperty(message,"\u006E\u0061\u0074\u0069\u0076\u0065\u0046\u006C\u006F\u0077")){const interactiveMessage={"nativeFlowMessage":prepareNativeFlowButtons(message)};if(hasOptionalProperty(message,"\u0062\u0069\u007A\u004A\u0069\u0064")){interactiveMessage['\u0063\u006F\u006C\u006C\u0065\u0063\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={"bizJid":message['\u0062\u0069\u007A\u004A\u0069\u0064'],'\u0069\u0064':message['\u0069\u0064'],'\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0056\u0065\u0072\u0073\u0069\u006F\u006E':1};}else if(hasOptionalProperty(message,"\u0073\u0068\u006F\u0070\u0053\u0075\u0072\u0066\u0061\u0063\u0065")){interactiveMessage['\u0073\u0068\u006F\u0070\u0053\u0074\u006F\u0072\u0065\u0066\u0072\u006F\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']={'\u0073\u0075\u0072\u0066\u0061\u0063\u0065':message['\u0073\u0068\u006F\u0070\u0053\u0075\u0072\u0066\u0061\u0063\u0065'],'\u0069\u0064':message['\u0069\u0064'],"messageVersion":1};}if(hasOptionalProperty(message,"\u0074\u0065\u0078\u0074")){interactiveMessage['\u0062\u006F\u0064\u0079']={"text":message['\u0074\u0065\u0078\u0074']};}else{if(hasOptionalProperty(message,"noitpac".split("").reverse().join(""))){let _0x92df7c;const isValidHeader=hasValidInteractiveHeader(m);_0x92df7c=(964284^964281)+(805163^805165);if(!isValidHeader){throw new Boom("\u0049\u006E\u0076\u0061\u006C\u0069\u0064\u0020\u006D\u0065\u0064\u0069\u0061\u0020\u0074\u0079\u0070\u0065\u0020\u0066\u006F\u0072\u0020\u0069\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u0076\u0065\u0020\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0020\u0068\u0065\u0061\u0064\u0065\u0072",{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}interactiveMessage['\u0068\u0065\u0061\u0064\u0065\u0072']={"title":message['\u0074\u0069\u0074\u006C\u0065']||'',"subtitle":message['\u0073\u0075\u0062\u0074\u0069\u0074\u006C\u0065']||'','\u0068\u0061\u0073\u004D\u0065\u0064\u0069\u0061\u0041\u0074\u0074\u0061\u0063\u0068\u006D\u0065\u006E\u0074':isValidHeader};interactiveMessage['\u0062\u006F\u0064\u0079']={'\u0074\u0065\u0078\u0074':message['\u0063\u0061\u0070\u0074\u0069\u006F\u006E']};}if(hasOptionalProperty(message,"lianbmuht".split("").reverse().join(""))&&!!message['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C']){interactiveMessage['\u006A\u0070\u0065\u0067\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C']=message['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C'];}Object['\u0061\u0073\u0073\u0069\u0067\u006E'](interactiveMessage['\u0068\u0065\u0061\u0064\u0065\u0072'],m);}if(hasOptionalProperty(message,"\u0061\u0075\u0064\u0069\u006F\u0046\u006F\u006F\u0074\u0065\u0072")){const{"audioMessage":audioMessage}=await prepareWAMessageMedia({"audio":message['\u0061\u0075\u0064\u0069\u006F\u0046\u006F\u006F\u0074\u0065\u0072']},options);interactiveMessage['\u0066\u006F\u006F\u0074\u0065\u0072']={'\u0061\u0075\u0064\u0069\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065':audioMessage,'\u0068\u0061\u0073\u004D\u0065\u0064\u0069\u0061\u0041\u0074\u0074\u0061\u0063\u0068\u006D\u0065\u006E\u0074':!![]};}else if(hasOptionalProperty(message,"\u0066\u006F\u006F\u0074\u0065\u0072")){interactiveMessage['\u0066\u006F\u006F\u0074\u0065\u0072']={'\u0074\u0065\u0078\u0074':message['\u0066\u006F\u006F\u0074\u0065\u0072']};}m={'\u0069\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u0076\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065':interactiveMessage};}else if(hasNonNullishProperty(message,"\u0063\u0061\u0072\u0064\u0073")){let _0x9a72f;const interactiveMessage={'\u0063\u0061\u0072\u006F\u0075\u0073\u0065\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065':{'\u0063\u0061\u0072\u0064\u0073':await Promise['\u0061\u006C\u006C'](message['\u0063\u0061\u0072\u0064\u0073']['\u006D\u0061\u0070'](async card=>{let _0x3b5fd;let carouselHeader={};_0x3b5fd=655162^655165;if(hasNonNullishProperty(card,"tcudorp".split("").reverse().join(""))){carouselHeader['\u0070\u0072\u006F\u0064\u0075\u0063\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=await prepareProductMessage(card,options);}else{carouselHeader=await prepareWAMessageMedia(card,options)['\u0063\u0061\u0074\u0063\u0068'](()=>({}));}const isValidHeader=hasValidCarouselHeader(carouselHeader);if(!isValidHeader){throw new Boom("\u0049\u006E\u0076\u0061\u006C\u0069\u0064\u0020\u006D\u0065\u0064\u0069\u0061\u0020\u0074\u0079\u0070\u0065\u0020\u0066\u006F\u0072\u0020\u0063\u0061\u0072\u006F\u0075\u0073\u0065\u006C\u0020\u0063\u0061\u0072\u0064",{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}const carouselCard={"nativeFlowMessage":prepareNativeFlowButtons(card['\u006E\u0061\u0074\u0069\u0076\u0065\u0046\u006C\u006F\u0077']?card:[])};if(hasOptionalProperty(card,"txet".split("").reverse().join(""))){carouselCard['\u0062\u006F\u0064\u0079']={"text":card['\u0074\u0065\u0078\u0074']};}else{if(hasOptionalProperty(card,"\u0063\u0061\u0070\u0074\u0069\u006F\u006E")){carouselCard['\u0068\u0065\u0061\u0064\u0065\u0072']={'\u0074\u0069\u0074\u006C\u0065':card['\u0074\u0069\u0074\u006C\u0065']||'',"subtitle":card['\u0073\u0075\u0062\u0074\u0069\u0074\u006C\u0065']||'',"hasMediaAttachment":isValidHeader};carouselCard['\u0062\u006F\u0064\u0079']={'\u0074\u0065\u0078\u0074':card['\u0063\u0061\u0070\u0074\u0069\u006F\u006E']};}if(hasOptionalProperty(card,"\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C")&&!!card['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C']){carouselCard['\u006A\u0070\u0065\u0067\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C']=card['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C'];}Object['\u0061\u0073\u0073\u0069\u0067\u006E'](carouselCard['\u0068\u0065\u0061\u0064\u0065\u0072'],carouselHeader);}if(hasOptionalProperty(card,"\u0061\u0075\u0064\u0069\u006F\u0046\u006F\u006F\u0074\u0065\u0072")){const{"audioMessage":audioMessage}=await prepareWAMessageMedia({'\u0061\u0075\u0064\u0069\u006F':card['\u0061\u0075\u0064\u0069\u006F\u0046\u006F\u006F\u0074\u0065\u0072']},options);carouselCard['\u0066\u006F\u006F\u0074\u0065\u0072']={'\u0061\u0075\u0064\u0069\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065':audioMessage,'\u0068\u0061\u0073\u004D\u0065\u0064\u0069\u0061\u0041\u0074\u0074\u0061\u0063\u0068\u006D\u0065\u006E\u0074':!![]};}else if(hasOptionalProperty(card,"retoof".split("").reverse().join(""))){carouselCard['\u0066\u006F\u006F\u0074\u0065\u0072']={'\u0074\u0065\u0078\u0074':card['\u0066\u006F\u006F\u0074\u0065\u0072']};}return carouselCard;})),'\u0063\u0061\u0072\u006F\u0075\u0073\u0065\u006C\u0043\u0061\u0072\u0064\u0054\u0079\u0070\u0065':CarouselCardType['\u0055\u004E\u004B\u004E\u004F\u0057\u004E'],'\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0056\u0065\u0072\u0073\u0069\u006F\u006E':1}};_0x9a72f=378311^378304;if(hasOptionalProperty(message,"\u0074\u0065\u0078\u0074")){interactiveMessage['\u0062\u006F\u0064\u0079']={'\u0074\u0065\u0078\u0074':message['\u0074\u0065\u0078\u0074']};}if(hasOptionalProperty(message,"retoof".split("").reverse().join(""))){interactiveMessage['\u0066\u006F\u006F\u0074\u0065\u0072']={"text":message['\u0066\u006F\u006F\u0074\u0065\u0072']};}m={'\u0069\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u0076\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065':interactiveMessage};}else if(hasNonNullishProperty(message,"morFtnemyaPtseuqer".split("").reverse().join(""))){var _0xdade9b=(900035^900038)+(985122^985123);const requestPaymentMessage={'\u0061\u006D\u006F\u0075\u006E\u0074':{'\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u0043\u006F\u0064\u0065':'IDR','\u006F\u0066\u0066\u0073\u0065\u0074':1000,"value":1000},"amount1000":1000,'\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u0043\u006F\u0064\u0065\u0049\u0073\u006F\u0034\u0032\u0031\u0037':"\u0049\u0044\u0052",'\u0065\u0078\u0070\u0069\u0072\u0079\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070':Date['\u006E\u006F\u0077'](),"noteMessage":m,"requestFrom":message['\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0050\u0061\u0079\u006D\u0065\u006E\u0074\u0046\u0072\u006F\u006D'],...message};_0xdade9b=(483993^483994)+(729116^729116);delete requestPaymentMessage['\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0050\u0061\u0079\u006D\u0065\u006E\u0074\u0046\u0072\u006F\u006D'];if(hasNonNullishProperty(m,"\u0065\u0078\u0074\u0065\u006E\u0064\u0065\u0064\u0054\u0065\u0078\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065")||hasNonNullishProperty(m,"\u0073\u0074\u0069\u0063\u006B\u0065\u0072\u004D\u0065\u0073\u0073\u0061\u0067\u0065")){Object['\u0061\u0073\u0073\u0069\u0067\u006E'](requestPaymentMessage['\u006E\u006F\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065'],m);}else{throw new Boom("\u0049\u006E\u0076\u0061\u006C\u0069\u0064\u0020\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0020\u0074\u0079\u0070\u0065\u0020\u0066\u006F\u0072\u0020\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0020\u0070\u0061\u0079\u006D\u0065\u006E\u0074\u0020\u006E\u006F\u0074\u0065\u0020\u006D\u0065\u0073\u0073\u0061\u0067\u0065",{"statusCode":400});}m={"requestPaymentMessage":requestPaymentMessage};}else if(hasNonNullishProperty(message,"\u0069\u006E\u0076\u006F\u0069\u0063\u0065\u004E\u006F\u0074\u0065")){let _0x08053a;const attachment=m['\u0069\u006D\u0061\u0067\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||m['\u0064\u006F\u0063\u0075\u006D\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065'];_0x08053a=(576205^576201)+(785658^785650);const type=Object['\u006B\u0065\u0079\u0073'](m)[361355^361355]['\u0072\u0065\u0070\u006C\u0061\u0063\u0065']("\u004D\u0065\u0073\u0073\u0061\u0067\u0065",'')['\u0074\u006F\u0055\u0070\u0070\u0065\u0072\u0043\u0061\u0073\u0065']();const invoiceMessage={'\u0061\u0074\u0074\u0061\u0063\u0068\u006D\u0065\u006E\u0074\u0054\u0079\u0070\u0065':proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0049\u006E\u0076\u006F\u0069\u0063\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0041\u0074\u0074\u0061\u0063\u0068\u006D\u0065\u006E\u0074\u0054\u0079\u0070\u0065'][type==="\u0044\u004F\u0043\u0055\u004D\u0045\u004E\u0054"?"\u0050\u0044\u0046":"\u0049\u004D\u0041\u0047\u0045"],'\u006E\u006F\u0074\u0065':message['\u0069\u006E\u0076\u006F\u0069\u0063\u0065\u004E\u006F\u0074\u0065']};if(attachment){const{"directPath":directPath,'\u0066\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036':fileEncSha256,"fileSha256":fileSha256,'\u006A\u0070\u0065\u0067\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C':jpegThumbnail=undefined,"mediaKey":mediaKey,"mediaKeyTimestamp":mediaKeyTimestamp,"mimetype":mimetype}=attachment;Object['\u0061\u0073\u0073\u0069\u0067\u006E'](invoiceMessage,{'\u0061\u0074\u0074\u0061\u0063\u0068\u006D\u0065\u006E\u0074\u0044\u0069\u0072\u0065\u0063\u0074\u0050\u0061\u0074\u0068':directPath,'\u0061\u0074\u0074\u0061\u0063\u0068\u006D\u0065\u006E\u0074\u0046\u0069\u006C\u0065\u0045\u006E\u0063\u0053\u0068\u0061\u0032\u0035\u0036':fileEncSha256,'\u0061\u0074\u0074\u0061\u0063\u0068\u006D\u0065\u006E\u0074\u0046\u0069\u006C\u0065\u0053\u0068\u0061\u0032\u0035\u0036':fileSha256,"attachmentJpegThumbnail":jpegThumbnail,"attachmentMediaKey":mediaKey,'\u0061\u0074\u0074\u0061\u0063\u0068\u006D\u0065\u006E\u0074\u004D\u0065\u0064\u0069\u0061\u004B\u0065\u0079\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070':mediaKeyTimestamp,"attachmentMimetype":mimetype,'\u0074\u006F\u006B\u0065\u006E':generateMessageIDV2()});}else{throw new Boom("\u0049\u006E\u0076\u0061\u006C\u0069\u0064\u0020\u006D\u0065\u0064\u0069\u0061\u0020\u0074\u0079\u0070\u0065\u0020\u0066\u006F\u0072\u0020\u0069\u006E\u0076\u006F\u0069\u0063\u0065\u0020\u006D\u0065\u0073\u0073\u0061\u0067\u0065",{'\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006F\u0064\u0065':400});}m={'\u0069\u006E\u0076\u006F\u0069\u0063\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065':invoiceMessage};}if(hasOptionalProperty(message,"\u0065\u0078\u0074\u0065\u0072\u006E\u0061\u006C\u0041\u0064\u0052\u0065\u0070\u006C\u0079")&&!!message['\u0065\u0078\u0074\u0065\u0072\u006E\u0061\u006C\u0041\u0064\u0052\u0065\u0070\u006C\u0079']){const messageType=Object['\u006B\u0065\u0079\u0073'](m)[122388^122388];const key=m[messageType];const content=message['\u0065\u0078\u0074\u0065\u0072\u006E\u0061\u006C\u0041\u0064\u0052\u0065\u0070\u006C\u0079'];if("lianbmuht".split("").reverse().join("")in content&&!Buffer['\u0069\u0073\u0042\u0075\u0066\u0066\u0065\u0072'](content['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C'])){throw new Boom("\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C\u0020\u006D\u0075\u0073\u0074\u0020\u0069\u006E\u0020\u0062\u0075\u0066\u0066\u0065\u0072\u0020\u0074\u0079\u0070\u0065",{"statusCode":400});}if(!content['\u0075\u0072\u006C']||typeof content['\u0075\u0072\u006C']!=="gnirts".split("").reverse().join("")){content['\u0075\u0072\u006C']=DONATE_URL;}const externalAdReply={...content,"body":content['\u0062\u006F\u0064\u0079'],'\u006D\u0065\u0064\u0069\u0061\u0054\u0079\u0070\u0065':content['\u006D\u0065\u0064\u0069\u0061\u0054\u0079\u0070\u0065']||230089^230088,"mediaUrl":content['\u0075\u0072\u006C'],"renderLargerThumbnail":content['\u006C\u0061\u0072\u0067\u0065\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C'],"sourceUrl":content['\u0075\u0072\u006C'],"thumbnail":content['\u0074\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C'],"thumbnailUrl":content['\u0075\u0072\u006C']+"\u003F\u0075\u0070\u0064\u0061\u0074\u0065\u003D"+Date['\u006E\u006F\u0077'](),"title":content['\u0074\u0069\u0074\u006C\u0065']||LIBRARY_NAME};delete externalAdReply['\u0073\u0075\u0062\u0054\u0069\u0074\u006C\u0065'];delete externalAdReply['\u006C\u0061\u0072\u0067\u0065\u0054\u0068\u0075\u006D\u0062\u006E\u0061\u0069\u006C'];delete externalAdReply['\u0075\u0072\u006C'];if("\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F"in key&&!!key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']['\u0065\u0078\u0074\u0065\u0072\u006E\u0061\u006C\u0041\u0064\u0052\u0065\u0070\u006C\u0079']={...key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']['\u0065\u0078\u0074\u0065\u0072\u006E\u0061\u006C\u0041\u0064\u0052\u0065\u0070\u006C\u0079'],...externalAdReply};}else if(key){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={"externalAdReply":externalAdReply};}}if(hasOptionalProperty(message,"\u006D\u0065\u006E\u0074\u0069\u006F\u006E\u0073")&&message['\u006D\u0065\u006E\u0074\u0069\u006F\u006E\u0073']?.length||hasOptionalProperty(message,"\u006D\u0065\u006E\u0074\u0069\u006F\u006E\u0041\u006C\u006C")&&message['\u006D\u0065\u006E\u0074\u0069\u006F\u006E\u0041\u006C\u006C']){const messageType=Object['\u006B\u0065\u0079\u0073'](m)[651006^651006];const key=m[messageType];if(key&&"ofnItxetnoc".split("").reverse().join("")in key){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']=key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']||{};if(message['\u006D\u0065\u006E\u0074\u0069\u006F\u006E\u0073']?.length){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']['\u006D\u0065\u006E\u0074\u0069\u006F\u006E\u0065\u0064\u004A\u0069\u0064']=message['\u006D\u0065\u006E\u0074\u0069\u006F\u006E\u0073'];}if(message['\u006D\u0065\u006E\u0074\u0069\u006F\u006E\u0041\u006C\u006C']){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']['\u006E\u006F\u006E\u004A\u0069\u0064\u004D\u0065\u006E\u0074\u0069\u006F\u006E\u0073']=130717^130716;}}else if(key){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={'\u006D\u0065\u006E\u0074\u0069\u006F\u006E\u0065\u0064\u004A\u0069\u0064':message['\u006D\u0065\u006E\u0074\u0069\u006F\u006E\u0073'],'\u006E\u006F\u006E\u004A\u0069\u0064\u004D\u0065\u006E\u0074\u0069\u006F\u006E\u0073':message['\u006D\u0065\u006E\u0074\u0069\u006F\u006E\u0041\u006C\u006C']?738267^738266:171279^171279};}}if(hasOptionalProperty(message,"ofnItxetnoc".split("").reverse().join(""))&&!!message['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']){var _0xge7a0g=(217030^217038)+(594989^594980);const messageType=Object['\u006B\u0065\u0079\u0073'](m)[783321^783321];_0xge7a0g='\u0065\u0062\u0071\u0067\u0067\u006E';const key=m[messageType];if("ofnItxetnoc".split("").reverse().join("")in key&&!!key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={...key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F'],...message['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']};}else if(key){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']=message['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F'];}}if(hasOptionalProperty(message,"\u0067\u0072\u006F\u0075\u0070\u0053\u0074\u0061\u0074\u0075\u0073")&&!!message['\u0067\u0072\u006F\u0075\u0070\u0053\u0074\u0061\u0074\u0075\u0073']){const messageType=Object['\u006B\u0065\u0079\u0073'](m)[484799^484799];var _0x66a5f=(129002^129005)+(450553^450557);const key=m[messageType];_0x66a5f='\u006C\u0069\u006B\u006E\u0068\u006C';if("ofnItxetnoc".split("").reverse().join("")in key&&!!key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']['\u0069\u0073\u0047\u0072\u006F\u0075\u0070\u0053\u0074\u0061\u0074\u0075\u0073']=message['\u0067\u0072\u006F\u0075\u0070\u0053\u0074\u0061\u0074\u0075\u0073'];}else if(key){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={'\u0069\u0073\u0047\u0072\u006F\u0075\u0070\u0053\u0074\u0061\u0074\u0075\u0073':message['\u0067\u0072\u006F\u0075\u0070\u0053\u0074\u0061\u0074\u0075\u0073']};}m={'\u0067\u0072\u006F\u0075\u0070\u0053\u0074\u0061\u0074\u0075\u0073\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0056\u0032':{'\u006D\u0065\u0073\u0073\u0061\u0067\u0065':m}};delete message['\u0067\u0072\u006F\u0075\u0070\u0053\u0074\u0061\u0074\u0075\u0073'];}if(hasOptionalProperty(message,"reliops".split("").reverse().join(""))&&!!message['\u0073\u0070\u006F\u0069\u006C\u0065\u0072']){let _0xf2fg9d;const messageType=Object['\u006B\u0065\u0079\u0073'](m)[939496^939496];_0xf2fg9d="npheki".split("").reverse().join("");var _0x34b79b=(742561^742567)+(198251^198243);const key=m[messageType];_0x34b79b=(207019^207010)+(655332^655333);if("\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F"in key&&!!key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']['\u0069\u0073\u0053\u0070\u006F\u0069\u006C\u0065\u0072']=message['\u0073\u0070\u006F\u0069\u006C\u0065\u0072'];}else if(key){key['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={"isSpoiler":message['\u0073\u0070\u006F\u0069\u006C\u0065\u0072']};}m={"spoilerMessage":{"message":m}};delete message['\u0073\u0070\u006F\u0069\u006C\u0065\u0072'];}else if(hasOptionalProperty(message,"\u0069\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u0076\u0065\u0041\u0073\u0054\u0065\u006D\u0070\u006C\u0061\u0074\u0065")&&!!message['\u0069\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u0076\u0065\u0041\u0073\u0054\u0065\u006D\u0070\u006C\u0061\u0074\u0065']){if(!m['\u0069\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u0076\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']){throw new Boom("\u0049\u006E\u0076\u0061\u006C\u0069\u0064\u0020\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0020\u0074\u0079\u0070\u0065\u0020\u0066\u006F\u0072\u0020\u0074\u0065\u006D\u0070\u006C\u0061\u0074\u0065",{"statusCode":400});}m={'\u0074\u0065\u006D\u0070\u006C\u0061\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065':{'\u0069\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u0076\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0054\u0065\u006D\u0070\u006C\u0061\u0074\u0065':m['\u0069\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u0076\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065'],"templateId":message['\u0069\u0064']||"-etalpmet".split("").reverse().join("")+Date['\u006E\u006F\u0077']()}};delete message['\u0069\u006E\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u0076\u0065\u0041\u0073\u0054\u0065\u006D\u0070\u006C\u0061\u0074\u0065'];}if(hasOptionalProperty(message,"laremehpe".split("").reverse().join(""))&&!!message['\u0065\u0070\u0068\u0065\u006D\u0065\u0072\u0061\u006C']){m={"ephemeralMessage":{'\u006D\u0065\u0073\u0073\u0061\u0067\u0065':m}};delete message['\u0065\u0070\u0068\u0065\u006D\u0065\u0072\u0061\u006C'];}if(hasOptionalProperty(message,"eittoLsi".split("").reverse().join(""))&&!!message['\u0069\u0073\u004C\u006F\u0074\u0074\u0069\u0065']){m={"lottieStickerMessage":{"message":m}};}else if(hasOptionalProperty(message,"\u0076\u0069\u0065\u0077\u004F\u006E\u0063\u0065")&&!!message['\u0076\u0069\u0065\u0077\u004F\u006E\u0063\u0065']){m={'\u0076\u0069\u0065\u0077\u004F\u006E\u0063\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065':{"message":m}};}else if(hasOptionalProperty(message,"2VecnOweiv".split("").reverse().join(""))&&!!message['\u0076\u0069\u0065\u0077\u004F\u006E\u0063\u0065\u0056\u0032']){m={'\u0076\u0069\u0065\u0077\u004F\u006E\u0063\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0056\u0032':{'\u006D\u0065\u0073\u0073\u0061\u0067\u0065':m}};delete message['\u0076\u0069\u0065\u0077\u004F\u006E\u0063\u0065\u0056\u0032'];}else if(hasOptionalProperty(message,"\u0076\u0069\u0065\u0077\u004F\u006E\u0063\u0065\u0056\u0032\u0045\u0078\u0074\u0065\u006E\u0073\u0069\u006F\u006E")&&!!message['\u0076\u0069\u0065\u0077\u004F\u006E\u0063\u0065\u0056\u0032\u0045\u0078\u0074\u0065\u006E\u0073\u0069\u006F\u006E']){m={'\u0076\u0069\u0065\u0077\u004F\u006E\u0063\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0056\u0032\u0045\u0078\u0074\u0065\u006E\u0073\u0069\u006F\u006E':{'\u006D\u0065\u0073\u0073\u0061\u0067\u0065':m}};delete message['\u0076\u0069\u0065\u0077\u004F\u006E\u0063\u0065\u0056\u0032\u0045\u0078\u0074\u0065\u006E\u0073\u0069\u006F\u006E'];}if(hasOptionalProperty(message,"tide".split("").reverse().join(""))){m={'\u0070\u0072\u006F\u0074\u006F\u0063\u006F\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065':{'\u006B\u0065\u0079':message['\u0065\u0064\u0069\u0074'],'\u0065\u0064\u0069\u0074\u0065\u0064\u004D\u0065\u0073\u0073\u0061\u0067\u0065':m,'\u0074\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070\u004D\u0073':Date['\u006E\u006F\u0077'](),'\u0074\u0079\u0070\u0065':WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0050\u0072\u006F\u0074\u006F\u0063\u006F\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0054\u0079\u0070\u0065']['\u004D\u0045\u0053\u0053\u0041\u0047\u0045\u005F\u0045\u0044\u0049\u0054']}};}if(options?.messageSecret&&!m['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']?.messageSecret){m['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={...(m['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']??{}),'\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0053\u0065\u0063\u0072\u0065\u0074':options['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0053\u0065\u0063\u0072\u0065\u0074']};}if(shouldIncludeReportingToken(m)){m['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']=m['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']||{};if(!m['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0053\u0065\u0063\u0072\u0065\u0074']){m['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0053\u0065\u0063\u0072\u0065\u0074']=randomBytes(895080^895048);}}return WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0063\u0072\u0065\u0061\u0074\u0065'](m);};_0xab43b=679018^679016;export const generateWAMessageFromContent=(jid,message,options)=>{if(!options['\u0074\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070']){options['\u0074\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070']=new Date();}let _0x2g808f;const innerMessage=normalizeMessageContent(message);_0x2g808f=405239^405233;const messageContextInfo=message['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F'];const key=getContentType(innerMessage);const timestamp=unixTimestampSeconds(options['\u0074\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070']);var _0xec6b7g=(309305^309308)+(947210^947212);const isNewsletter=isJidNewsletter(jid);_0xec6b7g=(448852^448852)+(753290^753291);const{"quoted":quoted,'\u0075\u0073\u0065\u0072\u004A\u0069\u0064':userJid}=options;if(quoted){const participant=quoted['\u006B\u0065\u0079']['\u0066\u0072\u006F\u006D\u004D\u0065']?userJid:quoted['\u0070\u0061\u0072\u0074\u0069\u0063\u0069\u0070\u0061\u006E\u0074']||quoted['\u006B\u0065\u0079']['\u0070\u0061\u0072\u0074\u0069\u0063\u0069\u0070\u0061\u006E\u0074']||quoted['\u006B\u0065\u0079']['\u0072\u0065\u006D\u006F\u0074\u0065\u004A\u0069\u0064'];let _0x6f_0x6f9;let quotedMsg=normalizeMessageContent(quoted['\u006D\u0065\u0073\u0073\u0061\u0067\u0065']);_0x6f_0x6f9="necoip".split("").reverse().join("");const msgType=getContentType(quotedMsg);quotedMsg=proto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0063\u0072\u0065\u0061\u0074\u0065']({["msgType"]:quotedMsg[msgType]});const quotedContent=quotedMsg[msgType];if(typeof quotedContent==="\u006F\u0062\u006A\u0065\u0063\u0074"&&quotedContent&&"ofnItxetnoc".split("").reverse().join("")in quotedContent){delete quotedContent['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F'];}const contextInfo="ofnItxetnoc".split("").reverse().join("")in innerMessage[key]&&innerMessage[key]?.contextInfo||{};contextInfo['\u0070\u0061\u0072\u0074\u0069\u0063\u0069\u0070\u0061\u006E\u0074']=jidNormalizedUser(participant);contextInfo['\u0073\u0074\u0061\u006E\u007A\u0061\u0049\u0064']=quoted['\u006B\u0065\u0079']['\u0069\u0064'];contextInfo['\u0071\u0075\u006F\u0074\u0065\u0064\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=quotedMsg;if(!isNewsletter&&jid!==quoted['\u006B\u0065\u0079']['\u0072\u0065\u006D\u006F\u0074\u0065\u004A\u0069\u0064']){contextInfo['\u0072\u0065\u006D\u006F\u0074\u0065\u004A\u0069\u0064']=quoted['\u006B\u0065\u0079']['\u0072\u0065\u006D\u006F\u0074\u0065\u004A\u0069\u0064'];}if(contextInfo&&innerMessage[key]){innerMessage[key]['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']=contextInfo;}}if(!!options?.ephemeralExpiration&&key!=="\u0070\u0072\u006F\u0074\u006F\u0063\u006F\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065"&&key!=="\u0065\u0070\u0068\u0065\u006D\u0065\u0072\u0061\u006C\u004D\u0065\u0073\u0073\u0061\u0067\u0065"&&!isNewsletter){innerMessage[key]['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']={...(innerMessage[key]['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u0049\u006E\u0066\u006F']||{}),"expiration":options['\u0065\u0070\u0068\u0065\u006D\u0065\u0072\u0061\u006C\u0045\u0078\u0070\u0069\u0072\u0061\u0074\u0069\u006F\u006E']||WA_DEFAULT_EPHEMERAL};}if(messageContextInfo?.messageSecret&&(isPnUser(jid)||isLidUser(jid))){messageContextInfo['\u0064\u0065\u0076\u0069\u0063\u0065\u004C\u0069\u0073\u0074\u004D\u0065\u0074\u0061\u0064\u0061\u0074\u0061']={'\u0072\u0065\u0063\u0069\u0070\u0069\u0065\u006E\u0074\u004B\u0065\u0079\u0048\u0061\u0073\u0068':randomBytes(795271^795277),'\u0072\u0065\u0063\u0069\u0070\u0069\u0065\u006E\u0074\u0054\u0069\u006D\u0065\u0073\u0074\u0061\u006D\u0070':unixTimestampSeconds()};messageContextInfo['\u0064\u0065\u0076\u0069\u0063\u0065\u004C\u0069\u0073\u0074\u004D\u0065\u0074\u0061\u0064\u0061\u0074\u0061\u0056\u0065\u0072\u0073\u0069\u006F\u006E']=904020^904022;}message=WAProto['\u004D\u0065\u0073\u0073\u0061\u0067\u0065']['\u0063\u0072\u0065\u0061\u0074\u0065'](message);const messageJSON={"key":{'\u0072\u0065\u006D\u006F\u0074\u0065\u004A\u0069\u0064':jid,'\u0066\u0072\u006F\u006D\u004D\u0065':!![],"id":options?.messageId||generateMessageIDV2()},'\u006D\u0065\u0073\u0073\u0061\u0067\u0065':message,"messageTimestamp":timestamp,"messageStubParameters":[],"participant":isJidGroup(jid)||isJidStatusBroadcast(jid)?userJid:undefined,'\u0073\u0074\u0061\u0074\u0075\u0073':WAMessageStatus['\u0050\u0045\u004E\u0044\u0049\u004E\u0047']};return WAProto['\u0057\u0065\u0062\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0049\u006E\u0066\u006F']['\u0066\u0072\u006F\u006D\u004F\u0062\u006A\u0065\u0063\u0074'](messageJSON);};export const generateWAMessage=async(jid,content,options)=>{options['\u006C\u006F\u0067\u0067\u0065\u0072']=options?.logger?.child({'\u006D\u0073\u0067\u0049\u0064':options['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0049\u0064']});if(jid){options['\u006A\u0069\u0064']=jid;}return generateWAMessageFromContent(jid,await generateWAMessageContent(content,options),options);};export const getContentType=content=>{if(content){const keys=Object['\u006B\u0065\u0079\u0073'](content);const key=keys['\u0066\u0069\u006E\u0064'](k=>(k==="noitasrevnoc".split("").reverse().join("")||k['\u0069\u006E\u0063\u006C\u0075\u0064\u0065\u0073']("egasseM".split("").reverse().join("")))&&k!=="\u0073\u0065\u006E\u0064\u0065\u0072\u004B\u0065\u0079\u0044\u0069\u0073\u0074\u0072\u0069\u0062\u0075\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065");return key;}};export const normalizeMessageContent=content=>{if(!content){return undefined;}for(let i=716811^716811;i<(241316^241313);i++){let _0xddef;const inner=_0xc2_0x3ec(content);_0xddef=774006^774015;if(!inner){break;}content=inner['\u006D\u0065\u0073\u0073\u0061\u0067\u0065'];}return content;function _0xc2_0x3ec(message){return message?.associatedChildMessage||message?.botForwardedMessage||message?.botInvokeMessage||message?.botTaskMessage||message?.documentWithCaptionMessage||message?.editedMessage||message?.ephemeralMessage||message?.eventCoverImage||message?.groupMentionedMessage||message?.groupStatusMentionMessage||message?.groupStatusMessage||message?.groupStatusMessageV2||message?.limitSharingMessage||message?.lottieStickerMessage||message?.newsletterAdminProfileMessage||message?.newsletterAdminProfileMessageV2||message?.newsletterAdminProfileStatusMessage||message?.pollCreationMessageV4||message?.pollCreationOptionImageMessage||message?.questionMessage||message?.questionReplyMessage||message?.spoilerMessage||message?.statusAddYours||message?.statusMentionMessage||message?.viewOnceMessage||message?.viewOnceMessageV2||message?.viewOnceMessageV2Extension;}};var _0xd2_0x459=(974492^974490)+(509832^509836);export const extractMessageContent=content=>{var _0x8642b=(692949^692949)+(666904^666904);const extractFromTemplateMessage=msg=>{if(msg['\u0069\u006D\u0061\u0067\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']){return{'\u0069\u006D\u0061\u0067\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065':msg['\u0069\u006D\u0061\u0067\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']};}else if(msg['\u0064\u006F\u0063\u0075\u006D\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']){return{"documentMessage":msg['\u0064\u006F\u0063\u0075\u006D\u0065\u006E\u0074\u004D\u0065\u0073\u0073\u0061\u0067\u0065']};}else if(msg['\u0076\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065']){return{'\u0076\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065':msg['\u0076\u0069\u0064\u0065\u006F\u004D\u0065\u0073\u0073\u0061\u0067\u0065']};}else if(msg['\u006C\u006F\u0063\u0061\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065']){return{'\u006C\u006F\u0063\u0061\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065':msg['\u006C\u006F\u0063\u0061\u0074\u0069\u006F\u006E\u004D\u0065\u0073\u0073\u0061\u0067\u0065']};}else{return{'\u0063\u006F\u006E\u0076\u0065\u0072\u0073\u0061\u0074\u0069\u006F\u006E':"\u0063\u006F\u006E\u0074\u0065\u006E\u0074\u0054\u0065\u0078\u0074"in msg?msg['\u0063\u006F\u006E\u0074\u0065\u006E\u0074\u0054\u0065\u0078\u0074']:"txeTtnetnoCdetardyh".split("").reverse().join("")in msg?msg['\u0068\u0079\u0064\u0072\u0061\u0074\u0065\u0064\u0043\u006F\u006E\u0074\u0065\u006E\u0074\u0054\u0065\u0078\u0074']:''};}};_0x8642b=(650375^650373)+(934744^934748);content=normalizeMessageContent(content);if(content?.buttonsMessage){return extractFromTemplateMessage(content['\u0062\u0075\u0074\u0074\u006F\u006E\u0073\u004D\u0065\u0073\u0073\u0061\u0067\u0065']);}if(content?.templateMessage?.hydratedFourRowTemplate){return extractFromTemplateMessage(content?.templateMessage?.hydratedFourRowTemplate);}if(content?.templateMessage?.hydratedTemplate){return extractFromTemplateMessage(content?.templateMessage?.hydratedTemplate);}if(content?.templateMessage?.fourRowTemplate){return extractFromTemplateMessage(content?.templateMessage?.fourRowTemplate);}return content;};_0xd2_0x459=(163263^163258)+(841631^841623);export const getDevice=id=>new RegExp("$}81{.A3^".split("").reverse().join(""),"")['\u0074\u0065\u0073\u0074'](id)?"\u0069\u006F\u0073":new RegExp('\u005E\u0033\u0045\u002E\u007B\u0032\u0030\u007D\u0024',"")['\u0074\u0065\u0073\u0074'](id)?"bew".split("").reverse().join(""):new RegExp('\u005E\u0028\u002E\u007B\u0032\u0031\u007D\u007C\u002E\u007B\u0033\u0032\u007D\u0029\u0024',"")['\u0074\u0065\u0073\u0074'](id)?"\u0061\u006E\u0064\u0072\u006F\u0069\u0064":new RegExp('\u005E\u0028\u0033\u0046\u007C\u002E\u007B\u0031\u0038\u007D\u0024\u0029',"")['\u0074\u0065\u0073\u0074'](id)?"\u0064\u0065\u0073\u006B\u0074\u006F\u0070":"\u0075\u006E\u006B\u006E\u006F\u0077\u006E";export const updateMessageWithReceipt=(msg,receipt)=>{msg['\u0075\u0073\u0065\u0072\u0052\u0065\u0063\u0065\u0069\u0070\u0074']=msg['\u0075\u0073\u0065\u0072\u0052\u0065\u0063\u0065\u0069\u0070\u0074']||[];const recp=msg['\u0075\u0073\u0065\u0072\u0052\u0065\u0063\u0065\u0069\u0070\u0074']['\u0066\u0069\u006E\u0064'](m=>m['\u0075\u0073\u0065\u0072\u004A\u0069\u0064']===receipt['\u0075\u0073\u0065\u0072\u004A\u0069\u0064']);if(recp){Object['\u0061\u0073\u0073\u0069\u0067\u006E'](recp,receipt);}else{msg['\u0075\u0073\u0065\u0072\u0052\u0065\u0063\u0065\u0069\u0070\u0074']['\u0070\u0075\u0073\u0068'](receipt);}};var _0xfe_0xg2d=(258811^258808)+(696363^696365);export const updateMessageWithReaction=(msg,reaction)=>{var _0x7e20gb=(768514^768517)+(576739^576741);const authorID=getKeyAuthor(reaction['\u006B\u0065\u0079']);_0x7e20gb="qjnoji".split("").reverse().join("");const reactions=(msg['\u0072\u0065\u0061\u0063\u0074\u0069\u006F\u006E\u0073']||[])['\u0066\u0069\u006C\u0074\u0065\u0072'](r=>getKeyAuthor(r['\u006B\u0065\u0079'])!==authorID);reaction['\u0074\u0065\u0078\u0074']=reaction['\u0074\u0065\u0078\u0074']||'';reactions['\u0070\u0075\u0073\u0068'](reaction);msg['\u0072\u0065\u0061\u0063\u0074\u0069\u006F\u006E\u0073']=reactions;};_0xfe_0xg2d=(916913^916915)+(864697^864699);var _0xa31b2a=(631418^631416)+(546017^546025);export const updateMessageWithPollUpdate=(msg,update)=>{var _0x816gg=(707450^707443)+(682094^682091);const authorID=getKeyAuthor(update['\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u004B\u0065\u0079']);_0x816gg=(857410^857418)+(537845^537846);const reactions=(msg['\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065\u0073']||[])['\u0066\u0069\u006C\u0074\u0065\u0072'](r=>getKeyAuthor(r['\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u004B\u0065\u0079'])!==authorID);if(update['\u0076\u006F\u0074\u0065']?.selectedOptions?.length){reactions['\u0070\u0075\u0073\u0068'](update);}msg['\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065\u0073']=reactions;};_0xa31b2a=(723332^723334)+(555574^555570);export const updateMessageWithEventResponse=(msg,update)=>{let _0x22a4fg;const authorID=getKeyAuthor(update['\u0065\u0076\u0065\u006E\u0074\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u004B\u0065\u0079']);_0x22a4fg=168940^168936;const responses=(msg['\u0065\u0076\u0065\u006E\u0074\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u0073']||[])['\u0066\u0069\u006C\u0074\u0065\u0072'](r=>getKeyAuthor(r['\u0065\u0076\u0065\u006E\u0074\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u004B\u0065\u0079'])!==authorID);responses['\u0070\u0075\u0073\u0068'](update);msg['\u0065\u0076\u0065\u006E\u0074\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u0073']=responses;};function _0xfg_0xe66({'\u006D\u0065\u0073\u0073\u0061\u0067\u0065':message,'\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065\u0073':pollUpdates},meId,_0xc5b1b){const _0x636f=message?.pollCreationMessage?.options||message?.pollCreationMessageV2?.options||message?.pollCreationMessageV3?.options||[];_0xc5b1b='\u0061\u0068\u0063\u0068\u0064\u006F';const _0x935d=_0x636f['\u0072\u0065\u0064\u0075\u0063\u0065']((acc,opt)=>{const hash=sha256(Buffer['\u0066\u0072\u006F\u006D'](opt['\u006F\u0070\u0074\u0069\u006F\u006E\u004E\u0061\u006D\u0065']||''))['\u0074\u006F\u0053\u0074\u0072\u0069\u006E\u0067']();acc[hash]={"name":opt['\u006F\u0070\u0074\u0069\u006F\u006E\u004E\u0061\u006D\u0065']||'','\u0076\u006F\u0074\u0065\u0072\u0073':[]};return acc;},{});for(const _0xfcb87d of pollUpdates||[]){const{"vote":vote}=_0xfcb87d;if(!vote){continue;}for(const _0x3d_0x757 of vote['\u0073\u0065\u006C\u0065\u0063\u0074\u0065\u0064\u004F\u0070\u0074\u0069\u006F\u006E\u0073']||[]){const hash=_0x3d_0x757['\u0074\u006F\u0053\u0074\u0072\u0069\u006E\u0067']();var _0x8450ec=(930449^930455)+(805339^805337);let _0x6g97ag=_0x935d[hash];_0x8450ec=(911417^911416)+(612723^612731);if(!_0x6g97ag){_0x935d[hash]={'\u006E\u0061\u006D\u0065':'Unknown','\u0076\u006F\u0074\u0065\u0072\u0073':[]};_0x6g97ag=_0x935d[hash];}_0x935d[hash]['\u0076\u006F\u0074\u0065\u0072\u0073']['\u0070\u0075\u0073\u0068'](getKeyAuthor(_0xfcb87d['\u0070\u006F\u006C\u006C\u0055\u0070\u0064\u0061\u0074\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u004B\u0065\u0079'],meId));}}return Object['\u0076\u0061\u006C\u0075\u0065\u0073'](_0x935d);}export{_0xfg_0xe66 as getAggregateVotesInPollMessage};function _0x535ec({"eventResponses":eventResponses},meId){var _0xadefa=(598953^598944)+(718308^718308);const _0xa730e=["\u0047\u004F\u0049\u004E\u0047","GNIOG_TON".split("").reverse().join(""),"\u004D\u0041\u0059\u0042\u0045"];_0xadefa=(509721^509722)+(259530^259533);const _0xa7e45c={};for(const _0x3d654e of _0xa730e){_0xa7e45c[_0x3d654e]={"response":_0x3d654e,'\u0072\u0065\u0073\u0070\u006F\u006E\u0064\u0065\u0072\u0073':[]};}for(const _0x4af of eventResponses||[]){const _0x3cf=_0x4af['\u0065\u0076\u0065\u006E\u0074\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065']||"NWONKNU".split("").reverse().join("");if(_0x3cf!=="\u0055\u004E\u004B\u004E\u004F\u0057\u004E"&&_0xa7e45c[_0x3cf]){_0xa7e45c[_0x3cf]['\u0072\u0065\u0073\u0070\u006F\u006E\u0064\u0065\u0072\u0073']['\u0070\u0075\u0073\u0068'](getKeyAuthor(_0x4af['\u0065\u0076\u0065\u006E\u0074\u0052\u0065\u0073\u0070\u006F\u006E\u0073\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u004B\u0065\u0079'],meId));}}return Object['\u0076\u0061\u006C\u0075\u0065\u0073'](_0xa7e45c);}export{_0x535ec as getAggregateResponsesInEventMessage};var _0xacg3d=(132259^132262)+(263948^263947);export const aggregateMessageKeysNotFromMe=keys=>{const keyMap={};for(const{'\u0072\u0065\u006D\u006F\u0074\u0065\u004A\u0069\u0064':remoteJid,'\u0069\u0064':id,"participant":participant,'\u0066\u0072\u006F\u006D\u004D\u0065':fromMe}of keys){if(!fromMe){const uqKey=`${remoteJid}:${participant||''}`;if(!keyMap[uqKey]){keyMap[uqKey]={'\u006A\u0069\u0064':remoteJid,'\u0070\u0061\u0072\u0074\u0069\u0063\u0069\u0070\u0061\u006E\u0074':participant,'\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0049\u0064\u0073':[]};}keyMap[uqKey]['\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0049\u0064\u0073']['\u0070\u0075\u0073\u0068'](id);}}return Object['\u0076\u0061\u006C\u0075\u0065\u0073'](keyMap);};_0xacg3d='\u006D\u0062\u006B\u006C\u0061\u0062';const REUPLOAD_REQUIRED_STATUS=[683996^683590,488997^489393];export const downloadMediaMessage=async(message,type,options,ctx)=>{let _0xbg7c;const result=await _0x1c9dc()['\u0063\u0061\u0074\u0063\u0068'](async error=>{if(ctx&&typeof error?.status==="\u006E\u0075\u006D\u0062\u0065\u0072"&&REUPLOAD_REQUIRED_STATUS['\u0069\u006E\u0063\u006C\u0075\u0064\u0065\u0073'](error['\u0073\u0074\u0061\u0074\u0075\u0073'])){ctx['\u006C\u006F\u0067\u0067\u0065\u0072']['\u0