n8n-nodes-new-evolution-api 3.0.8 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nodes/EvolutionApi/execute/index.js +12 -0
- package/dist/nodes/EvolutionApi/execute/index.js.map +1 -1
- package/dist/nodes/EvolutionApi/execute/messages/sendAlbum.d.ts +25 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendAlbum.js +93 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendAlbum.js.map +1 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendCarousel.d.ts +25 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendCarousel.js +140 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendCarousel.js.map +1 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendCollection.d.ts +25 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendCollection.js +96 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendCollection.js.map +1 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendPix.js +35 -15
- package/dist/nodes/EvolutionApi/execute/messages/sendPix.js.map +1 -1
- package/dist/nodes/EvolutionApi/execute/messages/sendShop.d.ts +25 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendShop.js +97 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendShop.js.map +1 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendStatusMentions.d.ts +25 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendStatusMentions.js +93 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendStatusMentions.js.map +1 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendStickerPack.d.ts +25 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendStickerPack.js +90 -0
- package/dist/nodes/EvolutionApi/execute/messages/sendStickerPack.js.map +1 -0
- package/dist/nodes/EvolutionApi/properties/messages.fields.js +849 -0
- package/dist/nodes/EvolutionApi/properties/messages.fields.js.map +1 -1
- package/dist/nodes/EvolutionApi/properties/messages.operations.js +37 -1
- package/dist/nodes/EvolutionApi/properties/messages.operations.js.map +1 -1
- package/dist/package.json +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendShop = sendShop;
|
|
4
|
+
const evolutionRequest_1 = require("../evolutionRequest");
|
|
5
|
+
async function sendShop(ef) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
try {
|
|
8
|
+
const instanceName = ef.getNodeParameter('instanceName', 0);
|
|
9
|
+
const recipientType = ef.getNodeParameter('recipientType', 0, 'number');
|
|
10
|
+
let remoteJid;
|
|
11
|
+
if (recipientType === 'group') {
|
|
12
|
+
remoteJid = ef.getNodeParameter('groupJid', 0);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
remoteJid = ef.getNodeParameter('remoteJid', 0);
|
|
16
|
+
}
|
|
17
|
+
const shopId = ef.getNodeParameter('shopId', 0);
|
|
18
|
+
const title = ef.getNodeParameter('shopTitle', 0, '');
|
|
19
|
+
const body = ef.getNodeParameter('shopBody', 0, '');
|
|
20
|
+
const subtitle = ef.getNodeParameter('shopSubtitle', 0, '');
|
|
21
|
+
const footer = ef.getNodeParameter('shopFooter', 0, '');
|
|
22
|
+
const surface = ef.getNodeParameter('shopSurface', 0, 1);
|
|
23
|
+
const imageUrl = ef.getNodeParameter('shopImageUrl', 0, '');
|
|
24
|
+
const videoUrl = ef.getNodeParameter('shopVideoUrl', 0, '');
|
|
25
|
+
const viewOnce = ef.getNodeParameter('shopViewOnce', 0, false);
|
|
26
|
+
const options = ef.getNodeParameter('options_message', 0, {});
|
|
27
|
+
const body_request = {
|
|
28
|
+
number: remoteJid,
|
|
29
|
+
shopId,
|
|
30
|
+
};
|
|
31
|
+
if (title)
|
|
32
|
+
body_request.title = title;
|
|
33
|
+
if (body)
|
|
34
|
+
body_request.body = body;
|
|
35
|
+
if (subtitle)
|
|
36
|
+
body_request.subtitle = subtitle;
|
|
37
|
+
if (footer)
|
|
38
|
+
body_request.footer = footer;
|
|
39
|
+
if (surface)
|
|
40
|
+
body_request.surface = surface;
|
|
41
|
+
if (imageUrl)
|
|
42
|
+
body_request.imageUrl = imageUrl;
|
|
43
|
+
if (videoUrl)
|
|
44
|
+
body_request.videoUrl = videoUrl;
|
|
45
|
+
if (viewOnce)
|
|
46
|
+
body_request.viewOnce = viewOnce;
|
|
47
|
+
if (options.delay)
|
|
48
|
+
body_request.delay = options.delay;
|
|
49
|
+
if ((_b = (_a = options.quoted) === null || _a === void 0 ? void 0 : _a.messageQuoted) === null || _b === void 0 ? void 0 : _b.messageId) {
|
|
50
|
+
body_request.quoted = {
|
|
51
|
+
key: {
|
|
52
|
+
id: options.quoted.messageQuoted.messageId,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if ((_c = options.mentions) === null || _c === void 0 ? void 0 : _c.mentionsSettings) {
|
|
57
|
+
const { mentionsEveryOne, mentioned } = options.mentions.mentionsSettings;
|
|
58
|
+
if (mentionsEveryOne) {
|
|
59
|
+
body_request.mentionsEveryOne = true;
|
|
60
|
+
}
|
|
61
|
+
else if (mentioned) {
|
|
62
|
+
body_request.mentioned = mentioned.split(',').map((m) => m.trim());
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const requestOptions = {
|
|
66
|
+
method: 'POST',
|
|
67
|
+
headers: {
|
|
68
|
+
'Content-Type': 'application/json',
|
|
69
|
+
},
|
|
70
|
+
uri: `/message/sendShop/${instanceName}`,
|
|
71
|
+
body: body_request,
|
|
72
|
+
json: true,
|
|
73
|
+
};
|
|
74
|
+
const response = await (0, evolutionRequest_1.evolutionRequest)(ef, requestOptions);
|
|
75
|
+
return {
|
|
76
|
+
json: {
|
|
77
|
+
success: true,
|
|
78
|
+
data: response,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
const errorData = {
|
|
84
|
+
success: false,
|
|
85
|
+
error: {
|
|
86
|
+
message: 'Erro ao enviar shop',
|
|
87
|
+
details: error instanceof Error ? error.message : 'Erro desconhecido',
|
|
88
|
+
timestamp: new Date().toISOString(),
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
json: errorData,
|
|
93
|
+
error: errorData,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=sendShop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendShop.js","sourceRoot":"","sources":["../../../../../nodes/EvolutionApi/execute/messages/sendShop.ts"],"names":[],"mappings":";;AAOA,4BA8GC;AAhHD,0DAAuD;AAEhD,KAAK,UAAU,QAAQ,CAAC,EAAqB;;IACnD,IAAI,CAAC;QAEJ,MAAM,YAAY,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAW,CAAC;QAGtE,MAAM,aAAa,GAAG,EAAE,CAAC,gBAAgB,CAAC,eAAe,EAAE,CAAC,EAAE,QAAQ,CAAW,CAAC;QAClF,IAAI,SAAiB,CAAC;QAEtB,IAAI,aAAa,KAAK,OAAO,EAAE,CAAC;YAC/B,SAAS,GAAG,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAW,CAAC;QAC1D,CAAC;aAAM,CAAC;YACP,SAAS,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAW,CAAC;QAC3D,CAAC;QAGD,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAW,CAAC;QAG1D,MAAM,KAAK,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,CAAW,CAAC;QAChE,MAAM,IAAI,GAAG,EAAE,CAAC,gBAAgB,CA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,SAAS,GAAG;YACjB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACN,OAAO,EAAE,qBAAqB;gBAC9B,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAmB;gBACrE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACnC;SACD,CAAC;QACF,OAAO;YACN,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,SAAS;SAChB,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare function sendStatusMentions(ef: IExecuteFunctions): Promise<{
|
|
3
|
+
json: {
|
|
4
|
+
success: boolean;
|
|
5
|
+
data: any;
|
|
6
|
+
};
|
|
7
|
+
error?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
json: {
|
|
10
|
+
success: boolean;
|
|
11
|
+
error: {
|
|
12
|
+
message: string;
|
|
13
|
+
details: string;
|
|
14
|
+
timestamp: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
error: {
|
|
18
|
+
success: boolean;
|
|
19
|
+
error: {
|
|
20
|
+
message: string;
|
|
21
|
+
details: string;
|
|
22
|
+
timestamp: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendStatusMentions = sendStatusMentions;
|
|
4
|
+
const evolutionRequest_1 = require("../evolutionRequest");
|
|
5
|
+
async function sendStatusMentions(ef) {
|
|
6
|
+
try {
|
|
7
|
+
const instanceName = ef.getNodeParameter('instanceName', 0);
|
|
8
|
+
const statusType = ef.getNodeParameter('statusType', 0);
|
|
9
|
+
const content = ef.getNodeParameter('statusContent', 0);
|
|
10
|
+
const caption = ef.getNodeParameter('statusCaption', 0, '');
|
|
11
|
+
const mentionsInput = ef.getNodeParameter('statusMentions', 0);
|
|
12
|
+
if (!mentionsInput || mentionsInput.trim() === '') {
|
|
13
|
+
const errorData = {
|
|
14
|
+
success: false,
|
|
15
|
+
error: {
|
|
16
|
+
message: 'Menções são obrigatórias',
|
|
17
|
+
details: 'É necessário fornecer pelo menos um número para mencionar no status',
|
|
18
|
+
code: 'INVALID_MENTIONS',
|
|
19
|
+
timestamp: new Date().toISOString(),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
json: errorData,
|
|
24
|
+
error: errorData,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const mentions = mentionsInput.split(',').map((m) => m.trim());
|
|
28
|
+
if (mentions.length > 5) {
|
|
29
|
+
const errorData = {
|
|
30
|
+
success: false,
|
|
31
|
+
error: {
|
|
32
|
+
message: 'Limite de menções excedido',
|
|
33
|
+
details: 'O máximo permitido é 5 menções por status',
|
|
34
|
+
code: 'TOO_MANY_MENTIONS',
|
|
35
|
+
timestamp: new Date().toISOString(),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
json: errorData,
|
|
40
|
+
error: errorData,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const font = ef.getNodeParameter('statusFont', 0, 0);
|
|
44
|
+
const textColor = ef.getNodeParameter('statusTextColor', 0, '');
|
|
45
|
+
const backgroundColor = ef.getNodeParameter('statusBackgroundColor', 0, '');
|
|
46
|
+
const body = {
|
|
47
|
+
type: statusType,
|
|
48
|
+
content,
|
|
49
|
+
mentions,
|
|
50
|
+
};
|
|
51
|
+
if (caption)
|
|
52
|
+
body.caption = caption;
|
|
53
|
+
if (statusType === 'text') {
|
|
54
|
+
if (font)
|
|
55
|
+
body.font = font;
|
|
56
|
+
if (textColor)
|
|
57
|
+
body.textColor = textColor;
|
|
58
|
+
if (backgroundColor)
|
|
59
|
+
body.backgroundColor = backgroundColor;
|
|
60
|
+
}
|
|
61
|
+
const requestOptions = {
|
|
62
|
+
method: 'POST',
|
|
63
|
+
headers: {
|
|
64
|
+
'Content-Type': 'application/json',
|
|
65
|
+
},
|
|
66
|
+
uri: `/message/sendStatusMentions/${instanceName}`,
|
|
67
|
+
body,
|
|
68
|
+
json: true,
|
|
69
|
+
};
|
|
70
|
+
const response = await (0, evolutionRequest_1.evolutionRequest)(ef, requestOptions);
|
|
71
|
+
return {
|
|
72
|
+
json: {
|
|
73
|
+
success: true,
|
|
74
|
+
data: response,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
const errorData = {
|
|
80
|
+
success: false,
|
|
81
|
+
error: {
|
|
82
|
+
message: 'Erro ao enviar status com menções',
|
|
83
|
+
details: error instanceof Error ? error.message : 'Erro desconhecido',
|
|
84
|
+
timestamp: new Date().toISOString(),
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
json: errorData,
|
|
89
|
+
error: errorData,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=sendStatusMentions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendStatusMentions.js","sourceRoot":"","sources":["../../../../../nodes/EvolutionApi/execute/messages/sendStatusMentions.ts"],"names":[],"mappings":";;AAOA,gDAsGC;AAxGD,0DAAuD;AAEhD,KAAK,UAAU,kBAAkB,CAAC,EAAqB;IAC7D,IAAI,CAAC;QAEJ,MAAM,YAAY,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAW,CAAC;QAGtE,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAyC,CAAC;QAChG,MAAM,OAAO,GAAG,EAAE,CAAC,gBAAgB,CAAC,eAAe,EAAE,CAAC,CAAW,CAAC;QAClE,MAAM,OAAO,GAAG,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;AACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare function sendStickerPack(ef: IExecuteFunctions): Promise<{
|
|
3
|
+
json: {
|
|
4
|
+
success: boolean;
|
|
5
|
+
data: any;
|
|
6
|
+
};
|
|
7
|
+
error?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
json: {
|
|
10
|
+
success: boolean;
|
|
11
|
+
error: {
|
|
12
|
+
message: string;
|
|
13
|
+
details: string;
|
|
14
|
+
timestamp: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
error: {
|
|
18
|
+
success: boolean;
|
|
19
|
+
error: {
|
|
20
|
+
message: string;
|
|
21
|
+
details: string;
|
|
22
|
+
timestamp: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendStickerPack = sendStickerPack;
|
|
4
|
+
const evolutionRequest_1 = require("../evolutionRequest");
|
|
5
|
+
async function sendStickerPack(ef) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
try {
|
|
8
|
+
const instanceName = ef.getNodeParameter('instanceName', 0);
|
|
9
|
+
const recipientType = ef.getNodeParameter('recipientType', 0, 'number');
|
|
10
|
+
let remoteJid;
|
|
11
|
+
if (recipientType === 'group') {
|
|
12
|
+
remoteJid = ef.getNodeParameter('groupJid', 0);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
remoteJid = ef.getNodeParameter('remoteJid', 0);
|
|
16
|
+
}
|
|
17
|
+
const name = ef.getNodeParameter('packName', 0);
|
|
18
|
+
const publisher = ef.getNodeParameter('packPublisher', 0);
|
|
19
|
+
const description = ef.getNodeParameter('packDescription', 0, '');
|
|
20
|
+
const cover = ef.getNodeParameter('packCover', 0, '');
|
|
21
|
+
const stickersInput = ef.getNodeParameter('packStickers.stickerValues', 0, []);
|
|
22
|
+
if (!Array.isArray(stickersInput) || stickersInput.length === 0) {
|
|
23
|
+
const errorData = {
|
|
24
|
+
success: false,
|
|
25
|
+
error: {
|
|
26
|
+
message: 'Lista de stickers inválida',
|
|
27
|
+
details: 'É necessário fornecer pelo menos um sticker para o pack',
|
|
28
|
+
code: 'INVALID_STICKERS',
|
|
29
|
+
timestamp: new Date().toISOString(),
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
json: errorData,
|
|
34
|
+
error: errorData,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const options = ef.getNodeParameter('options_message', 0, {});
|
|
38
|
+
const stickers = stickersInput.map(s => s.stickerUrl);
|
|
39
|
+
const body = {
|
|
40
|
+
number: remoteJid,
|
|
41
|
+
name,
|
|
42
|
+
publisher,
|
|
43
|
+
stickers,
|
|
44
|
+
};
|
|
45
|
+
if (description)
|
|
46
|
+
body.description = description;
|
|
47
|
+
if (cover)
|
|
48
|
+
body.cover = cover;
|
|
49
|
+
if (options.delay)
|
|
50
|
+
body.delay = options.delay;
|
|
51
|
+
if ((_b = (_a = options.quoted) === null || _a === void 0 ? void 0 : _a.messageQuoted) === null || _b === void 0 ? void 0 : _b.messageId) {
|
|
52
|
+
body.quoted = {
|
|
53
|
+
key: {
|
|
54
|
+
id: options.quoted.messageQuoted.messageId,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const requestOptions = {
|
|
59
|
+
method: 'POST',
|
|
60
|
+
headers: {
|
|
61
|
+
'Content-Type': 'application/json',
|
|
62
|
+
},
|
|
63
|
+
uri: `/message/sendStickerPack/${instanceName}`,
|
|
64
|
+
body,
|
|
65
|
+
json: true,
|
|
66
|
+
};
|
|
67
|
+
const response = await (0, evolutionRequest_1.evolutionRequest)(ef, requestOptions);
|
|
68
|
+
return {
|
|
69
|
+
json: {
|
|
70
|
+
success: true,
|
|
71
|
+
data: response,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
const errorData = {
|
|
77
|
+
success: false,
|
|
78
|
+
error: {
|
|
79
|
+
message: 'Erro ao enviar sticker pack',
|
|
80
|
+
details: error instanceof Error ? error.message : 'Erro desconhecido',
|
|
81
|
+
timestamp: new Date().toISOString(),
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
json: errorData,
|
|
86
|
+
error: errorData,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=sendStickerPack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendStickerPack.js","sourceRoot":"","sources":["../../../../../nodes/EvolutionApi/execute/messages/sendStickerPack.ts"],"names":[],"mappings":";;AAOA,0CA6GC;AA/GD,0DAAuD;AAEhD,KAAK,UAAU,eAAe,CAAC,EAAqB;;IAC1D,IAAI,CAAC;QAEJ,MAAM,YAAY,GAAG,EAAE,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAW,CAAC;QAGtE,MAAM,aAAa,GAAG,EAAE,CAAC,gBAAgB,CAAC,eAAe,EAAE,CAAC,EAAE,QAAQ,CAAW,CAAC;QAClF,IAAI,SAAiB,CAAC;QAEtB,IAAI,aAAa,KAAK,OAAO,EAAE,CAAC;YAC/B,SAAS,GAAG,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAW,CAAC;QAC1D,CAAC;aAAM,CAAC;YACP,SAAS,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAW,CAAC;QAC3D,CAAC;QAGD,MAAM,IAAI,GAAG,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAW,CAAC;QAC1D,MAAM,SAAS,GAAG,EAAE,CAAC,gBAAgB,CAAC,eAAe,EAAE,CAAC,CAAW,CAAC;QACpE,MAAM,WA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