@fidusia/question-engine-dynamic 1.0.9 → 1.0.10
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/config-loader.d.ts +6 -3
- package/dist/config-loader.d.ts.map +1 -1
- package/dist/config-loader.js +98 -23
- package/dist/engine.d.ts +2 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +6 -3
- package/dist/types.d.ts +35 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/config-loader.d.ts
CHANGED
|
@@ -66,7 +66,8 @@ export interface ChatbotConfig {
|
|
|
66
66
|
}>;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
* Obtient les IDs système
|
|
69
|
+
* Obtient les IDs système depuis la configuration
|
|
70
|
+
* ⚠️ AUCUN FALLBACK - Les IDs système doivent être chargés depuis la base de données
|
|
70
71
|
*/
|
|
71
72
|
export declare function getSystemIds(config: ChatbotConfig): {
|
|
72
73
|
budgetPriorityQuestionId: string;
|
|
@@ -108,14 +109,16 @@ export declare function getPriorityBoosts(config: ChatbotConfig): Record<string,
|
|
|
108
109
|
*/
|
|
109
110
|
export declare function getPriorityToBookedProviders(config: ChatbotConfig): Record<string, string[]>;
|
|
110
111
|
/**
|
|
111
|
-
* Obtient la configuration du calcul de priorité
|
|
112
|
+
* Obtient la configuration du calcul de priorité depuis la configuration
|
|
113
|
+
* ⚠️ AUCUN FALLBACK - La configuration doit être chargée depuis la base de données
|
|
112
114
|
*/
|
|
113
115
|
export declare function getPriorityCalculation(config: ChatbotConfig): {
|
|
114
116
|
base: number;
|
|
115
117
|
step: number;
|
|
116
118
|
};
|
|
117
119
|
/**
|
|
118
|
-
* Obtient les comportements spéciaux
|
|
120
|
+
* Obtient les comportements spéciaux depuis la configuration
|
|
121
|
+
* ⚠️ AUCUN FALLBACK - La configuration doit être chargée depuis la base de données
|
|
119
122
|
*/
|
|
120
123
|
export declare function getSpecialBehaviors(config: Chatbot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C,CAAC,CAKnH;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAK5F;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa;;;EAc3D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa;;;;;;;;;;;;;;;;;;EAmExD"}
|
package/dist/config-loader.js
CHANGED
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
// ⚠️ SUPPRIMÉ : Imports des constantes hardcodées
|
|
2
2
|
// Toutes les configurations doivent venir de la base de données via ChatbotConfig
|
|
3
3
|
/**
|
|
4
|
-
* Obtient les IDs système
|
|
4
|
+
* Obtient les IDs système depuis la configuration
|
|
5
|
+
* ⚠️ AUCUN FALLBACK - Les IDs système doivent être chargés depuis la base de données
|
|
5
6
|
*/
|
|
6
7
|
export function getSystemIds(config) {
|
|
7
|
-
|
|
8
|
+
if (!config.systemIds) {
|
|
9
|
+
throw new Error('systemIds is required in ChatbotConfig. Configuration must be loaded from database via loadChatbotConfig().');
|
|
10
|
+
}
|
|
11
|
+
// ⚠️ Tous les IDs système doivent être présents - pas de fallback
|
|
12
|
+
if (!config.systemIds.budgetPriorityQuestionId) {
|
|
13
|
+
throw new Error('systemIds.budgetPriorityQuestionId is required in ChatbotConfig.');
|
|
14
|
+
}
|
|
15
|
+
if (!config.systemIds.contactCorrectionQuestionId) {
|
|
16
|
+
throw new Error('systemIds.contactCorrectionQuestionId is required in ChatbotConfig.');
|
|
17
|
+
}
|
|
18
|
+
if (!config.systemIds.continueOtherSectorsQuestionId) {
|
|
19
|
+
throw new Error('systemIds.continueOtherSectorsQuestionId is required in ChatbotConfig.');
|
|
20
|
+
}
|
|
21
|
+
if (!config.systemIds.finalModuleId) {
|
|
22
|
+
throw new Error('systemIds.finalModuleId is required in ChatbotConfig.');
|
|
23
|
+
}
|
|
24
|
+
if (!config.systemIds.introModuleId) {
|
|
25
|
+
throw new Error('systemIds.introModuleId is required in ChatbotConfig.');
|
|
26
|
+
}
|
|
27
|
+
if (!config.systemIds.continueOtherSectorsModuleId) {
|
|
28
|
+
throw new Error('systemIds.continueOtherSectorsModuleId is required in ChatbotConfig.');
|
|
29
|
+
}
|
|
8
30
|
return {
|
|
9
|
-
budgetPriorityQuestionId:
|
|
10
|
-
contactCorrectionQuestionId:
|
|
11
|
-
continueOtherSectorsQuestionId:
|
|
12
|
-
finalModuleId:
|
|
13
|
-
introModuleId:
|
|
14
|
-
continueOtherSectorsModuleId:
|
|
31
|
+
budgetPriorityQuestionId: config.systemIds.budgetPriorityQuestionId,
|
|
32
|
+
contactCorrectionQuestionId: config.systemIds.contactCorrectionQuestionId,
|
|
33
|
+
continueOtherSectorsQuestionId: config.systemIds.continueOtherSectorsQuestionId,
|
|
34
|
+
finalModuleId: config.systemIds.finalModuleId,
|
|
35
|
+
introModuleId: config.systemIds.introModuleId,
|
|
36
|
+
continueOtherSectorsModuleId: config.systemIds.continueOtherSectorsModuleId,
|
|
15
37
|
};
|
|
16
38
|
}
|
|
17
39
|
/**
|
|
@@ -65,37 +87,90 @@ export function getPriorityToBookedProviders(config) {
|
|
|
65
87
|
return config.priorityToBookedProviders;
|
|
66
88
|
}
|
|
67
89
|
/**
|
|
68
|
-
* Obtient la configuration du calcul de priorité
|
|
90
|
+
* Obtient la configuration du calcul de priorité depuis la configuration
|
|
91
|
+
* ⚠️ AUCUN FALLBACK - La configuration doit être chargée depuis la base de données
|
|
69
92
|
*/
|
|
70
93
|
export function getPriorityCalculation(config) {
|
|
71
|
-
|
|
94
|
+
if (!config.priorityCalculation) {
|
|
95
|
+
throw new Error('priorityCalculation is required in ChatbotConfig. Configuration must be loaded from database via loadChatbotConfig().');
|
|
96
|
+
}
|
|
97
|
+
if (config.priorityCalculation.base === undefined) {
|
|
98
|
+
throw new Error('priorityCalculation.base is required in ChatbotConfig.');
|
|
99
|
+
}
|
|
100
|
+
if (config.priorityCalculation.step === undefined) {
|
|
101
|
+
throw new Error('priorityCalculation.step is required in ChatbotConfig.');
|
|
102
|
+
}
|
|
72
103
|
return {
|
|
73
|
-
base:
|
|
74
|
-
step:
|
|
104
|
+
base: config.priorityCalculation.base,
|
|
105
|
+
step: config.priorityCalculation.step,
|
|
75
106
|
};
|
|
76
107
|
}
|
|
77
108
|
/**
|
|
78
|
-
* Obtient les comportements spéciaux
|
|
109
|
+
* Obtient les comportements spéciaux depuis la configuration
|
|
110
|
+
* ⚠️ AUCUN FALLBACK - La configuration doit être chargée depuis la base de données
|
|
79
111
|
*/
|
|
80
112
|
export function getSpecialBehaviors(config) {
|
|
81
|
-
|
|
113
|
+
if (!config.specialBehaviors) {
|
|
114
|
+
throw new Error('specialBehaviors is required in ChatbotConfig. Configuration must be loaded from database via loadChatbotConfig().');
|
|
115
|
+
}
|
|
116
|
+
// ⚠️ Tous les comportements doivent être présents - pas de fallback
|
|
117
|
+
if (config.specialBehaviors.budgetPriority === undefined) {
|
|
118
|
+
throw new Error('specialBehaviors.budgetPriority is required in ChatbotConfig.');
|
|
119
|
+
}
|
|
120
|
+
if (config.specialBehaviors.contactCorrection === undefined) {
|
|
121
|
+
throw new Error('specialBehaviors.contactCorrection is required in ChatbotConfig.');
|
|
122
|
+
}
|
|
123
|
+
if (config.specialBehaviors.continueOtherSectors === undefined) {
|
|
124
|
+
throw new Error('specialBehaviors.continueOtherSectors is required in ChatbotConfig.');
|
|
125
|
+
}
|
|
126
|
+
if (config.specialBehaviors.transitions === undefined) {
|
|
127
|
+
throw new Error('specialBehaviors.transitions is required in ChatbotConfig.');
|
|
128
|
+
}
|
|
129
|
+
// Vérifier que les propriétés requises sont présentes
|
|
130
|
+
if (config.specialBehaviors.budgetPriority.enabled === undefined) {
|
|
131
|
+
throw new Error('specialBehaviors.budgetPriority.enabled is required in ChatbotConfig.');
|
|
132
|
+
}
|
|
133
|
+
if (config.specialBehaviors.budgetPriority.filterOptionsByBookedProviders === undefined) {
|
|
134
|
+
throw new Error('specialBehaviors.budgetPriority.filterOptionsByBookedProviders is required in ChatbotConfig.');
|
|
135
|
+
}
|
|
136
|
+
if (config.specialBehaviors.contactCorrection.enabled === undefined) {
|
|
137
|
+
throw new Error('specialBehaviors.contactCorrection.enabled is required in ChatbotConfig.');
|
|
138
|
+
}
|
|
139
|
+
if (config.specialBehaviors.contactCorrection.detectEmailFrom === undefined) {
|
|
140
|
+
throw new Error('specialBehaviors.contactCorrection.detectEmailFrom is required in ChatbotConfig.');
|
|
141
|
+
}
|
|
142
|
+
if (config.specialBehaviors.continueOtherSectors.enabled === undefined) {
|
|
143
|
+
throw new Error('specialBehaviors.continueOtherSectors.enabled is required in ChatbotConfig.');
|
|
144
|
+
}
|
|
145
|
+
if (config.specialBehaviors.continueOtherSectors.skipToFinalOnNo === undefined) {
|
|
146
|
+
throw new Error('specialBehaviors.continueOtherSectors.skipToFinalOnNo is required in ChatbotConfig.');
|
|
147
|
+
}
|
|
148
|
+
if (config.specialBehaviors.continueOtherSectors.skipModulesWithPriority === undefined) {
|
|
149
|
+
throw new Error('specialBehaviors.continueOtherSectors.skipModulesWithPriority is required in ChatbotConfig.');
|
|
150
|
+
}
|
|
151
|
+
if (config.specialBehaviors.continueOtherSectors.insertBetweenPriorityAndNonPriority === undefined) {
|
|
152
|
+
throw new Error('specialBehaviors.continueOtherSectors.insertBetweenPriorityAndNonPriority is required in ChatbotConfig.');
|
|
153
|
+
}
|
|
154
|
+
if (config.specialBehaviors.transitions.excludeModules === undefined) {
|
|
155
|
+
throw new Error('specialBehaviors.transitions.excludeModules is required in ChatbotConfig.');
|
|
156
|
+
}
|
|
82
157
|
return {
|
|
83
158
|
budgetPriority: {
|
|
84
|
-
enabled:
|
|
85
|
-
filterOptionsByBookedProviders:
|
|
159
|
+
enabled: config.specialBehaviors.budgetPriority.enabled,
|
|
160
|
+
filterOptionsByBookedProviders: config.specialBehaviors.budgetPriority.filterOptionsByBookedProviders,
|
|
86
161
|
},
|
|
87
162
|
contactCorrection: {
|
|
88
|
-
enabled:
|
|
89
|
-
detectEmailFrom:
|
|
163
|
+
enabled: config.specialBehaviors.contactCorrection.enabled,
|
|
164
|
+
detectEmailFrom: config.specialBehaviors.contactCorrection.detectEmailFrom,
|
|
90
165
|
},
|
|
91
166
|
continueOtherSectors: {
|
|
92
|
-
enabled:
|
|
93
|
-
skipToFinalOnNo:
|
|
94
|
-
skipModulesWithPriority:
|
|
95
|
-
insertBetweenPriorityAndNonPriority:
|
|
167
|
+
enabled: config.specialBehaviors.continueOtherSectors.enabled,
|
|
168
|
+
skipToFinalOnNo: config.specialBehaviors.continueOtherSectors.skipToFinalOnNo,
|
|
169
|
+
skipModulesWithPriority: config.specialBehaviors.continueOtherSectors.skipModulesWithPriority,
|
|
170
|
+
insertBetweenPriorityAndNonPriority: config.specialBehaviors.continueOtherSectors.insertBetweenPriorityAndNonPriority,
|
|
96
171
|
},
|
|
97
172
|
transitions: {
|
|
98
|
-
excludeModules:
|
|
173
|
+
excludeModules: config.specialBehaviors.transitions.excludeModules,
|
|
99
174
|
},
|
|
100
175
|
};
|
|
101
176
|
}
|
package/dist/engine.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { QuestionModule, ModuleQuestion, QueueState, AnsweredQuestion,
|
|
1
|
+
import type { QuestionModule, ModuleQuestion, QueueState, AnsweredQuestion, I18nFunctions } from "./types";
|
|
2
2
|
import type { ChatbotConfig } from './config-loader';
|
|
3
3
|
import type { EngineType, EngineConfig } from './engine-types';
|
|
4
4
|
export declare class QuestionEngine {
|
|
@@ -77,7 +77,7 @@ export declare class QuestionEngine {
|
|
|
77
77
|
private executeQuestionTriggers;
|
|
78
78
|
private evaluateQuestionTrigger;
|
|
79
79
|
private executeAction;
|
|
80
|
-
applyUserPriority(priority:
|
|
80
|
+
applyUserPriority(priority: string): void;
|
|
81
81
|
private recalculateQueue;
|
|
82
82
|
getState(): QueueState;
|
|
83
83
|
getFormData(): Record<string, any>;
|
package/dist/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,UAAU,EAGV,gBAAgB,
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,UAAU,EAGV,gBAAgB,EAKhB,aAAa,EACd,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AA8C9D,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAyC;IACxD,OAAO,CAAC,KAAK,CAAY;IACzB,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,iBAAiB,CAAiB;IAC1C,OAAO,CAAC,gBAAgB,CAAuC;IAC/D,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,UAAU,CAAyB;gBAE/B,IAAI,EAAE,aAAa;IAK/B;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAIjD;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI;IAQ5D;;OAEG;IACH,aAAa,IAAI,UAAU;IAI3B;;OAEG;IACH,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,kBAAkB;IAe1B,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAI5C,eAAe,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI;IAIhD;;;OAGG;IACH,SAA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AAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAclE,oBAAoB,IAAI,MAAM;IAK9B,UAAU,IAAI,OAAO;IAQrB,OAAO,CAAC,kBAAkB;IA0C1B,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI;IAK5D,OAAO,CAAC,eAAe;CAIxB;AAKD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,cAAc,CAKrE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,aAAa,GAAG,cAAc,CAGvE"}
|
package/dist/engine.js
CHANGED
|
@@ -552,9 +552,12 @@ export class QuestionEngine {
|
|
|
552
552
|
// (Uniquement pour le moteur avancé)
|
|
553
553
|
if (!this.isSimpleEngine() && question.id === systemIds.budgetPriorityQuestionId && behaviors.budgetPriority.enabled) {
|
|
554
554
|
// Les options du module sont maintenant des clés i18n (ex: "intro_options.budget_priority_venue")
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
555
|
+
// ⚠️ PAS DE FALLBACK - Les options doivent être chargées depuis la DB
|
|
556
|
+
// Si question.options est vide, c'est une erreur de configuration
|
|
557
|
+
if (!question.options || question.options.length === 0) {
|
|
558
|
+
console.error(`[QuestionEngine] Question ${question.id} has no options - options must be loaded from database`);
|
|
559
|
+
}
|
|
560
|
+
const loadedOptions = question.options || [];
|
|
558
561
|
// Traduire les options pour le filtrage
|
|
559
562
|
const translatedOptions = loadedOptions.map(opt => {
|
|
560
563
|
if (opt.includes('.') && !opt.includes(' ')) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export type QuestionType = "text" | "email" | "phone" | "number" | "date" | "select" | "multiselect" | "yesno" | "priority_order" | "info";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* ⚠️ SUPPRIMÉ : ModuleCategory type hardcodé
|
|
4
|
+
*
|
|
5
|
+
* Les catégories sont maintenant chargées dynamiquement depuis la base de données
|
|
6
|
+
* via l'enum PostgreSQL `module_category`. Utiliser `string` directement.
|
|
7
|
+
*/
|
|
8
|
+
export type ModuleCategory = string;
|
|
3
9
|
export interface ModuleQuestion {
|
|
4
10
|
id: string;
|
|
5
11
|
text: string;
|
|
@@ -107,7 +113,25 @@ export interface AnsweredQuestion {
|
|
|
107
113
|
answer: string | string[] | number | boolean;
|
|
108
114
|
answeredAt: Date;
|
|
109
115
|
}
|
|
110
|
-
|
|
116
|
+
/**
|
|
117
|
+
* ⚠️ SUPPRIMÉ : UserPriority type hardcodé
|
|
118
|
+
*
|
|
119
|
+
* Ce type contenait des valeurs hardcodées spécifiques à "wedding-planner" :
|
|
120
|
+
* - "Le lieu de réception"
|
|
121
|
+
* - "La gastronomie et le repas"
|
|
122
|
+
* - "La robe de mariée"
|
|
123
|
+
* - etc.
|
|
124
|
+
*
|
|
125
|
+
* Ces valeurs ne fonctionnent que pour "wedding-planner" et ne sont pas scalables
|
|
126
|
+
* pour d'autres types de chatbots (ex: "digital" a des priorités différentes).
|
|
127
|
+
*
|
|
128
|
+
* Les priorités sont maintenant chargées dynamiquement depuis la base de données
|
|
129
|
+
* via `priorityMappings` dans `ChatbotConfig`. Les clés sont des strings arbitraires
|
|
130
|
+
* définies en DB pour chaque type de chatbot.
|
|
131
|
+
*
|
|
132
|
+
* Utiliser `string` directement pour les priorités utilisateur.
|
|
133
|
+
*/
|
|
134
|
+
export type UserPriority = string;
|
|
111
135
|
export interface PriorityBoost {
|
|
112
136
|
moduleId: string;
|
|
113
137
|
boost: number;
|
|
@@ -126,10 +150,16 @@ export interface I18nFunctions {
|
|
|
126
150
|
*/
|
|
127
151
|
t: (key: string, params?: Record<string, any>, lang?: string) => string;
|
|
128
152
|
/**
|
|
129
|
-
*
|
|
153
|
+
* ⚠️ DÉPRÉCIÉ : getQuestionOptions()
|
|
154
|
+
*
|
|
155
|
+
* Cette fonction ne devrait plus être utilisée. Les options doivent être chargées
|
|
156
|
+
* depuis la base de données et passées directement dans question.options.
|
|
157
|
+
*
|
|
158
|
+
* Conservée uniquement pour compatibilité avec le code existant, mais retourne toujours [].
|
|
159
|
+
*
|
|
130
160
|
* @param questionId - ID de la question
|
|
131
|
-
* @param lang - Langue optionnelle (
|
|
132
|
-
* @returns Tableau
|
|
161
|
+
* @param lang - Langue optionnelle (ignorée)
|
|
162
|
+
* @returns Tableau vide (les options doivent être en DB)
|
|
133
163
|
*/
|
|
134
164
|
getQuestionOptions: (questionId: string, lang?: string) => string[];
|
|
135
165
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,aAAa,GACb,OAAO,GACP,gBAAgB,GAChB,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,aAAa,GACb,OAAO,GACP,gBAAgB,GAChB,MAAM,CAAA;AAEV;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAMpC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,YAAY,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IAGZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAE5B,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,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