@memberjunction/ng-composer 0.0.0 → 5.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/README.md +81 -28
  2. package/dist/lib/components/mention/mention-dropdown.component.d.ts +53 -0
  3. package/dist/lib/components/mention/mention-dropdown.component.d.ts.map +1 -0
  4. package/dist/lib/components/mention/mention-dropdown.component.js +297 -0
  5. package/dist/lib/components/mention/mention-dropdown.component.js.map +1 -0
  6. package/dist/lib/components/mention/mention-editor.component.d.ts +294 -0
  7. package/dist/lib/components/mention/mention-editor.component.d.ts.map +1 -0
  8. package/dist/lib/components/mention/mention-editor.component.js +1342 -0
  9. package/dist/lib/components/mention/mention-editor.component.js.map +1 -0
  10. package/dist/lib/components/message/message-input-box.component.d.ts +139 -0
  11. package/dist/lib/components/message/message-input-box.component.d.ts.map +1 -0
  12. package/dist/lib/components/message/message-input-box.component.js +340 -0
  13. package/dist/lib/components/message/message-input-box.component.js.map +1 -0
  14. package/dist/lib/composer-trigger-provider.d.ts +123 -0
  15. package/dist/lib/composer-trigger-provider.d.ts.map +1 -0
  16. package/dist/lib/composer-trigger-provider.js +91 -0
  17. package/dist/lib/composer-trigger-provider.js.map +1 -0
  18. package/dist/lib/composer.module.d.ts +32 -0
  19. package/dist/lib/composer.module.d.ts.map +1 -0
  20. package/dist/lib/composer.module.js +62 -0
  21. package/dist/lib/composer.module.js.map +1 -0
  22. package/dist/public-api.d.ts +6 -0
  23. package/dist/public-api.d.ts.map +1 -0
  24. package/dist/public-api.js +15 -0
  25. package/dist/public-api.js.map +1 -0
  26. package/package.json +37 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mention-dropdown.component.js","sourceRoot":"","sources":["../../../../src/lib/components/mention/mention-dropdown.component.ts","../../../../src/lib/components/mention/mention-dropdown.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EAGZ,YA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EAAE,QAAQ,EAAE,CAAC,CAAC;YACpE,CAAC;QACH,CAAC,EAAE,CAAC,CAAC,CAAC;IACR,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,KAAa,EAAE,IAAuB;QACtD,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,SAAiB;QAC9B,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,mBAAmB,CAAC,CAAC,mBAAmB;QACjD,CAAC;QAED,4EAA4E;QAC5E,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,0DAA0D;YAC1D,IAAI,SAAS,CAAC,KAAK,CAAC,8CAA8C,CAAC,EAAE,CAAC;gBACpE,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,gCAAgC;YAChC,OAAO,YAAY,SAAS,EAAE,CAAC;QACjC,CAAC;QAED,6DAA6D;QAC7D,OAAO,SAAS,CAAC;IACnB,CAAC;kHArHU,wBAAwB;6DAAxB,wBAAwB;YAAxB,uGAAA,yBAAqB,0BAAG;;YCvBrC,2FAAe;;YAAf,sCAmGC;;;iFD5EY,wBAAwB;cATpC,SAAS;6BACI,KAAK,YACP,qBAAqB;;kBAU9B,KAAK;;kBAWL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kBACN,MAAM;;kBAaN,YAAY;mBAAC,kBAAkB,EAAE,CAAC,QAAQ,CAAC;;kFAjCjC,wBAAwB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n OnInit,\n OnDestroy,\n HostListener\n} from '@angular/core';\nimport { MentionSuggestion } from '../../composer-trigger-provider';\n\n/**\n * Dropdown component for @mention autocomplete\n */\n@Component({\n standalone: false,\n selector: 'mj-mention-dropdown',\n templateUrl: './mention-dropdown.component.html',\n styleUrls: [\n './mention-dropdown.component.css',\n './custom-agent-icons.css'\n ]\n})\nexport class MentionDropdownComponent implements OnInit, OnDestroy {\n private _suggestions: MentionSuggestion[] = [];\n\n @Input()\n set suggestions(value: MentionSuggestion[]) {\n this._suggestions = value;\n // Always reset selection to first item when suggestions change\n // so there's never a state where nothing is selected\n this.selectedIndex = 0;\n }\n get suggestions(): MentionSuggestion[] {\n return this._suggestions;\n }\n\n @Input() position: { top: number; left: number } = { top: 0, left: 0 };\n @Input() visible: boolean = false;\n @Input() showAbove: boolean = false; // Controls whether dropdown grows upward\n @Input() useFixedPositioning: boolean = false; // Use fixed positioning to escape parent containers\n\n @Output() suggestionSelected = new EventEmitter<MentionSuggestion>();\n @Output() closed = new EventEmitter<void>();\n\n public selectedIndex: number = 0;\n\n constructor() {}\n\n ngOnInit(): void {}\n\n ngOnDestroy(): void {}\n\n /**\n * Handle keyboard navigation\n */\n @HostListener('document:keydown', ['$event'])\n handleKeyDown(event: KeyboardEvent): void {\n if (!this.visible || this.suggestions.length === 0) return;\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n this.selectedIndex = Math.min(this.selectedIndex + 1, this.suggestions.length - 1);\n this.scrollToSelected();\n break;\n case 'ArrowUp':\n event.preventDefault();\n this.selectedIndex = Math.max(this.selectedIndex - 1, 0);\n this.scrollToSelected();\n break;\n case 'Enter':\n case 'Tab':\n event.preventDefault();\n if (this.suggestions[this.selectedIndex]) {\n this.selectSuggestion(this.suggestions[this.selectedIndex]);\n }\n break;\n case 'Escape':\n event.preventDefault();\n this.close();\n break;\n }\n }\n\n /**\n * Select a suggestion\n */\n selectSuggestion(suggestion: MentionSuggestion): void {\n this.suggestionSelected.emit(suggestion);\n }\n\n /**\n * Close the dropdown\n */\n close(): void {\n this.closed.emit();\n }\n\n /**\n * Scroll to selected item\n */\n private scrollToSelected(): void {\n setTimeout(() => {\n const selected = document.querySelector('.mention-suggestion.selected');\n if (selected) {\n selected.scrollIntoView({ block: 'nearest', behavior: 'smooth' });\n }\n }, 0);\n }\n\n /**\n * Track by function for ngFor\n */\n trackBySuggestion(index: number, item: MentionSuggestion): string {\n return item.id;\n }\n\n /**\n * Get icon classes - supports both Font Awesome and custom CSS classes\n * Font Awesome icons start with 'fa-' (e.g., 'fa-solid fa-robot')\n * Custom icons use their own prefix (e.g., 'mj-icon-skip', 'acme-icon-custom')\n */\n getIconClasses(iconClass: string): string | string[] {\n if (!iconClass) {\n return 'fa-solid fa-robot'; // Default fallback\n }\n\n // If it's a Font Awesome icon (contains 'fa-'), add fa-solid if not present\n if (iconClass.includes('fa-')) {\n // If it already has fa-solid, fa-regular, etc., use as-is\n if (iconClass.match(/\\b(fa-solid|fa-regular|fa-light|fa-brands)\\b/)) {\n return iconClass;\n }\n // Otherwise add fa-solid prefix\n return `fa-solid ${iconClass}`;\n }\n\n // For custom icons (mj-icon-*, acme-icon-*, etc.), use as-is\n return iconClass;\n }\n}\n","@if (visible) {\n <div\n class=\"mention-dropdown\"\n [class.show-above]=\"showAbove\"\n [class.fixed-position]=\"useFixedPositioning\"\n [style.top.px]=\"position.top\"\n [style.left.px]=\"position.left\"\n >\n <!-- Suggestions List -->\n @if (suggestions.length > 0) {\n <div class=\"mention-suggestions\">\n @for (suggestion of suggestions; track trackBySuggestion(i, suggestion); let i = $index) {\n <div\n class=\"mention-suggestion\"\n [class.selected]=\"i === selectedIndex\"\n (mousedown)=\"selectSuggestion(suggestion); $event.preventDefault()\"\n (mouseenter)=\"selectedIndex = i\"\n >\n <div class=\"suggestion-icon\"\n [class.skill]=\"suggestion.type === 'skill'\"\n [style.background]=\"suggestion.type === 'skill' ? (suggestion.color || null) : null\">\n <!-- Agent with LogoURL image (takes precedence) -->\n @if (suggestion.type === 'agent' && suggestion.imageUrl) {\n <img\n [src]=\"suggestion.imageUrl\"\n [alt]=\"suggestion.displayName\"\n class=\"suggestion-image\"\n />\n }\n <!-- Agent with icon class (fallback) -->\n @if (suggestion.type === 'agent' && !suggestion.imageUrl && suggestion.icon) {\n <i\n [ngClass]=\"getIconClasses(suggestion.icon)\"\n ></i>\n }\n <!-- User icon -->\n @if (suggestion.type === 'user') {\n <i\n class=\"fa-solid fa-user\"\n ></i>\n }\n <!-- Entity icon -->\n @if (suggestion.type === 'entity') {\n <i\n [ngClass]=\"getIconClasses(suggestion.icon || 'fa-solid fa-table')\"\n ></i>\n }\n <!-- Query icon (generic, from 'MJ: Queries' entity) -->\n @if (suggestion.type === 'query') {\n <i\n [ngClass]=\"getIconClasses(suggestion.icon || 'fa-solid fa-database')\"\n ></i>\n }\n <!-- Skill icon — container carries the skill's accent Color (green fallback) -->\n @if (suggestion.type === 'skill') {\n <i\n [ngClass]=\"getIconClasses(suggestion.icon || 'fa-solid fa-wand-magic-sparkles')\"\n ></i>\n }\n </div>\n <div class=\"suggestion-content\">\n <div class=\"suggestion-name\">\n @if (suggestion.type === 'agent') {\n <span class=\"suggestion-type-badge\">Agent</span>\n }\n @if (suggestion.type === 'user') {\n <span class=\"suggestion-type-badge user\">User</span>\n }\n @if (suggestion.type === 'entity') {\n <span class=\"suggestion-type-badge entity\">Entity</span>\n }\n @if (suggestion.type === 'query') {\n <span class=\"suggestion-type-badge query\">Query</span>\n }\n @if (suggestion.type === 'skill') {\n <span class=\"suggestion-type-badge skill\"\n [style.background]=\"suggestion.color || null\">Skill</span>\n }\n {{ suggestion.displayName }}\n </div>\n @if (suggestion.description) {\n <div class=\"suggestion-description\">\n {{ suggestion.description }}\n </div>\n }\n </div>\n </div>\n }\n </div>\n }\n <!-- Empty State -->\n @if (suggestions.length === 0) {\n <mj-empty-state\n Variant=\"no-results\"\n Size=\"compact\"\n Icon=\"fa-solid fa-robot\"\n Title=\"No matches found\" />\n }\n </div>\n}\n"]}
@@ -0,0 +1,294 @@
1
+ import { EventEmitter, ElementRef, AfterViewInit, OnInit, ChangeDetectorRef } from '@angular/core';
2
+ import { ControlValueAccessor } from '@angular/forms';
3
+ import { ComposerTriggerProvider, MentionSuggestion } from '../../composer-trigger-provider';
4
+ import { IMetadataProvider, UserInfo } from '@memberjunction/core';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Represents a pending attachment that hasn't been uploaded yet
8
+ */
9
+ export interface PendingAttachment {
10
+ /** Local ID for tracking */
11
+ id: string;
12
+ /** Original File object (null for artifact references) */
13
+ file: File | null;
14
+ /** Base64 data URL for display */
15
+ dataUrl: string;
16
+ /** MIME type */
17
+ mimeType: string;
18
+ /** Original filename */
19
+ fileName: string;
20
+ /** File size in bytes */
21
+ sizeBytes: number;
22
+ /** Width in pixels (for images) */
23
+ width?: number;
24
+ /** Height in pixels (for images) */
25
+ height?: number;
26
+ /** Small thumbnail URL for preview */
27
+ thumbnailUrl?: string;
28
+ /** MJStorage File ID (for artifact references, mutually exclusive with inline data) */
29
+ fileID?: string;
30
+ /** Source of the attachment */
31
+ source?: 'upload' | 'artifact';
32
+ /** Artifact Version ID (for artifact references, used to create ConversationDetailArtifact) */
33
+ artifactVersionId?: string;
34
+ }
35
+ /**
36
+ * ContentEditable-based mention editor with visual chips/pills
37
+ * Provides Slack/Teams-style mention UX with immutable mention tokens
38
+ */
39
+ export declare class MentionEditorComponent implements OnInit, AfterViewInit, ControlValueAccessor {
40
+ private cdr;
41
+ editorRef: ElementRef<HTMLDivElement>;
42
+ placeholder: string;
43
+ disabled: boolean;
44
+ currentUser?: UserInfo;
45
+ /** Master switch for all mention/command triggers. When false no providers are consulted. */
46
+ enableMentions: boolean;
47
+ /**
48
+ * Explicit trigger-provider list — when bound, EXACTLY these providers are active
49
+ * (explicit list wins over discovery). Leave null to discover providers registered
50
+ * with the ClassFactory via `@RegisterClass(ComposerTriggerProvider, '<Key>')`.
51
+ */
52
+ TriggerProviders: ComposerTriggerProvider[] | null;
53
+ /**
54
+ * Discovery-mode filter: providers whose stable `Key` appears here are skipped when
55
+ * resolving registered providers. Ignored when `TriggerProviders` is bound.
56
+ */
57
+ ExcludedTriggerKeys: string[];
58
+ /** Optional metadata provider scoping this editor (multi-provider hosts); passed through to trigger providers. */
59
+ Provider: IMetadataProvider | null;
60
+ /** Auto-focus the editor after view init (the composer default). Disable when embedded in forms. */
61
+ autoFocus: boolean;
62
+ enableAttachments: boolean;
63
+ maxAttachments: number;
64
+ maxAttachmentSizeBytes: number;
65
+ acceptedFileTypes: string;
66
+ valueChange: EventEmitter<string>;
67
+ mentionSelected: EventEmitter<MentionSuggestion>;
68
+ enterPressed: EventEmitter<string>;
69
+ attachmentsChanged: EventEmitter<PendingAttachment[]>;
70
+ attachmentError: EventEmitter<string>;
71
+ attachmentClicked: EventEmitter<PendingAttachment>;
72
+ pendingAttachments: PendingAttachment[];
73
+ isDragOver: boolean;
74
+ showMentionDropdown: boolean;
75
+ mentionSuggestions: MentionSuggestion[];
76
+ mentionDropdownPosition: {
77
+ top: number;
78
+ left: number;
79
+ };
80
+ mentionDropdownShowAbove: boolean;
81
+ private mentionStartIndex;
82
+ private mentionQuery;
83
+ /** The trigger char that opened the current mention dropdown */
84
+ private activeTrigger;
85
+ /**
86
+ * Monotonic sequence guarding the async suggestion fetch — a response only applies
87
+ * when no newer keystroke (or dropdown close) has superseded it.
88
+ */
89
+ private suggestionRequestSeq;
90
+ /** Cap on the suggestions displayed; passed to providers as `MaxResults`. */
91
+ private static readonly MaxSuggestions;
92
+ /**
93
+ * The trigger providers this editor consults: the explicit `TriggerProviders` list
94
+ * when bound, otherwise ClassFactory discovery filtered by `ExcludedTriggerKeys`.
95
+ * Empty when `enableMentions` is off (or nothing is registered) — the editor then
96
+ * behaves as a plain text editor.
97
+ */
98
+ private get activeProviders();
99
+ /** Unique trigger characters across the active providers (priority order preserved). */
100
+ private get mentionTriggers();
101
+ private onChange;
102
+ onTouched: () => void;
103
+ /** Value written via writeValue() before the view (editorRef) exists — applied in ngAfterViewInit. */
104
+ private pendingWriteValue;
105
+ constructor(cdr: ChangeDetectorRef);
106
+ ngOnInit(): Promise<void>;
107
+ ngAfterViewInit(): void;
108
+ /**
109
+ * Handle clicks on the container - focus the editor if clicking outside the contentEditable
110
+ */
111
+ onContainerClick(event: MouseEvent): void;
112
+ /**
113
+ * Handle input changes in contentEditable
114
+ */
115
+ onInput(): void;
116
+ /**
117
+ * Handle blur event - close dropdown when editor loses focus
118
+ */
119
+ onBlur(): void;
120
+ /**
121
+ * Handle paste event - images or plain text
122
+ */
123
+ onPaste(event: ClipboardEvent): void;
124
+ /**
125
+ * Handle keydown events
126
+ */
127
+ onKeyDown(event: KeyboardEvent): void;
128
+ /**
129
+ * Handle mention/command trigger detection — finds the nearest active trigger char
130
+ * before the cursor and kicks off the (async) provider suggestion fetch.
131
+ */
132
+ private handleMentionInput;
133
+ /**
134
+ * Routes the suggestion request to every active provider whose TriggerChar matches,
135
+ * concatenates their results in priority order, caps the merged list, and opens the
136
+ * dropdown. A monotonic sequence drops stale responses when the user keeps typing.
137
+ */
138
+ private fetchSuggestions;
139
+ /**
140
+ * Get text before cursor position
141
+ */
142
+ private getTextBeforeCursor;
143
+ /**
144
+ * Position the mention dropdown
145
+ */
146
+ private positionMentionDropdown;
147
+ /**
148
+ * Handle mention selection from dropdown
149
+ */
150
+ onMentionSelected(suggestion: MentionSuggestion): void;
151
+ /**
152
+ * Insert a mention chip at the current cursor position
153
+ */
154
+ private insertMentionChip;
155
+ /**
156
+ * Create a mention chip DOM element
157
+ */
158
+ private createMentionChip;
159
+ /**
160
+ * Add configuration preset dropdown to a mention chip
161
+ */
162
+ private addConfigurationDropdown;
163
+ /**
164
+ * Get icon classes with proper FA prefix
165
+ */
166
+ private getIconClasses;
167
+ /**
168
+ * Handle backspace key - delete entire chip if cursor is right after one
169
+ */
170
+ private handleBackspace;
171
+ /**
172
+ * Close mention dropdown
173
+ */
174
+ closeMentionDropdown(): void;
175
+ /**
176
+ * Convert editor HTML to plain text with @mentions
177
+ */
178
+ private getPlainText;
179
+ /**
180
+ * Get text from a node recursively
181
+ */
182
+ private getNodeText;
183
+ /**
184
+ * Set editor content from plain text (for programmatic updates)
185
+ */
186
+ private setEditorContent;
187
+ writeValue(value: string): void;
188
+ registerOnChange(fn: (value: string) => void): void;
189
+ registerOnTouched(fn: () => void): void;
190
+ setDisabledState(isDisabled: boolean): void;
191
+ /**
192
+ * Focus the editor
193
+ */
194
+ focus(): void;
195
+ /**
196
+ * Clear the editor content and pending attachments
197
+ */
198
+ clear(): void;
199
+ /**
200
+ * Extract mention chips with their configuration data
201
+ * Returns array of objects containing mention info and preset configuration
202
+ */
203
+ getMentionChipsData(): Array<{
204
+ id: string;
205
+ type: string;
206
+ name: string;
207
+ presetId?: string;
208
+ presetName?: string;
209
+ }>;
210
+ /**
211
+ * Get the plain text value with mentions encoded as JSON
212
+ * This format preserves configuration information when messages are saved
213
+ * Format: @{type:"agent",id:"uuid",name:"Agent Name",configId:"uuid",config:"High"}
214
+ */
215
+ getPlainTextWithJsonMentions(): string;
216
+ /**
217
+ * Handle drag over event
218
+ */
219
+ onDragOver(event: DragEvent): void;
220
+ /**
221
+ * Handle drag leave event
222
+ */
223
+ onDragLeave(event: DragEvent): void;
224
+ /**
225
+ * Handle drop event
226
+ */
227
+ onDrop(event: DragEvent): void;
228
+ /**
229
+ * Handle file input change (from file picker)
230
+ */
231
+ onFileSelected(event: Event): void;
232
+ /**
233
+ * Process a file for attachment
234
+ */
235
+ private processFile;
236
+ /**
237
+ * Validate a file against settings
238
+ */
239
+ private validateFile;
240
+ /**
241
+ * Check if file type is accepted
242
+ */
243
+ private isAcceptedFile;
244
+ /**
245
+ * Read file as data URL
246
+ */
247
+ private readFileAsDataUrl;
248
+ /**
249
+ * Get image dimensions
250
+ */
251
+ private getImageDimensions;
252
+ /**
253
+ * Generate unique attachment ID
254
+ */
255
+ private generateAttachmentId;
256
+ /**
257
+ * Remove a pending attachment by ID
258
+ */
259
+ removeAttachment(id: string): void;
260
+ /**
261
+ * Get all pending attachments
262
+ */
263
+ getPendingAttachments(): PendingAttachment[];
264
+ /**
265
+ * Add an artifact as a pending attachment programmatically.
266
+ * Used by the artifact picker to attach artifacts as conversation inputs.
267
+ */
268
+ AddArtifactAttachment(artifact: {
269
+ fileID: string;
270
+ fileName: string;
271
+ mimeType: string;
272
+ sizeBytes: number;
273
+ artifactVersionId?: string;
274
+ }): PendingAttachment;
275
+ /**
276
+ * Clear all pending attachments
277
+ */
278
+ clearPendingAttachments(): void;
279
+ /**
280
+ * Handle click on an attachment thumbnail
281
+ */
282
+ onAttachmentClick(attachment: PendingAttachment): void;
283
+ /**
284
+ * Check if there are any pending attachments
285
+ */
286
+ hasAttachments(): boolean;
287
+ /**
288
+ * Trigger file picker programmatically
289
+ */
290
+ openFilePicker(): void;
291
+ static ɵfac: i0.ɵɵFactoryDeclaration<MentionEditorComponent, never>;
292
+ static ɵcmp: i0.ɵɵComponentDeclaration<MentionEditorComponent, "mj-mention-editor", never, { "placeholder": { "alias": "placeholder"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "currentUser": { "alias": "currentUser"; "required": false; }; "enableMentions": { "alias": "enableMentions"; "required": false; }; "TriggerProviders": { "alias": "TriggerProviders"; "required": false; }; "ExcludedTriggerKeys": { "alias": "ExcludedTriggerKeys"; "required": false; }; "Provider": { "alias": "Provider"; "required": false; }; "autoFocus": { "alias": "autoFocus"; "required": false; }; "enableAttachments": { "alias": "enableAttachments"; "required": false; }; "maxAttachments": { "alias": "maxAttachments"; "required": false; }; "maxAttachmentSizeBytes": { "alias": "maxAttachmentSizeBytes"; "required": false; }; "acceptedFileTypes": { "alias": "acceptedFileTypes"; "required": false; }; }, { "valueChange": "valueChange"; "mentionSelected": "mentionSelected"; "enterPressed": "enterPressed"; "attachmentsChanged": "attachmentsChanged"; "attachmentError": "attachmentError"; "attachmentClicked": "attachmentClicked"; }, never, never, false, never>;
293
+ }
294
+ //# sourceMappingURL=mention-editor.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mention-editor.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/mention/mention-editor.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,EAEZ,UAAU,EACV,aAAa,EAEb,MAAM,EAEN,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO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