@memberjunction/ng-composer 6.1.4 → 6.2.0-edge.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"mention-editor.component.js","sourceRoot":"","sources":["../../../../src/lib/components/mention/mention-editor.component.ts","../../../../src/lib/components/mention/mention-editor.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,SAAS,EAGT,UAAU,EAIV,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAwB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAGL,gCAAgC,EAGjC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;;;;;ICTxC,yBAG0B;;;IADxB,AADA,kEAA+B,+BACJ;;;IAI7B,8BAAmC;IACjC,wBAAgC;IAChC,gCAAwB;IAAA,YAAyB;IACnD,AADmD,iBAAO,EACpD;;;IADoB,eAAyB;IAAzB,4CAAyB;;;;IAXvD,8BAC0C;IAAxC,8NAAS,uCAA6B,KAAC;IACvC,4GAA+B;IAM/B,4GAAgC;IAMhC,kCAE4B;IAD1B,iNAAS,yCAA+B,wBAAE,wBAAwB,KAAC;IAEnE,wBAAiC;IAErC,AADE,iBAAS,EACL;;;IAjBJ,cAKC;IALD,qDAKC;IACD,cAKC;IALD,sDAKC;;;IAfP,8BAAiC;IAC/B,yHAqBC;IACH,iBAAM;;;IAtBJ,cAqBC;IArBD,wCAqBC;;;IAmBD,AADF,8BAA0B,cACE;IACxB,wBAA0C;IAC1C,4BAAM;IAAA,+BAAe;IAEzB,AADE,AADuB,iBAAO,EACxB,EACF;;;;IAKN,+CAQoC;IAAlC,AADA,uOAAsB,gCAAyB,KAAC,4LACtC,6BAAsB,KAAC;IACnC,iBAAsB;;;IAHpB,AADA,AADA,AADA,AADA,AADA,uDAA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D,wEAWC;;;iFDGU,sBAAsB;cAblC,SAAS;6BACI,KAAK,YACP,mBAAmB,aAGlB;oBACT;wBACE,OAAO,EAAE,iBAAiB;wBAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,uBAAuB,CAAC;wBACrD,KAAK,EAAE,IAAI;qBACZ;iBACF;;kBAGA,SAAS;mBAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;;kBAErC,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAEL,KAAK;;kBAML,KAAK;;kBAKL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAGL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kBACN,MAAM;;kBACN,MAAM;;kBACN,MAAM;;kBACN,MAAM;;kBACN,MAAM;;kBAEN,MAAM;;kBA+FN,YAAY;mBAAC,oBAAoB,EAAE,CAAC,QAAQ,CAAC;;kFApInC,sBAAsB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n ViewChild,\n ElementRef,\n AfterViewInit,\n forwardRef,\n OnInit,\n ViewEncapsulation,\n ChangeDetectorRef,\n HostListener\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport {\n ComposerSuggestionRequest,\n ComposerTriggerProvider,\n DiscoverComposerTriggerProviders,\n MentionSuggestion,\n MentionSuggestionPreset\n} from '../../composer-trigger-provider';\nimport { IMetadataProvider, UserInfo } from '@memberjunction/core';\nimport { UUIDsEqual } from '@memberjunction/global';\n\n/**\n * Represents a pending attachment that hasn't been uploaded yet\n */\nexport interface PendingAttachment {\n /** Local ID for tracking */\n id: string;\n /** Original File object (null for artifact references) */\n file: File | null;\n /** Base64 data URL for display */\n dataUrl: string;\n /** MIME type */\n mimeType: string;\n /** Original filename */\n fileName: string;\n /** File size in bytes */\n sizeBytes: number;\n /** Width in pixels (for images) */\n width?: number;\n /** Height in pixels (for images) */\n height?: number;\n /** Small thumbnail URL for preview */\n thumbnailUrl?: string;\n /** MJStorage File ID (for artifact references, mutually exclusive with inline data) */\n fileID?: string;\n /** Source of the attachment */\n source?: 'upload' | 'artifact';\n /** Artifact Version ID (for artifact references, used to create ConversationDetailArtifact) */\n artifactVersionId?: string;\n}\n\n/**\n * ContentEditable-based mention editor with visual chips/pills\n * Provides Slack/Teams-style mention UX with immutable mention tokens\n */\n@Component({\n standalone: false,\n selector: 'mj-mention-editor',\n templateUrl: './mention-editor.component.html',\n styleUrls: ['./mention-editor.component.css'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MentionEditorComponent),\n multi: true\n }\n ]\n})\nexport class MentionEditorComponent implements OnInit, AfterViewInit, ControlValueAccessor {\n @ViewChild('editor', { static: false }) editorRef!: ElementRef<HTMLDivElement>;\n\n @Input() placeholder: string = 'Type @ to mention agents or users, # for entities...';\n @Input() disabled: boolean = false;\n @Input() currentUser?: UserInfo;\n /** Master switch for all mention/command triggers. When false no providers are consulted. */\n @Input() enableMentions: boolean = true;\n /**\n * Explicit trigger-provider list — when bound, EXACTLY these providers are active\n * (explicit list wins over discovery). Leave null to discover providers registered\n * with the ClassFactory via `@RegisterClass(ComposerTriggerProvider, '<Key>')`.\n */\n @Input() TriggerProviders: ComposerTriggerProvider[] | null = null;\n /**\n * Discovery-mode filter: providers whose stable `Key` appears here are skipped when\n * resolving registered providers. Ignored when `TriggerProviders` is bound.\n */\n @Input() ExcludedTriggerKeys: string[] = [];\n /** Optional metadata provider scoping this editor (multi-provider hosts); passed through to trigger providers. */\n @Input() Provider: IMetadataProvider | null = null;\n /** Auto-focus the editor after view init (the composer default). Disable when embedded in forms. */\n @Input() autoFocus: boolean = true;\n\n // Attachment settings\n @Input() enableAttachments: boolean = true;\n @Input() maxAttachments: number = 10;\n @Input() maxAttachmentSizeBytes: number = 20 * 1024 * 1024; // 20MB default\n @Input() acceptedFileTypes: string = 'image/*'; // MIME types to accept\n\n @Output() valueChange = new EventEmitter<string>();\n @Output() mentionSelected = new EventEmitter<MentionSuggestion>();\n @Output() enterPressed = new EventEmitter<string>();\n @Output() attachmentsChanged = new EventEmitter<PendingAttachment[]>();\n @Output() attachmentError = new EventEmitter<string>();\n @Output() attachmentClicked = new EventEmitter<PendingAttachment>();\n /** Fires when the contenteditable loses focus (hosts persist drafts on this). */\n @Output() editorBlurred = new EventEmitter<void>();\n\n // Pending attachments state\n public pendingAttachments: PendingAttachment[] = [];\n public isDragOver: boolean = false;\n\n // Mention dropdown state\n public showMentionDropdown: boolean = false;\n public mentionSuggestions: MentionSuggestion[] = [];\n public mentionDropdownPosition: { top: number; left: number } = { top: 0, left: 0 };\n public mentionDropdownShowAbove: boolean = false;\n /** Right-align the dropdown against its anchor. Only the button path sets this. */\n public mentionDropdownAlignRight: boolean = false;\n\n private mentionStartIndex: number = -1;\n private mentionQuery: string = '';\n /** The trigger char that opened the current mention dropdown */\n private activeTrigger: string = '@';\n /**\n * Set while a dropdown was opened by {@link OpenTrigger} rather than by typing.\n *\n * In this mode the trigger character is NOT in the editor — there is nothing to strip on\n * dismissal, and nothing for the user to see until they pick something. It also changes how the\n * query and the chip insertion are measured, since neither can anchor on a character that is not\n * there; {@link virtualTriggerBaseline} stands in for it.\n */\n private virtualTriggerOpen: boolean = false;\n /** Text length at the moment a virtual trigger opened — the origin for its query and deletion. */\n private virtualTriggerBaseline: number = 0;\n /**\n * The control that opened a virtual trigger, used to anchor the dropdown to it.\n *\n * STICKY for the whole session on purpose. `positionMentionDropdown()` re-runs on every keystroke\n * while the user filters, and once there is text the caret measures real coordinates — so\n * anchoring only on first paint would open at the button and then jump to the far-left caret on\n * the first keypress, which is worse than not anchoring at all.\n */\n private virtualTriggerAnchor: HTMLElement | null = null;\n /**\n * Monotonic sequence guarding the async suggestion fetch — a response only applies\n * when no newer keystroke (or dropdown close) has superseded it.\n */\n private suggestionRequestSeq: number = 0;\n /** Cap on the suggestions displayed; passed to providers as `MaxResults`. */\n private static readonly MaxSuggestions: number = 50;\n\n /**\n * The trigger providers this editor consults: the explicit `TriggerProviders` list\n * when bound, otherwise ClassFactory discovery filtered by `ExcludedTriggerKeys`.\n * Empty when `enableMentions` is off (or nothing is registered) — the editor then\n * behaves as a plain text editor.\n */\n private get activeProviders(): ComposerTriggerProvider[] {\n if (!this.enableMentions) {\n return [];\n }\n return this.TriggerProviders ?? DiscoverComposerTriggerProviders(this.ExcludedTriggerKeys);\n }\n\n /** Unique trigger characters across the active providers (priority order preserved). */\n private get mentionTriggers(): string[] {\n const triggers: string[] = [];\n for (const provider of this.activeProviders) {\n if (!triggers.includes(provider.TriggerChar)) {\n triggers.push(provider.TriggerChar);\n }\n }\n return triggers;\n }\n\n private onChange: (value: string) => void = () => {};\n public onTouched: () => void = () => {};\n /** Value written via writeValue() before the view (editorRef) exists — applied in ngAfterViewInit. */\n private pendingWriteValue: string | null = null;\n\n constructor(\n private cdr: ChangeDetectorRef,\n private hostRef: ElementRef<HTMLElement>\n ) {}\n\n /**\n * Close the dropdown when the pointer goes down anywhere outside it.\n *\n * Dismissal previously relied entirely on the editor's blur, which is not enough: clicking a\n * non-focusable area (the message list, page background) does not blur a contenteditable, so the\n * dropdown stayed open with nothing to close it. That was always true for a typed trigger; the\n * Skills button makes it easy to hit, because the button deliberately keeps focus in the editor\n * so the user's next click is the FIRST thing that could dismiss it.\n *\n * `mousedown` rather than `click`: it fires before the browser moves focus, so this decides\n * before blur's own 200ms timer gets involved and the two cannot race.\n *\n * The dropdown renders with fixed positioning but stays inside this component's host, so the\n * containment check covers a click on a suggestion row — which must select, not dismiss.\n */\n @HostListener('document:mousedown', ['$event'])\n onDocumentMouseDown(event: MouseEvent): void {\n // Also fires for a press still awaiting suggestions: on a cold session the provider load takes\n // hundreds of ms, and without this the user's dismissing click is ignored and the menu pops\n // open afterwards, unbidden. closeMentionDropdown bumps the request sequence, which drops the\n // in-flight response.\n if (!this.showMentionDropdown && !this.virtualTriggerOpen) {\n return;\n }\n const target = event.target as Node | null;\n if (target && this.hostRef.nativeElement.contains(target)) {\n return;\n }\n this.closeMentionDropdown();\n this.cdr.markForCheck();\n }\n\n async ngOnInit(): Promise<void> {\n // Warm up the active providers (best-effort — a provider that fails to warm\n // simply serves its first real request cold).\n if (this.enableMentions) {\n const user = this.currentUser ?? null;\n await Promise.all(\n this.activeProviders.map((p) => p.Initialize(user).catch(() => undefined))\n );\n }\n }\n\n ngAfterViewInit(): void {\n // Apply any value written through the ControlValueAccessor before the view existed\n // (NgModel calls writeValue during directive init, before this component's view is ready)\n if (this.pendingWriteValue !== null) {\n this.setEditorContent(this.pendingWriteValue);\n this.pendingWriteValue = null;\n }\n\n // Auto-focus the editor\n if (this.autoFocus) {\n setTimeout(() => {\n this.editorRef?.nativeElement?.focus();\n }, 100);\n }\n }\n\n /**\n * Handle clicks on the container - focus the editor if clicking outside the contentEditable\n */\n onContainerClick(event: MouseEvent): void {\n const target = event.target as HTMLElement;\n const editor = this.editorRef?.nativeElement;\n\n // Don't handle clicks on the dropdown or its children\n if (target.closest('mj-mention-dropdown')) {\n return;\n }\n\n // If clicking on container or any element that's not the editor itself, focus the editor\n if (target !== editor && !editor?.contains(target)) {\n editor?.focus();\n\n // Move cursor to end of content\n const selection = window.getSelection();\n const range = document.createRange();\n\n if (editor && selection) {\n range.selectNodeContents(editor);\n range.collapse(false); // Collapse to end\n selection.removeAllRanges();\n selection.addRange(range);\n }\n }\n }\n\n /**\n * Handle input changes in contentEditable\n */\n onInput(): void {\n const plainText = this.getPlainText();\n this.onChange(plainText);\n this.valueChange.emit(plainText);\n\n // Handle mention/command autocomplete via the active trigger providers\n if (this.enableMentions) {\n this.handleMentionInput();\n }\n }\n\n /**\n * Handle blur event - close dropdown when editor loses focus\n */\n onBlur(): void {\n // Call form control touched callback\n this.onTouched();\n this.editorBlurred.emit();\n\n // Close dropdown when editor loses focus\n // Use setTimeout to allow mousedown events on dropdown to fire first\n setTimeout(() => {\n if (this.showMentionDropdown || this.virtualTriggerOpen) {\n this.closeMentionDropdown();\n }\n }, 200);\n }\n\n /**\n * Handle paste event - images or plain text\n */\n onPaste(event: ClipboardEvent): void {\n // Check for image data in clipboard\n if (this.enableAttachments && event.clipboardData?.items) {\n const items = Array.from(event.clipboardData.items);\n const imageItems = items.filter(item => item.type.startsWith('image/'));\n\n if (imageItems.length > 0) {\n event.preventDefault();\n\n // Process each image\n for (const item of imageItems) {\n const file = item.getAsFile();\n if (file) {\n this.processFile(file);\n }\n }\n return;\n }\n }\n\n // No images - handle as plain text\n event.preventDefault();\n\n // Get plain text from clipboard\n const text = event.clipboardData?.getData('text/plain') || '';\n\n if (!text) return;\n\n // Insert plain text at cursor position\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) return;\n\n const range = selection.getRangeAt(0);\n range.deleteContents();\n\n // Insert text as text node (not HTML)\n const textNode = document.createTextNode(text);\n range.insertNode(textNode);\n\n // Move cursor to end of inserted text\n range.setStartAfter(textNode);\n range.collapse(true);\n selection.removeAllRanges();\n selection.addRange(range);\n\n // Trigger input event to update model\n this.onInput();\n }\n\n /**\n * Handle keydown events\n */\n onKeyDown(event: KeyboardEvent): void {\n // Enter alone: Send message. The dropdown only earns Enter when it has something to pick. A\n // button-opened menu stays open on an empty result set (so the press is not a silent no-op),\n // which made \"showing but empty\" reachable for the first time — and there Enter was neither\n // handled nor prevented, so it fell through to the contenteditable and inserted a newline\n // instead of sending.\n if (event.key === 'Enter' && !event.shiftKey && (!this.showMentionDropdown || this.mentionSuggestions.length === 0)) {\n event.preventDefault();\n if (this.showMentionDropdown) {\n this.closeMentionDropdown();\n }\n const plainText = this.getPlainText();\n this.enterPressed.emit(plainText);\n return;\n }\n\n // Backspace: Check if deleting a mention chip\n if (event.key === 'Backspace') {\n this.handleBackspace(event);\n }\n\n // Handle mention dropdown navigation\n if (this.showMentionDropdown) {\n // Let the dropdown handle arrow keys, enter, escape\n // (We'll pass these through to mention-dropdown component)\n }\n }\n\n /**\n * Handle mention/command trigger detection — finds the nearest active trigger char\n * before the cursor and kicks off the (async) provider suggestion fetch.\n */\n private handleMentionInput(): void {\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) return;\n\n const activeTriggers = this.mentionTriggers;\n if (activeTriggers.length === 0) {\n this.closeMentionDropdown();\n return;\n }\n\n const range = selection.getRangeAt(0);\n const textBeforeCursor = this.getTextBeforeCursor(range);\n\n // Find the nearest active trigger char before the cursor — whichever is closest wins\n // A button-opened session only recognises trigger characters typed AFTER it opened. Without\n // this floor the scan runs over the whole message, so a URL ('.../docs'), an email ('a@b.io')\n // or a date ('9/11') already in the box is found instead, and the first keystroke either closes\n // the menu the button just opened or filters it by the wrong query. searchFrom is 0 on the\n // typed path, which leaves that path's behaviour byte-for-byte unchanged.\n const searchFrom = this.virtualTriggerOpen ? this.virtualTriggerBaseline : 0;\n let triggerIndex = -1;\n let triggerChar = '@';\n for (const t of activeTriggers) {\n const idx = textBeforeCursor.lastIndexOf(t);\n if (idx >= searchFrom && idx > triggerIndex) {\n triggerIndex = idx;\n triggerChar = t;\n }\n }\n\n if (triggerIndex === -1) {\n // A virtual trigger has no character in the text, so the search above finds nothing. Keep it\n // open and measure the query from where it opened, otherwise the first keystroke after\n // clicking the button would dismiss the list the button just produced.\n if (this.virtualTriggerOpen && textBeforeCursor.length >= this.virtualTriggerBaseline) {\n const query = textBeforeCursor.substring(this.virtualTriggerBaseline);\n if (!query.includes(' ')) {\n this.mentionQuery = query;\n void this.fetchSuggestions(this.activeTrigger, query);\n return;\n }\n }\n this.closeMentionDropdown();\n return;\n }\n\n // Check if there's a space between the trigger and cursor (means mention was completed)\n const textAfterTrigger = textBeforeCursor.substring(triggerIndex + 1);\n if (textAfterTrigger.includes(' ')) {\n this.closeMentionDropdown();\n return;\n }\n\n // A real trigger character now owns the session, so the virtual one must let go: otherwise\n // chip insertion still takes the virtual branch and deletes only the typed tail, orphaning the\n // trigger text, and the menu stays pinned to the button instead of the caret.\n if (this.virtualTriggerOpen) {\n this.virtualTriggerOpen = false;\n this.virtualTriggerBaseline = 0;\n this.virtualTriggerAnchor = null;\n this.mentionDropdownAlignRight = false;\n }\n\n // Extract query\n this.mentionQuery = textAfterTrigger;\n this.mentionStartIndex = triggerIndex;\n this.activeTrigger = triggerChar;\n\n // Fetch suggestions from the provider(s) owning this trigger (async, race-guarded)\n void this.fetchSuggestions(triggerChar, textAfterTrigger);\n }\n\n /**\n * Routes the suggestion request to every active provider whose TriggerChar matches,\n * concatenates their results in priority order, caps the merged list, and opens the\n * dropdown. A monotonic sequence drops stale responses when the user keeps typing.\n */\n private async fetchSuggestions(triggerChar: string, query: string): Promise<void> {\n const seq = ++this.suggestionRequestSeq;\n const providers = this.activeProviders.filter((p) => p.TriggerChar === triggerChar);\n\n const request: ComposerSuggestionRequest = {\n Query: query,\n MaxResults: MentionEditorComponent.MaxSuggestions,\n ContextUser: this.currentUser ?? null,\n Provider: this.Provider\n };\n\n const resultSets = await Promise.all(\n providers.map((p) => p.GetSuggestions(request).catch(() => [] as MentionSuggestion[]))\n );\n\n if (seq !== this.suggestionRequestSeq) {\n return; // superseded by a newer keystroke or an explicit close\n }\n\n const merged = resultSets.flat().slice(0, MentionEditorComponent.MaxSuggestions);\n this.mentionSuggestions = merged;\n\n if (merged.length > 0) {\n this.showMentionDropdown = true;\n this.positionMentionDropdown();\n } else if (this.virtualTriggerOpen) {\n // A button press must never be a silent no-op. Closing on empty results is right for a TYPED\n // trigger (the user is mid-word and nothing matched yet), but a host with zero skills clicking\n // the button would get no feedback at all and read it as broken. Staying open surfaces the\n // dropdown's own empty state, which was otherwise unreachable.\n this.showMentionDropdown = true;\n this.positionMentionDropdown();\n } else {\n this.closeMentionDropdown();\n }\n this.cdr.detectChanges();\n }\n\n /**\n * Get text before cursor position\n */\n private getTextBeforeCursor(range: Range): string {\n const tempRange = range.cloneRange();\n tempRange.selectNodeContents(this.editorRef.nativeElement);\n tempRange.setEnd(range.startContainer, range.startOffset);\n return tempRange.toString();\n }\n\n /**\n * Position the mention dropdown\n */\n private positionMentionDropdown(): void {\n const editor = this.editorRef?.nativeElement;\n if (!editor) return;\n\n // Get the parent container (message-input-box-container) for alignment\n const container = editor.closest('.message-input-box-container');\n const containerRect = container?.getBoundingClientRect();\n\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) return;\n\n // A button-opened trigger anchors to the BUTTON, not the caret. On the typed path the user's\n // eyes and query are at the caret so the caret is right; on the button path nobody is looking at\n // the caret, they are looking at the control they just pressed. Sticky for the session (see\n // virtualTriggerAnchor) so filtering does not yank the menu to the caret on the first keystroke.\n if (this.virtualTriggerOpen && this.virtualTriggerAnchor) {\n this.positionToAnchor(this.virtualTriggerAnchor, containerRect);\n return;\n }\n\n const range = selection.getRangeAt(0);\n let cursorRect = range.getBoundingClientRect();\n\n // A collapsed range in an EMPTY editor measures 0x0 at 0,0 in every browser, which pinned the\n // dropdown to the bottom-left corner of the viewport and ran it off screen. Rare while typing\n // (there is text to measure) but the normal case when a BUTTON opens the trigger on an empty\n // composer. Fall back to the editor's own box so the menu lands over the composer either way.\n if (cursorRect.width === 0 && cursorRect.height === 0 && cursorRect.top === 0 && cursorRect.left === 0) {\n const editorRect = editor.getBoundingClientRect();\n cursorRect = editorRect as DOMRect;\n }\n\n // Check space below vs above\n const spaceBelow = window.innerHeight - cursorRect.bottom;\n const spaceAbove = cursorRect.top;\n const dropdownHeight = Math.min(this.mentionSuggestions.length * 56, 300);\n\n // Prefer ABOVE. The composer sits at the bottom of the chat, so a dropdown that grows downward\n // lands on top of the very text being typed. Below is the fallback for the rare host that\n // mounts the composer high in a tall viewport.\n this.mentionDropdownAlignRight = false;\n this.mentionDropdownShowAbove = spaceAbove >= dropdownHeight || spaceAbove > spaceBelow;\n\n if (this.mentionDropdownShowAbove) {\n // Position above, aligning with container top if possible\n this.mentionDropdownPosition = {\n top: (containerRect ? containerRect.top : cursorRect.top) + window.scrollY - 8,\n left: cursorRect.left + window.scrollX\n };\n } else {\n // Position below cursor, but align bottom edge with container top\n this.mentionDropdownPosition = {\n top: containerRect ? containerRect.top + window.scrollY : cursorRect.bottom + window.scrollY + 4,\n left: cursorRect.left + window.scrollX\n };\n }\n }\n\n\n /**\n * Right-align the dropdown above a trigger control, matching where the voice-options picker puts\n * its popover so two buttons in the same strip do not open menus on opposite corners.\n *\n * Right alignment is applied as a transform in CSS (`align-right`) rather than computed here,\n * because the dropdown's width is content-based; `left` is still clamped so no anchor position can\n * push it off the left edge on a narrow viewport.\n */\n private positionToAnchor(anchor: HTMLElement, containerRect: DOMRect | undefined): void {\n const GUTTER = 16;\n const rect = anchor.getBoundingClientRect();\n // The dropdown is rendered with `useFixedPositioning`, so `top`/`left` are VIEWPORT coordinates.\n // Never add window.scrollX/scrollY here — getBoundingClientRect is already viewport-relative, and\n // adding scroll converts to document coordinates, which under `position: fixed` drags the menu\n // off by exactly the scroll offset.\n\n // HORIZONTAL. Align the box's LEFT edge to the button's left edge and let it grow rightward.\n // Right-alignment is wrong for this control: the Skills button sits in `.attach-buttons` on the\n // LEFT of the composer, so pinning the box's right edge to the button's right edge sends a\n // 280-400px menu off the left of the screen, and clamping it back parks it over the middle of\n // the composer. Flip to right-aligned only when growing right would overflow the viewport,\n // which is what a menu anchored to a right-hand control needs.\n const assumedWidth = Math.min(400, window.innerWidth - GUTTER * 2);\n const overflowsRight = rect.left + assumedWidth > window.innerWidth - GUTTER;\n this.mentionDropdownAlignRight = overflowsRight;\n // align-right shifts the box back by its own width, so `left` is then its RIGHT edge; otherwise\n // `left` is its left edge. Clamp both forms inside the gutter.\n //\n // When flipping, align to the CONTAINER's right edge, not the button's. `.attach-buttons` is\n // pinned to the composer's bottom-right and Skills is the leftmost of five icons, so pinning the\n // box to that one button's right edge hangs its whole 400px body out to the left of the icon the\n // user pressed. Aligning to the composer instead puts the menu above the button cluster, which is\n // what \"above the button\" means when the menu is ten times the button's width.\n const flippedRightEdge = containerRect\n ? Math.min(containerRect.right, window.innerWidth - GUTTER)\n : Math.min(rect.right, window.innerWidth - GUTTER);\n const left = overflowsRight\n ? Math.max(assumedWidth + GUTTER, flippedRightEdge)\n : Math.min(Math.max(GUTTER, rect.left), window.innerWidth - GUTTER - assumedWidth);\n\n // VERTICAL. Prefer the composer's top edge so the menu clears the whole input box rather than\n // overlapping the text the user is composing; fall back to the button when there is no container.\n // Not unconditional: `show-above` lifts the box by its own height, so forcing it where there is\n // no room renders it off the top of the viewport where it cannot be reached.\n const anchorTop = containerRect ? containerRect.top : rect.top;\n const dropdownHeight = Math.min(Math.max(this.mentionSuggestions.length, 1) * 56, 300);\n // Prefer above, but when it does not fit, take whichever side has MORE room rather than\n // dropping below unconditionally — the composer is bottom-docked, so below is usually the worse\n // side. In a short viewport (a popped-out chat, or mobile with the keyboard up) that difference\n // is the whole menu versus a clipped sliver.\n const spaceBelow = window.innerHeight - rect.bottom;\n const showAbove = anchorTop >= dropdownHeight + GUTTER || anchorTop > spaceBelow;\n this.mentionDropdownShowAbove = showAbove;\n // Above: `top` is the box's BOTTOM edge (the transform lifts it). Below: it is the top edge.\n // Clamped either way, because dropdownHeight is an estimate (rows with descriptions run taller\n // than 56px) and an underestimate would otherwise clip the first row off the top of the screen.\n const rawTop = showAbove ? anchorTop - 8 : rect.bottom + 8;\n const top = showAbove\n ? Math.max(GUTTER + dropdownHeight, Math.min(rawTop, window.innerHeight - GUTTER))\n : Math.max(GUTTER, Math.min(rawTop, window.innerHeight - GUTTER - dropdownHeight));\n\n this.mentionDropdownPosition = { top, left };\n }\n\n /**\n * Handle mention selection from dropdown\n */\n onMentionSelected(suggestion: MentionSuggestion): void {\n this.insertMentionChip(suggestion);\n this.closeMentionDropdown();\n this.mentionSelected.emit(suggestion);\n\n // Refocus the editor after selection\n setTimeout(() => {\n this.editorRef?.nativeElement?.focus();\n }, 50);\n }\n\n /**\n * Insert a mention chip at the current cursor position\n */\n /**\n * Programmatically inserts a RESOLVED mention chip (+ a single trailing space) at\n * the END of the editor content and places the caret after it — the exact state a\n * user reaches by typing a trigger and picking from the dropdown. Unlike the\n * dropdown path this needs no active trigger context, so hosts can pre-address a\n * message (e.g. the omnibar's '@agent' flow staging a Sage pill) and leave the\n * user ready to type.\n *\n * @returns false when the editor view isn't mounted yet — callers may retry.\n */\n /** Focuses the editor and places the caret at the very end of its content. */\n public FocusCaretAtEnd(): boolean {\n const editor = this.editorRef?.nativeElement;\n if (!editor) {\n return false;\n }\n editor.focus();\n const selection = window.getSelection();\n if (selection) {\n const range = document.createRange();\n range.selectNodeContents(editor);\n range.collapse(false);\n selection.removeAllRanges();\n selection.addRange(range);\n }\n return true;\n }\n\n /**\n * Open the suggestion dropdown for a trigger character, exactly as if the user had typed it.\n *\n * Exists so a trigger can have a BUTTON as well as a keystroke. `/` commands were previously\n * reachable only by knowing to type `/`, which is not an affordance — nothing on screen says the\n * feature is there.\n *\n * Deliberately inserts the character and re-runs the normal input path rather than opening the\n * dropdown directly. Everything downstream (which providers own the char, permission filtering,\n * the query the user then types, replacing the char with the chosen chip) is already driven by\n * that path; short-circuiting it would fork the flow and leave `mentionStartIndex` /\n * `activeTrigger` unset, so the first selection would insert in the wrong place.\n *\n * @returns false when the editor is disabled, unavailable, or no active provider owns the char.\n */\n public OpenTrigger(triggerChar: string, anchorEl?: HTMLElement | null): boolean {\n const editor = this.editorRef?.nativeElement;\n if (!editor || this.disabled) {\n return false;\n }\n if (!this.mentionTriggers.includes(triggerChar)) {\n return false;\n }\n if (!this.FocusCaretAtEnd()) {\n return false;\n }\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) {\n return false;\n }\n\n // NOTHING is written into the editor. An earlier version inserted the trigger character to\n // reuse the typed path, and cleaned it up on dismissal — but a character the user never typed,\n // appearing and then vanishing, is visible churn in their own message. The dropdown is opened\n // directly instead, and the character only ever exists as the chip the user chooses.\n this.virtualTriggerOpen = true;\n this.virtualTriggerAnchor = anchorEl ?? null;\n this.virtualTriggerBaseline = this.getTextBeforeCursor(selection.getRangeAt(0)).length;\n this.activeTrigger = triggerChar;\n this.mentionQuery = '';\n void this.fetchSuggestions(triggerChar, '');\n return true;\n }\n\n /**\n * True when the suggestion dropdown is open FOR THIS trigger character.\n *\n * Lets a control that opens a trigger render its own pressed state without duplicating the\n * editor's state. Both halves matter: `showMentionDropdown` alone would light the Skills button\n * while an unrelated `@` mention dropdown is open.\n */\n public IsTriggerOpen(triggerChar: string): boolean {\n // virtualTriggerOpen covers the window between the press and the provider's response. Reporting\n // \"closed\" there makes the second press of a quick double-click re-run the open path instead of\n // toggling, re-emitting the Before/After pair.\n return (this.showMentionDropdown || this.virtualTriggerOpen) && this.activeTrigger === triggerChar;\n }\n\n /** True when keyboard focus currently sits inside this editor. */\n public get HasFocus(): boolean {\n const editor = this.editorRef?.nativeElement;\n return !!editor && (editor === document.activeElement || editor.contains(document.activeElement));\n }\n\n public InsertMention(suggestion: MentionSuggestion, focus: boolean = true): boolean {\n const editor = this.editorRef?.nativeElement;\n if (!editor) {\n return false;\n }\n editor.focus();\n const selection = window.getSelection();\n if (!selection) {\n return false;\n }\n // Caret to the end of the current content, then chip + space + caret-after.\n const range = document.createRange();\n range.selectNodeContents(editor);\n range.collapse(false);\n const chip = this.createMentionChip(suggestion);\n range.insertNode(chip);\n const space = document.createTextNode(' ');\n range.setStartAfter(chip);\n range.collapse(true);\n range.insertNode(space);\n range.setStartAfter(space);\n range.collapse(true);\n selection.removeAllRanges();\n selection.addRange(range);\n if (!focus) {\n editor.blur();\n }\n this.onInput();\n return true;\n }\n\n private insertMentionChip(suggestion: MentionSuggestion): void {\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) return;\n\n const range = selection.getRangeAt(0);\n\n // Delete the trigger + query text (use the active trigger char). A VIRTUAL trigger has no\n // character in the editor, so the span to remove is only what the user typed since it opened —\n // anchoring on the trigger char here would delete an unrelated earlier one, or nothing.\n const textBeforeCursor = this.getTextBeforeCursor(range);\n const deleteLength = this.virtualTriggerOpen\n ? Math.max(0, textBeforeCursor.length - this.virtualTriggerBaseline)\n : textBeforeCursor.length - textBeforeCursor.lastIndexOf(this.activeTrigger);\n\n if (deleteLength > 0) {\n range.setStart(range.startContainer, range.startOffset - deleteLength);\n range.deleteContents();\n }\n\n // Create mention chip element\n const chip = this.createMentionChip(suggestion);\n\n // Insert chip\n range.insertNode(chip);\n\n // Add space after chip\n const space = document.createTextNode(' ');\n range.collapse(false);\n range.insertNode(space);\n\n // Move cursor after the space\n range.setStartAfter(space);\n range.collapse(true);\n selection.removeAllRanges();\n selection.addRange(range);\n\n // Trigger change detection\n this.onInput();\n }\n\n /**\n * Create a mention chip DOM element\n */\n private createMentionChip(suggestion: MentionSuggestion): HTMLSpanElement {\n const chip = document.createElement('span');\n chip.className = 'mention-chip';\n chip.contentEditable = 'false'; // Make chip non-editable\n chip.setAttribute('data-mention-id', suggestion.id);\n chip.setAttribute('data-mention-type', suggestion.type);\n chip.setAttribute('data-mention-name', suggestion.name);\n\n // Configuration presets ride along on the suggestion itself (supplied by the trigger\n // provider — e.g. the agent-mentions provider maps AI Agent Configuration presets in).\n // The composer has no knowledge of what a preset IS; it just stores the default's\n // ID/Name on the chip and offers a picker when there are 2+.\n const presets: MentionSuggestionPreset[] = suggestion.presets ?? [];\n if (presets.length > 0) {\n const defaultPreset = presets.find(p => p.IsDefault) || presets[0];\n if (defaultPreset) {\n chip.setAttribute('data-preset-id', defaultPreset.ID || '');\n chip.setAttribute('data-preset-name', defaultPreset.Name || '');\n }\n }\n\n // Apply inline styles directly — color by mention type. Skills carry their own accent Color\n // (AISkill.Color UX metadata); when present it drives the chip, otherwise the standard skill\n // green (--mj-status-success). Same color logic as the saved-message badge — keep in sync with\n // message-item's renderMentionHTML.\n const skillPalette = suggestion.type === 'skill'\n ? { bg: suggestion.color || 'var(--mj-status-success)', border: 'rgba(255, 255, 255, 0.35)' }\n : null;\n const palette =\n skillPalette\n ? skillPalette\n : suggestion.type === 'user'\n ? { bg: 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)', border: 'rgba(240, 147, 251, 0.4)' }\n : suggestion.type === 'entity'\n ? { bg: 'linear-gradient(135deg, #11998e 0%, #38ef7d 100%)', border: 'rgba(17, 153, 142, 0.4)' }\n : suggestion.type === 'query'\n ? { bg: 'linear-gradient(135deg, #FF6A00 0%, #FF9E2C 100%)', border: 'rgba(255, 106, 0, 0.4)' }\n : { bg: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', border: 'rgba(102, 126, 234, 0.4)' };\n // Skills render as a sharp-cornered rectangle (vs. the rounded pill for agents/users/entities)\n // — the shape is the at-a-glance differentiator. Same shape in the saved-message badge.\n const chipRadius = suggestion.type === 'skill' ? '4px' : '16px';\n chip.style.cssText = `\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 4px 12px;\n margin: 0 3px;\n border-radius: ${chipRadius};\n font-size: 13px;\n font-weight: 600;\n cursor: default;\n user-select: none;\n vertical-align: middle;\n white-space: nowrap;\n pointer-events: all;\n background: ${palette.bg};\n color: white;\n border: 2px solid ${palette.border};\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);\n `;\n\n // Add icon or image\n if (suggestion.type === 'agent' && suggestion.imageUrl) {\n // Use image if available (LogoURL from agent)\n const img = document.createElement('img');\n img.src = suggestion.imageUrl;\n img.alt = suggestion.displayName;\n img.style.cssText = 'width: 16px; height: 16px; border-radius: 50%; object-fit: cover;';\n chip.appendChild(img);\n } else if (suggestion.type === 'agent' && suggestion.icon === 'mj-icon-skip') {\n // Special handling for mj-icon-skip: use the SVG data URI as an image\n const img = document.createElement('img');\n img.src = \"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 101.89918457031249 96.83947368421053'%3E%3Cg transform='translate(-0.1288232421875,-0.0)'%3E%3Cpath d='M93.85,41.56c-.84,0-1.62.2-2.37.55-3-4.35-7.49-8.12-13.04-11.04l.04-7.18v-14.44h-10.24v17.6c-1.52-.43-3.07-.8-4.67-1.11V0h-10.24v24.72s-.09,0-.14,0h-4.38s-.1,0-.14,0V7.3h-10.24v18.62c-1.6.32-3.15.69-4.67,1.11v-11.67h-10.24v6.09l.04,9.6c-5.55,2.92-10.04,6.7-13.04,11.04-.75-.35-1.53-.55-2.37-.55-4.5,0-8.14,5.61-8.14,12.51s3.64,12.53,8.14,12.53c.58,0,1.14-.12,1.67-.29,4.1,6.62,11.54,12.06,20.98,15.28l.79.13v7.05c0,2.97,1.45,5.58,3.87,6.99,1.18.69,2.5,1.04,3.85,1.03,1.4,0,2.83-.37,4.15-1.12l7.54-4.29,7.56,4.3c1.31.74,2.73,1.12,4.13,1.12s2.67-.35,3.85-1.04c2.42-1.41,3.86-4.02,3.86-6.98v-7.05l.79-.13c9.44-3.22,16.89-8.66,20.98-15.28.54.17,1.09.29,1.68.29,4.5,0,8.14-5.61,8.14-12.53s-3.63-12.51-8.14-12.51' fill='%23AAAAAA'/%3E%3Cpath d='M86.69,50.87c0-12.22-13.6-19.1-28.94-20.66-4.48-.47-9.19-.54-13.52,0-15.34,1.53-28.93,8.41-28.93,20.66,0,8.55,5.7,15.55,12.68,15.55h7.94c3.05,2.5,6.93,4.1,11.08,4.71,2.65.4,5.44.46,8.01,0,4.15-.6,8.05-2.2,11.1-4.71h7.92c6.97,0,12.68-7,12.68-15.55' fill='white' opacity='0.9'/%3E%3Cpath d='M57.83,55.82c-1.19,2.58-3.8,4.35-6.84,4.35s-5.65-1.77-6.84-4.35h13.68Z' fill='%23AAAAAA'/%3E%3Cpath d='M32.52,41.14c1.74,0,3.18,2.13,3.18,4.76s-1.44,4.74-3.18,4.74-3.16-2.13-3.16-4.74,1.41-4.76,3.16-4.76' fill='%23AAAAAA'/%3E%3Cpath d='M69.46,41.14c1.74,0,3.16,2.13,3.16,4.76s-1.41,4.74-3.16,4.74-3.18-2.13-3.18-4.74,1.41-4.76,3.18-4.76' fill='%23AAAAAA'/%3E%3Cpath d='M63.91,76.15c-.82-.48-1.84-.43-2.8.12l-10.13,5.75-10.11-5.75c-.96-.55-1.98-.59-2.8-.12-.82.47-1.29,1.38-1.29,2.49v10.12c0,1.11.47,2.02,1.28,2.49.38.22.8.33,1.24.33.51,0,1.05-.15,1.57-.44l10.12-5.75,10.11,5.75c.52.29,1.05.44,1.56.44.44,0,.86-.11,1.24-.33.81-.48,1.28-1.38,1.28-2.49v-10.12c0-1.11-.47-2.02-1.28-2.49' fill='white' opacity='0.9'/%3E%3C/g%3E%3C/svg%3E\";\n img.alt = suggestion.displayName;\n img.style.cssText = 'width: 16px; height: 16px; border-radius: 50%; object-fit: cover;';\n chip.appendChild(img);\n } else {\n // Use icon for users or agents without images\n const icon = document.createElement('i');\n icon.style.cssText = 'font-size: 12px; opacity: 0.95;';\n if (suggestion.type === 'agent' && suggestion.icon) {\n icon.className = this.getIconClasses(suggestion.icon);\n } else if (suggestion.type === 'user') {\n icon.className = 'fa-solid fa-user';\n } else if (suggestion.type === 'entity') {\n icon.className = this.getIconClasses(suggestion.icon || 'fa-solid fa-table');\n } else if (suggestion.type === 'query') {\n icon.className = this.getIconClasses(suggestion.icon || 'fa-solid fa-database');\n } else if (suggestion.type === 'skill') {\n icon.className = this.getIconClasses(suggestion.icon || 'fa-solid fa-wand-magic-sparkles');\n } else {\n icon.className = 'fa-solid fa-robot';\n }\n chip.appendChild(icon);\n }\n\n // Add space between icon/image and text\n const space = document.createTextNode(' ');\n chip.appendChild(space);\n\n // Add text\n const text = document.createTextNode(suggestion.displayName);\n chip.appendChild(text);\n\n // Add dropdown when the suggestion carries 2+ presets\n if (presets.length >= 2) {\n this.addConfigurationDropdown(chip, presets);\n }\n\n return chip;\n }\n\n /**\n * Add configuration preset dropdown to a mention chip\n */\n private addConfigurationDropdown(chip: HTMLSpanElement, presets: MentionSuggestionPreset[]): void {\n // Store default preset for comparison\n const defaultPreset = presets.find(p => p.IsDefault) || presets[0];\n\n // Add preset indicator text (only shown when non-default selected)\n const presetIndicator = document.createElement('span');\n presetIndicator.className = 'preset-indicator';\n presetIndicator.style.cssText = `\n display: none;\n font-size: 10px;\n font-weight: 600;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;\n background: rgba(255, 255, 255, 0.25);\n padding: 2px 6px;\n border-radius: 4px;\n margin-left: 4px;\n letter-spacing: 0.3px;\n text-transform: uppercase;\n border: 1px solid rgba(255, 255, 255, 0.15);\n `;\n chip.appendChild(presetIndicator);\n\n // Add dropdown chevron button\n const chevron = document.createElement('i');\n chevron.className = 'fa-solid fa-chevron-down';\n chevron.style.cssText = `\n font-size: 10px;\n opacity: 0.9;\n cursor: pointer;\n padding: 2px;\n `;\n chip.appendChild(chevron);\n\n // Create dropdown menu (initially hidden) - append to body for global positioning\n const dropdown = document.createElement('div');\n dropdown.className = 'preset-dropdown';\n dropdown.style.cssText = `\n display: none;\n position: fixed;\n background: white;\n border: 1px solid #ddd;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n min-width: 200px;\n max-width: 300px;\n z-index: 10000;\n overflow: hidden;\n `;\n\n // Add preset options to dropdown\n presets.forEach(preset => {\n const option = document.createElement('div');\n option.className = 'preset-option';\n option.style.cssText = `\n padding: 10px 12px;\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: 8px;\n transition: background 0.2s;\n `;\n\n // Check if this is the selected preset\n const currentPresetId = chip.getAttribute('data-preset-id');\n const isSelected = UUIDsEqual(preset.ID, currentPresetId);\n\n // Add checkmark for selected option\n const checkmark = document.createElement('i');\n checkmark.className = 'fa-solid fa-check';\n checkmark.style.cssText = `\n font-size: 12px;\n color: #667eea;\n opacity: ${isSelected ? '1' : '0'};\n width: 14px;\n `;\n option.appendChild(checkmark);\n\n // Add preset text content\n const textContainer = document.createElement('div');\n textContainer.style.cssText = 'flex: 1;';\n\n const displayName = document.createElement('div');\n displayName.textContent = preset.DisplayName || preset.Name;\n displayName.style.cssText = `\n font-weight: 600;\n color: #333;\n font-size: 13px;\n `;\n textContainer.appendChild(displayName);\n\n if (preset.Description) {\n const description = document.createElement('div');\n description.textContent = preset.Description;\n description.style.cssText = `\n font-size: 11px;\n color: #666;\n margin-top: 2px;\n `;\n textContainer.appendChild(description);\n }\n\n option.appendChild(textContainer);\n\n // Hover effects\n option.addEventListener('mouseenter', () => {\n option.style.background = '#f5f5f5';\n });\n option.addEventListener('mouseleave', () => {\n option.style.background = 'white';\n });\n\n // Click handler to select preset\n option.addEventListener('click', (e) => {\n e.stopPropagation();\n\n // Update chip data attributes\n // IMPORTANT: Store preset.ID (AIAgentConfiguration.ID), not AIConfigurationID\n chip.setAttribute('data-preset-id', preset.ID || '');\n chip.setAttribute('data-preset-name', preset.Name || '');\n\n // Update preset indicator visibility and text\n const isDefault = UUIDsEqual(preset.ID, defaultPreset.ID);\n if (isDefault) {\n presetIndicator.style.display = 'none';\n } else {\n presetIndicator.style.display = 'inline';\n presetIndicator.textContent = preset.DisplayName || preset.Name;\n }\n\n // Update checkmarks\n dropdown.querySelectorAll('.preset-option').forEach((opt, idx) => {\n const check = opt.querySelector('i.fa-check') as HTMLElement;\n if (check) {\n check.style.opacity = idx === presets.indexOf(preset) ? '1' : '0';\n }\n });\n\n // Close dropdown\n dropdown.style.display = 'none';\n });\n\n dropdown.appendChild(option);\n });\n\n // Append dropdown to document body for global positioning\n document.body.appendChild(dropdown);\n\n // Helper function to position dropdown relative to chip\n const positionDropdown = () => {\n const chipRect = chip.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const spaceBelow = viewportHeight - chipRect.bottom;\n\n // Set left position (same for both above/below)\n dropdown.style.left = `${chipRect.left}px`;\n\n // First, show dropdown to measure its actual height\n const wasHidden = dropdown.style.display === 'none';\n if (wasHidden) {\n dropdown.style.visibility = 'hidden';\n dropdown.style.display = 'block';\n }\n\n const dropdownHeight = dropdown.offsetHeight;\n const spaceAbove = chipRect.top;\n\n // Position dropdown above chip if not enough space below\n if (spaceBelow < dropdownHeight && spaceAbove > spaceBelow) {\n // Show above - position so bottom of dropdown is 4px above top of chip\n dropdown.style.top = `${chipRect.top - dropdownHeight - 4}px`;\n } else {\n // Show below (default) - position 4px below bottom of chip\n dropdown.style.top = `${chipRect.bottom + 4}px`;\n }\n\n // Restore visibility\n if (wasHidden) {\n dropdown.style.visibility = 'visible';\n }\n };\n\n // Toggle dropdown on chevron click\n chevron.addEventListener('click', (e) => {\n e.stopPropagation();\n const isVisible = dropdown.style.display === 'block';\n\n if (isVisible) {\n dropdown.style.display = 'none';\n } else {\n positionDropdown();\n dropdown.style.display = 'block';\n }\n });\n\n // Close dropdown when clicking outside\n const closeDropdown = (e: MouseEvent) => {\n if (!dropdown.contains(e.target as Node) && !chip.contains(e.target as Node)) {\n dropdown.style.display = 'none';\n }\n };\n document.addEventListener('click', closeDropdown);\n\n // Cleanup: remove dropdown from body and event listeners when chip is removed\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n mutation.removedNodes.forEach((node) => {\n if (node === chip) {\n document.removeEventListener('click', closeDropdown);\n if (dropdown.parentNode) {\n dropdown.parentNode.removeChild(dropdown);\n }\n observer.disconnect();\n }\n });\n });\n });\n if (chip.parentNode) {\n observer.observe(chip.parentNode, { childList: true });\n }\n }\n\n /**\n * Get icon classes with proper FA prefix\n */\n private getIconClasses(iconClass: string): string {\n if (!iconClass) return 'fa-solid fa-robot';\n if (iconClass.includes('fa-')) {\n if (iconClass.match(/\\b(fa-solid|fa-regular|fa-light|fa-brands)\\b/)) {\n return iconClass;\n }\n return `fa-solid ${iconClass}`;\n }\n return iconClass;\n }\n\n /**\n * Handle backspace key - delete entire chip if cursor is right after one\n */\n private handleBackspace(event: KeyboardEvent): void {\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) return;\n\n const range = selection.getRangeAt(0);\n\n // Check if cursor is right after a mention chip\n if (range.collapsed && range.startOffset > 0) {\n const prevNode = range.startContainer.childNodes[range.startOffset - 1];\n\n if (prevNode && (prevNode as HTMLElement).classList?.contains('mention-chip')) {\n event.preventDefault();\n prevNode.remove();\n this.onInput();\n }\n }\n }\n\n /**\n * Close mention dropdown\n */\n closeMentionDropdown(): void {\n // No text cleanup: a virtual trigger never wrote anything into the editor, which is the whole\n // point of it. Dismissing leaves the message exactly as the user left it.\n this.virtualTriggerOpen = false;\n this.virtualTriggerBaseline = 0;\n this.virtualTriggerAnchor = null;\n this.mentionDropdownAlignRight = false;\n // Invalidate any in-flight suggestion fetch so a late response can't reopen the dropdown\n this.suggestionRequestSeq++;\n this.showMentionDropdown = false;\n this.mentionSuggestions = [];\n this.mentionStartIndex = -1;\n this.mentionQuery = '';\n this.activeTrigger = '@';\n }\n\n /**\n * Convert editor HTML to plain text with @mentions\n */\n private getPlainText(): string {\n const editor = this.editorRef?.nativeElement;\n if (!editor) return '';\n\n let text = '';\n const nodes = editor.childNodes;\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n\n if (node.nodeType === Node.TEXT_NODE) {\n text += node.textContent || '';\n } else if (node.nodeType === Node.ELEMENT_NODE) {\n const element = node as HTMLElement;\n\n if (element.classList.contains('mention-chip')) {\n const name = element.getAttribute('data-mention-name') || '';\n const mentionType = element.getAttribute('data-mention-type');\n const prefix = mentionType === 'entity' || mentionType === 'query' ? '#' : mentionType === 'skill' ? '/' : '@';\n // Use quoted format if name has spaces\n text += name.includes(' ') ? `${prefix}\"${name}\"` : `${prefix}${name}`;\n } else if (element.tagName === 'BR') {\n text += '\\n';\n } else if (element.tagName === 'DIV') {\n // Handle line breaks from contentEditable\n if (i > 0) text += '\\n';\n text += this.getNodeText(element);\n } else {\n text += element.textContent || '';\n }\n }\n }\n\n return text;\n }\n\n /**\n * Get text from a node recursively\n */\n private getNodeText(node: Node): string {\n let text = '';\n const children = node.childNodes;\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n\n if (child.nodeType === Node.TEXT_NODE) {\n text += child.textContent || '';\n } else if (child.nodeType === Node.ELEMENT_NODE) {\n const element = child as HTMLElement;\n\n if (element.classList.contains('mention-chip')) {\n const name = element.getAttribute('data-mention-name') || '';\n const mentionType = element.getAttribute('data-mention-type');\n const prefix = mentionType === 'entity' || mentionType === 'query' ? '#' : mentionType === 'skill' ? '/' : '@';\n text += name.includes(' ') ? `${prefix}\"${name}\"` : `${prefix}${name}`;\n } else {\n text += this.getNodeText(element);\n }\n }\n }\n\n return text;\n }\n\n /**\n * Set editor content from plain text (for programmatic updates)\n */\n /**\n * Renders a value into the editor, REHYDRATING any serialized mention tokens\n * (the `@{\"type\":…,\"id\":…,\"name\":…}` format produced by\n * {@link getPlainTextWithJsonMentions}) back into real chips — so persisted\n * drafts and any host-written serialized value round-trip losslessly. Plain\n * strings (no tokens) take the fast path.\n */\n private setEditorContent(text: string): void {\n const editor = this.editorRef?.nativeElement;\n if (!editor) return;\n\n const segments = MentionEditorComponent.ParseSerializedMentions(text);\n if (segments.every((seg) => typeof seg === 'string')) {\n editor.textContent = text;\n return;\n }\n editor.textContent = '';\n for (const seg of segments) {\n if (typeof seg === 'string') {\n if (seg.length > 0) {\n editor.appendChild(document.createTextNode(seg));\n }\n } else {\n const chip = this.createMentionChip(seg.suggestion);\n if (seg.configId) {\n chip.setAttribute('data-preset-id', seg.configId);\n }\n if (seg.config) {\n chip.setAttribute('data-preset-name', seg.config);\n }\n editor.appendChild(chip);\n }\n }\n }\n\n /**\n * Splits text containing serialized mention tokens into plain-string segments and\n * parsed mention segments. Token = '@' followed by a JSON object with at least\n * {type,id,name}; brace matching is string-aware so names containing braces or\n * escaped quotes parse correctly. Malformed candidates stay as literal text.\n */\n public static ParseSerializedMentions(\n text: string\n ): Array<string | { suggestion: MentionSuggestion; configId?: string; config?: string }> {\n const segments: Array<string | { suggestion: MentionSuggestion; configId?: string; config?: string }> = [];\n let cursor = 0;\n let searchFrom = 0;\n while (true) {\n const start = text.indexOf('@{', searchFrom);\n if (start === -1) {\n break;\n }\n const end = MentionEditorComponent.findJsonEnd(text, start + 1);\n if (end === -1) {\n searchFrom = start + 2;\n continue;\n }\n const candidate = text.substring(start + 1, end + 1);\n let parsed: { type?: string; id?: string; name?: string; configId?: string; config?: string } | null = null;\n try {\n parsed = JSON.parse(candidate);\n } catch {\n parsed = null;\n }\n if (!parsed || typeof parsed.type !== 'string' || typeof parsed.id !== 'string' || typeof parsed.name !== 'string') {\n searchFrom = start + 2; // not a mention token — keep scanning past it\n continue;\n }\n if (start > cursor) {\n segments.push(text.substring(cursor, start));\n }\n segments.push({\n suggestion: { type: parsed.type, id: parsed.id, name: parsed.name, displayName: parsed.name },\n configId: parsed.configId,\n config: parsed.config,\n });\n cursor = end + 1;\n searchFrom = cursor;\n }\n if (cursor < text.length) {\n segments.push(text.substring(cursor));\n }\n if (segments.length === 0) {\n segments.push(text);\n }\n return segments;\n }\n\n /** Index of the matching closing brace for the object starting at `openIndex` ('{'), string-aware. -1 when unbalanced. */\n private static findJsonEnd(text: string, openIndex: number): number {\n let depth = 0;\n let inString = false;\n for (let i = openIndex; i < text.length; i++) {\n const ch = text[i];\n if (inString) {\n if (ch === '\\\\') {\n i++; // skip escaped char\n } else if (ch === '\"') {\n inString = false;\n }\n continue;\n }\n if (ch === '\"') {\n inString = true;\n } else if (ch === '{') {\n depth++;\n } else if (ch === '}') {\n depth--;\n if (depth === 0) {\n return i;\n }\n }\n }\n return -1;\n }\n\n // ControlValueAccessor implementation\n writeValue(value: string): void {\n const editor = this.editorRef?.nativeElement;\n if (!editor) {\n // View not created yet — buffer the value; ngAfterViewInit applies it\n this.pendingWriteValue = value ?? '';\n return;\n }\n if (value) {\n this.setEditorContent(value);\n } else {\n editor.textContent = '';\n }\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n if (this.editorRef?.nativeElement) {\n this.editorRef.nativeElement.contentEditable = (!isDisabled).toString();\n }\n }\n\n /**\n * Focus the editor\n */\n public focus(): void {\n this.editorRef?.nativeElement?.focus();\n }\n\n /**\n * Clear the editor content and pending attachments\n */\n public clear(): void {\n if (this.editorRef?.nativeElement) {\n this.editorRef.nativeElement.textContent = '';\n this.onInput();\n }\n this.clearPendingAttachments();\n }\n\n /**\n * Extract mention chips with their configuration data\n * Returns array of objects containing mention info and preset configuration\n */\n public getMentionChipsData(): Array<{ id: string; type: string; name: string; presetId?: string; presetName?: string }> {\n const editor = this.editorRef?.nativeElement;\n if (!editor) return [];\n\n const chips: Array<{ id: string; type: string; name: string; presetId?: string; presetName?: string }> = [];\n const mentionElements = editor.querySelectorAll('.mention-chip');\n\n mentionElements.forEach(chip => {\n const element = chip as HTMLElement;\n const id = element.getAttribute('data-mention-id') || '';\n const type = element.getAttribute('data-mention-type') || '';\n const name = element.getAttribute('data-mention-name') || '';\n const presetId = element.getAttribute('data-preset-id') || undefined;\n const presetName = element.getAttribute('data-preset-name') || undefined;\n\n chips.push({\n id,\n type,\n name,\n ...(presetId ? { presetId } : {}),\n ...(presetName ? { presetName } : {})\n });\n });\n\n return chips;\n }\n\n /**\n * Get the plain text value with mentions encoded as JSON\n * This format preserves configuration information when messages are saved\n * Format: @{type:\"agent\",id:\"uuid\",name:\"Agent Name\",configId:\"uuid\",config:\"High\"}\n */\n public getPlainTextWithJsonMentions(): string {\n const editor = this.editorRef?.nativeElement;\n if (!editor) return '';\n\n let plainText = '';\n const childNodes = Array.from(editor.childNodes);\n\n for (const node of childNodes) {\n if (node.nodeType === Node.TEXT_NODE) {\n // Regular text node\n plainText += node.textContent || '';\n } else if (node.nodeType === Node.ELEMENT_NODE) {\n const element = node as HTMLElement;\n\n if (element.classList.contains('mention-chip')) {\n // Extract mention data attributes\n const type = element.getAttribute('data-mention-type') || '';\n const id = element.getAttribute('data-mention-id') || '';\n const name = element.getAttribute('data-mention-name') || '';\n const presetId = element.getAttribute('data-preset-id');\n const presetName = element.getAttribute('data-preset-name');\n\n // Build JSON mention object (compact format - no spaces)\n const mentionObj: Record<string, string> = {\n type,\n id,\n name\n };\n\n // Add configuration fields if present (for agents with non-default presets)\n if (presetId) {\n mentionObj.configId = presetId;\n }\n if (presetName) {\n mentionObj.config = presetName;\n }\n\n // Encode as JSON mention\n // Don't remove spaces from the JSON string - spaces in values (like agent names) need to be preserved\n plainText += `@${JSON.stringify(mentionObj)}`;\n } else {\n // Other HTML element (e.g., <br>)\n if (element.tagName === 'BR') {\n plainText += '\\n';\n } else {\n plainText += element.textContent || '';\n }\n }\n }\n }\n\n return plainText;\n }\n\n // ==================== Attachment Handling Methods ====================\n\n /**\n * Handle drag over event\n */\n onDragOver(event: DragEvent): void {\n if (!this.enableAttachments) return;\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver = true;\n }\n\n /**\n * Handle drag leave event\n */\n onDragLeave(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver = false;\n }\n\n /**\n * Handle drop event\n */\n onDrop(event: DragEvent): void {\n if (!this.enableAttachments) return;\n\n event.preventDefault();\n event.stopPropagation();\n this.isDragOver = false;\n\n if (event.dataTransfer?.files) {\n const files = Array.from(event.dataTransfer.files);\n for (const file of files) {\n if (this.isAcceptedFile(file)) {\n this.processFile(file);\n }\n }\n }\n }\n\n /**\n * Handle file input change (from file picker)\n */\n onFileSelected(event: Event): void {\n const input = event.target as HTMLInputElement;\n if (input.files) {\n const files = Array.from(input.files);\n for (const file of files) {\n this.processFile(file);\n }\n // Reset input so same file can be selected again\n input.value = '';\n }\n }\n\n /**\n * Process a file for attachment\n */\n private async processFile(file: File): Promise<void> {\n // Validate file\n const validation = this.validateFile(file);\n if (!validation.valid) {\n this.attachmentError.emit(validation.error!);\n return;\n }\n\n // Read file as data URL\n const dataUrl = await this.readFileAsDataUrl(file);\n if (!dataUrl) {\n this.attachmentError.emit('Failed to read file');\n return;\n }\n\n // Get image dimensions if applicable\n let width: number | undefined;\n let height: number | undefined;\n\n if (file.type.startsWith('image/')) {\n const dimensions = await this.getImageDimensions(dataUrl);\n width = dimensions.width;\n height = dimensions.height;\n }\n\n // Create pending attachment\n const attachment: PendingAttachment = {\n id: this.generateAttachmentId(),\n file,\n dataUrl,\n mimeType: file.type,\n fileName: file.name,\n sizeBytes: file.size,\n width,\n height,\n thumbnailUrl: file.type.startsWith('image/') ? dataUrl : undefined\n };\n\n // Add to pending attachments\n this.pendingAttachments.push(attachment);\n this.attachmentsChanged.emit([...this.pendingAttachments]);\n this.cdr.detectChanges();\n }\n\n /**\n * Validate a file against settings\n */\n private validateFile(file: File): { valid: boolean; error?: string } {\n // Check count limit\n if (this.pendingAttachments.length >= this.maxAttachments) {\n return {\n valid: false,\n error: `Maximum ${this.maxAttachments} attachments allowed`\n };\n }\n\n // Check size limit\n if (file.size > this.maxAttachmentSizeBytes) {\n const maxMB = (this.maxAttachmentSizeBytes / (1024 * 1024)).toFixed(1);\n const fileMB = (file.size / (1024 * 1024)).toFixed(1);\n return {\n valid: false,\n error: `File size (${fileMB}MB) exceeds maximum (${maxMB}MB)`\n };\n }\n\n // Check file type\n if (!this.isAcceptedFile(file)) {\n return {\n valid: false,\n error: `File type ${file.type || 'unknown'} not accepted`\n };\n }\n\n return { valid: true };\n }\n\n /**\n * Check if file type is accepted\n */\n private isAcceptedFile(file: File): boolean {\n if (this.acceptedFileTypes === '*' || this.acceptedFileTypes === '*/*') {\n return true;\n }\n\n const acceptedTypes = this.acceptedFileTypes.split(',').map(t => t.trim());\n\n for (const accepted of acceptedTypes) {\n // Handle universal wildcard */* anywhere in the list\n if (accepted === '*/*') {\n return true;\n }\n // Handle wildcard MIME types like \"image/*\"\n if (accepted.endsWith('/*')) {\n const category = accepted.slice(0, -2);\n if (file.type.startsWith(category + '/')) {\n return true;\n }\n } else if (accepted.startsWith('.')) {\n // Handle file extensions like \".png\"\n if (file.name.toLowerCase().endsWith(accepted.toLowerCase())) {\n return true;\n }\n } else if (file.type === accepted) {\n // Exact MIME type match\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Read file as data URL\n */\n private readFileAsDataUrl(file: File): Promise<string | null> {\n return new Promise((resolve) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = () => resolve(null);\n reader.readAsDataURL(file);\n });\n }\n\n /**\n * Get image dimensions\n */\n private getImageDimensions(dataUrl: string): Promise<{ width: number; height: number }> {\n return new Promise((resolve) => {\n const img = new Image();\n img.onload = () => {\n resolve({ width: img.naturalWidth, height: img.naturalHeight });\n };\n img.onerror = () => {\n resolve({ width: 0, height: 0 });\n };\n img.src = dataUrl;\n });\n }\n\n /**\n * Generate unique attachment ID\n */\n private generateAttachmentId(): string {\n return `att_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n }\n\n /**\n * Remove a pending attachment by ID\n */\n public removeAttachment(id: string): void {\n const index = this.pendingAttachments.findIndex(a => a.id === id);\n if (index !== -1) {\n this.pendingAttachments.splice(index, 1);\n this.attachmentsChanged.emit([...this.pendingAttachments]);\n this.cdr.detectChanges();\n }\n }\n\n /**\n * Get all pending attachments\n */\n public getPendingAttachments(): PendingAttachment[] {\n return [...this.pendingAttachments];\n }\n\n /**\n * Add an artifact as a pending attachment programmatically.\n * Used by the artifact picker to attach artifacts as conversation inputs.\n */\n public AddArtifactAttachment(artifact: {\n fileID: string; fileName: string; mimeType: string;\n sizeBytes: number; artifactVersionId?: string;\n }): PendingAttachment {\n const attachment: PendingAttachment = {\n id: crypto.randomUUID(),\n file: null,\n dataUrl: '',\n mimeType: artifact.mimeType,\n fileName: artifact.fileName,\n sizeBytes: artifact.sizeBytes,\n fileID: artifact.fileID,\n source: 'artifact',\n artifactVersionId: artifact.artifactVersionId\n };\n this.pendingAttachments.push(attachment);\n this.attachmentsChanged.emit([...this.pendingAttachments]);\n return attachment;\n }\n\n /**\n * Clear all pending attachments\n */\n public clearPendingAttachments(): void {\n this.pendingAttachments = [];\n this.attachmentsChanged.emit([]);\n this.cdr.detectChanges();\n }\n\n /**\n * Handle click on an attachment thumbnail\n */\n public onAttachmentClick(attachment: PendingAttachment): void {\n this.attachmentClicked.emit(attachment);\n }\n\n /**\n * Check if there are any pending attachments\n */\n public hasAttachments(): boolean {\n return this.pendingAttachments.length > 0;\n }\n\n /**\n * Trigger file picker programmatically\n */\n public openFilePicker(): void {\n const input = document.createElement('input');\n input.type = 'file';\n // If */* is in the list, accept all files (some browsers don't handle */* correctly)\n input.accept = this.acceptedFileTypes.includes('*/*') ? '' : this.acceptedFileTypes;\n input.multiple = true;\n input.onchange = (e) => this.onFileSelected(e);\n input.click();\n }\n}\n","<div class=\"mention-editor-container\"\n [class.drag-over]=\"isDragOver\"\n (click)=\"onContainerClick($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\">\n\n <!-- Pending Attachments Preview -->\n @if (pendingAttachments.length > 0) {\n <div class=\"pending-attachments\">\n @for (attachment of pendingAttachments; track attachment) {\n <div class=\"attachment-thumbnail\"\n (click)=\"onAttachmentClick(attachment)\">\n @if (attachment.thumbnailUrl) {\n <img\n [src]=\"attachment.thumbnailUrl\"\n [alt]=\"attachment.fileName\"\n class=\"thumbnail-image\">\n }\n @if (!attachment.thumbnailUrl) {\n <div class=\"thumbnail-placeholder\">\n <i class=\"fa-solid fa-file\"></i>\n <span class=\"file-name\">{{ attachment.fileName }}</span>\n </div>\n }\n <button class=\"remove-attachment\"\n (click)=\"removeAttachment(attachment.id); $event.stopPropagation()\"\n title=\"Remove attachment\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n }\n </div>\n }\n\n <div\n #editor\n class=\"mention-editor\"\n contenteditable=\"true\"\n [attr.contenteditable]=\"!disabled\"\n [attr.data-placeholder]=\"placeholder\"\n (input)=\"onInput()\"\n (keydown)=\"onKeyDown($event)\"\n (blur)=\"onBlur()\"\n (paste)=\"onPaste($event)\"\n ></div>\n\n <!-- Drag & Drop Overlay -->\n @if (isDragOver) {\n <div class=\"drop-overlay\">\n <div class=\"drop-message\">\n <i class=\"fa-solid fa-cloud-arrow-up\"></i>\n <span>Drop files here</span>\n </div>\n </div>\n }\n\n <!-- Mention Dropdown -->\n @if (showMentionDropdown && enableMentions) {\n <mj-mention-dropdown\n [suggestions]=\"mentionSuggestions\"\n [position]=\"mentionDropdownPosition\"\n [showAbove]=\"mentionDropdownShowAbove\"\n [alignRight]=\"mentionDropdownAlignRight\"\n [useFixedPositioning]=\"true\"\n [visible]=\"true\"\n (suggestionSelected)=\"onMentionSelected($event)\"\n (closed)=\"closeMentionDropdown()\">\n </mj-mention-dropdown>\n }\n</div>\n"]}
1
+ {"version":3,"file":"mention-editor.component.js","sourceRoot":"","sources":["../../../../src/lib/components/mention/mention-editor.component.ts","../../../../src/lib/components/mention/mention-editor.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,SAAS,EAGT,UAAU,EAIV,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAwB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAGL,gCAAgC,EAGjC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;;;;;ICTxC,yBAG0B;;;IADxB,AADA,kEAA+B,+BACJ;;;IAI7B,8BAAmC;IACjC,wBAAgC;IAChC,gCAAwB;IAAA,YAAyB;IACnD,AADmD,iBAAO,EACpD;;;IADoB,eAAyB;IAAzB,4CAAyB;;;;IAXvD,8BAC0C;IAAxC,8NAAS,uCAA6B,KAAC;IACvC,4GAA+B;IAM/B,4GAAgC;IAMhC,kCAE4B;IAD1B,iNAAS,yCAA+B,wBAAE,wBAAwB,KAAC;IAEnE,wBAAiC;IAErC,AADE,iBAAS,EACL;;;IAjBJ,cAKC;IALD,qDAKC;IACD,cAKC;IALD,sDAKC;;;IAfP,8BAAiC;IAC/B,yHAqBC;IACH,iBAAM;;;IAtBJ,cAqBC;IArBD,wCAqBC;;;IAmBD,AADF,8BAA0B,cACE;IACxB,wBAA0C;IAC1C,4BAAM;IAAA,+BAAe;IAEzB,AADE,AADuB,iBAAO,EACxB,EACF;;;;IAKN,+CAQoC;IAAlC,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K;;kBAOL,KAAK;;kBAGL,KAAK;;kBAQL,KAAK;;kBAGL,KAAK;;kBAYL,KAAK;;kBAKL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAGL,KAAK;;kBASL,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAQL,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBACN,MAAM;;kBASN,MAAM;;kBAEN,MAAM;;kBASN,MAAM;;kBAuKN,YAAY;mBAAC,oBAAoB,EAAE,CAAC,QAAQ,CAAC;;kFArWnC,sBAAsB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n ViewChild,\n ElementRef,\n AfterViewInit,\n forwardRef,\n OnInit,\n ViewEncapsulation,\n ChangeDetectorRef,\n HostListener\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport {\n ComposerSuggestionRequest,\n ComposerTriggerProvider,\n DiscoverComposerTriggerProviders,\n MentionSuggestion,\n MentionSuggestionPreset\n} from '../../composer-trigger-provider';\nimport { IMetadataProvider, UserInfo } from '@memberjunction/core';\nimport { UUIDsEqual } from '@memberjunction/global';\n\n/**\n * Represents a pending attachment that hasn't been uploaded yet\n */\nexport interface PendingAttachment {\n /** Local ID for tracking */\n id: string;\n /** Original File object (null for artifact references) */\n file: File | null;\n /** Base64 data URL for display */\n dataUrl: string;\n /** MIME type */\n mimeType: string;\n /** Original filename */\n fileName: string;\n /** File size in bytes */\n sizeBytes: number;\n /** Width in pixels (for images) */\n width?: number;\n /** Height in pixels (for images) */\n height?: number;\n /** Small thumbnail URL for preview */\n thumbnailUrl?: string;\n /** MJStorage File ID (for artifact references, mutually exclusive with inline data) */\n fileID?: string;\n /** Source of the attachment */\n source?: 'upload' | 'artifact';\n /** Artifact Version ID (for artifact references, used to create ConversationDetailArtifact) */\n artifactVersionId?: string;\n}\n\n/**\n * ContentEditable-based mention editor with visual chips/pills\n * Provides Slack/Teams-style mention UX with immutable mention tokens\n */\n@Component({\n standalone: false,\n selector: 'mj-mention-editor',\n templateUrl: './mention-editor.component.html',\n styleUrls: ['./mention-editor.component.css'],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MentionEditorComponent),\n multi: true\n }\n ]\n})\nexport class MentionEditorComponent implements OnInit, AfterViewInit, ControlValueAccessor {\n @ViewChild('editor', { static: false }) EditorRef!: ElementRef<HTMLDivElement>;\n\n /** @deprecated Use {@link EditorRef}. */\n get editorRef(): ElementRef<HTMLDivElement> {\n return this.EditorRef;\n }\n /** @deprecated Use {@link EditorRef}. */\n set editorRef(value: ElementRef<HTMLDivElement>) {\n this.EditorRef = value;\n }\n\n @Input() Placeholder: string = 'Type @ to mention agents or users, # for entities...';\n\n /** @deprecated Use {@link Placeholder}. */\n @Input() set placeholder(value: string) {\n this.Placeholder = value;\n }\n /** @deprecated Use {@link Placeholder}. */\n get placeholder(): string {\n return this.Placeholder;\n }\n @Input() Disabled: boolean = false;\n\n /** @deprecated Use {@link Disabled}. */\n @Input() set disabled(value: boolean) {\n this.Disabled = value;\n }\n /** @deprecated Use {@link Disabled}. */\n get disabled(): boolean {\n return this.Disabled;\n }\n @Input() CurrentUser?: UserInfo;\n\n /** @deprecated Use {@link CurrentUser}. */\n @Input() set currentUser(value: UserInfo | undefined) {\n this.CurrentUser = value;\n }\n /** @deprecated Use {@link CurrentUser}. */\n get currentUser(): UserInfo | undefined {\n return this.CurrentUser;\n }\n /** Master switch for all mention/command triggers. When false no providers are consulted. */\n @Input() EnableMentions: boolean = true;\n\n /** @deprecated Use {@link EnableMentions}. */\n @Input() set enableMentions(value: boolean) {\n this.EnableMentions = value;\n }\n /** @deprecated Use {@link EnableMentions}. */\n get enableMentions(): boolean {\n return this.EnableMentions;\n }\n /**\n * Explicit trigger-provider list — when bound, EXACTLY these providers are active\n * (explicit list wins over discovery). Leave null to discover providers registered\n * with the ClassFactory via `@RegisterClass(ComposerTriggerProvider, '<Key>')`.\n */\n @Input() TriggerProviders: ComposerTriggerProvider[] | null = null;\n /**\n * Discovery-mode filter: providers whose stable `Key` appears here are skipped when\n * resolving registered providers. Ignored when `TriggerProviders` is bound.\n */\n @Input() ExcludedTriggerKeys: string[] = [];\n /** Optional metadata provider scoping this editor (multi-provider hosts); passed through to trigger providers. */\n @Input() Provider: IMetadataProvider | null = null;\n /** Auto-focus the editor after view init (the composer default). Disable when embedded in forms. */\n @Input() AutoFocus: boolean = true;\n\n /** @deprecated Use {@link AutoFocus}. */\n @Input() set autoFocus(value: boolean) {\n this.AutoFocus = value;\n }\n /** @deprecated Use {@link AutoFocus}. */\n get autoFocus(): boolean {\n return this.AutoFocus;\n }\n\n // Attachment settings\n @Input() EnableAttachments: boolean = true;\n\n /** @deprecated Use {@link EnableAttachments}. */\n @Input() set enableAttachments(value: boolean) {\n this.EnableAttachments = value;\n }\n /** @deprecated Use {@link EnableAttachments}. */\n get enableAttachments(): boolean {\n return this.EnableAttachments;\n }\n @Input() MaxAttachments: number = 10;\n\n /** @deprecated Use {@link MaxAttachments}. */\n @Input() set maxAttachments(value: number) {\n this.MaxAttachments = value;\n }\n /** @deprecated Use {@link MaxAttachments}. */\n get maxAttachments(): number {\n return this.MaxAttachments;\n }\n @Input() MaxAttachmentSizeBytes: number = 20 * 1024 * 1024;\n\n /** @deprecated Use {@link MaxAttachmentSizeBytes}. */\n @Input() set maxAttachmentSizeBytes(value: number) {\n this.MaxAttachmentSizeBytes = value;\n }\n /** @deprecated Use {@link MaxAttachmentSizeBytes}. */\n get maxAttachmentSizeBytes(): number {\n return this.MaxAttachmentSizeBytes;\n } // 20MB default\n @Input() AcceptedFileTypes: string = 'image/*';\n\n /** @deprecated Use {@link AcceptedFileTypes}. */\n @Input() set acceptedFileTypes(value: string) {\n this.AcceptedFileTypes = value;\n }\n /** @deprecated Use {@link AcceptedFileTypes}. */\n get acceptedFileTypes(): string {\n return this.AcceptedFileTypes;\n } // MIME types to accept\n\n @Output() ValueChange = new EventEmitter<string>();\n\n /**\n * @deprecated Use {@link ValueChange}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (valueChange) keeps working. Must stay AFTER ValueChange: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() valueChange = this.ValueChange;\n @Output() MentionSelected = new EventEmitter<MentionSuggestion>();\n\n /**\n * @deprecated Use {@link MentionSelected}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (mentionSelected) keeps working. Must stay AFTER MentionSelected: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() mentionSelected = this.MentionSelected;\n @Output() EnterPressed = new EventEmitter<string>();\n\n /**\n * @deprecated Use {@link EnterPressed}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (enterPressed) keeps working. Must stay AFTER EnterPressed: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() enterPressed = this.EnterPressed;\n @Output() AttachmentsChanged = new EventEmitter<PendingAttachment[]>();\n\n /**\n * @deprecated Use {@link AttachmentsChanged}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (attachmentsChanged) keeps working. Must stay AFTER AttachmentsChanged: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() attachmentsChanged = this.AttachmentsChanged;\n @Output() AttachmentError = new EventEmitter<string>();\n\n /**\n * @deprecated Use {@link AttachmentError}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (attachmentError) keeps working. Must stay AFTER AttachmentError: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() attachmentError = this.AttachmentError;\n @Output() AttachmentClicked = new EventEmitter<PendingAttachment>();\n\n /**\n * @deprecated Use {@link AttachmentClicked}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (attachmentClicked) keeps working. Must stay AFTER AttachmentClicked: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() attachmentClicked = this.AttachmentClicked;\n /** Fires when the contenteditable loses focus (hosts persist drafts on this). */\n @Output() EditorBlurred = new EventEmitter<void>();\n\n /**\n * @deprecated Use {@link EditorBlurred}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (editorBlurred) keeps working. Must stay AFTER EditorBlurred: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() editorBlurred = this.EditorBlurred;\n\n // Pending attachments state\n public PendingAttachments: PendingAttachment[] = [];\n\n /** @deprecated Use {@link PendingAttachments}. */\n public get pendingAttachments(): PendingAttachment[] {\n return this.PendingAttachments;\n }\n /** @deprecated Use {@link PendingAttachments}. */\n public set pendingAttachments(value: PendingAttachment[]) {\n this.PendingAttachments = value;\n }\n public IsDragOver: boolean = false;\n\n /** @deprecated Use {@link IsDragOver}. */\n public get isDragOver(): boolean {\n return this.IsDragOver;\n }\n /** @deprecated Use {@link IsDragOver}. */\n public set isDragOver(value: boolean) {\n this.IsDragOver = value;\n }\n\n // Mention dropdown state\n public ShowMentionDropdown: boolean = false;\n\n /** @deprecated Use {@link ShowMentionDropdown}. */\n public get showMentionDropdown(): boolean {\n return this.ShowMentionDropdown;\n }\n /** @deprecated Use {@link ShowMentionDropdown}. */\n public set showMentionDropdown(value: boolean) {\n this.ShowMentionDropdown = value;\n }\n public MentionSuggestions: MentionSuggestion[] = [];\n\n /** @deprecated Use {@link MentionSuggestions}. */\n public get mentionSuggestions(): MentionSuggestion[] {\n return this.MentionSuggestions;\n }\n /** @deprecated Use {@link MentionSuggestions}. */\n public set mentionSuggestions(value: MentionSuggestion[]) {\n this.MentionSuggestions = value;\n }\n public MentionDropdownPosition: { top: number; left: number } = { top: 0, left: 0 };\n\n /** @deprecated Use {@link MentionDropdownPosition}. */\n public get mentionDropdownPosition(): { top: number; left: number } {\n return this.MentionDropdownPosition;\n }\n /** @deprecated Use {@link MentionDropdownPosition}. */\n public set mentionDropdownPosition(value: { top: number; left: number }) {\n this.MentionDropdownPosition = value;\n }\n public MentionDropdownShowAbove: boolean = false;\n\n /** @deprecated Use {@link MentionDropdownShowAbove}. */\n public get mentionDropdownShowAbove(): boolean {\n return this.MentionDropdownShowAbove;\n }\n /** @deprecated Use {@link MentionDropdownShowAbove}. */\n public set mentionDropdownShowAbove(value: boolean) {\n this.MentionDropdownShowAbove = value;\n }\n /** Right-align the dropdown against its anchor. Only the button path sets this. */\n public MentionDropdownAlignRight: boolean = false;\n\n /** @deprecated Use {@link MentionDropdownAlignRight}. */\n public get mentionDropdownAlignRight(): boolean {\n return this.MentionDropdownAlignRight;\n }\n /** @deprecated Use {@link MentionDropdownAlignRight}. */\n public set mentionDropdownAlignRight(value: boolean) {\n this.MentionDropdownAlignRight = value;\n }\n\n private mentionStartIndex: number = -1;\n private mentionQuery: string = '';\n /** The trigger char that opened the current mention dropdown */\n private activeTrigger: string = '@';\n /**\n * Set while a dropdown was opened by {@link OpenTrigger} rather than by typing.\n *\n * In this mode the trigger character is NOT in the editor — there is nothing to strip on\n * dismissal, and nothing for the user to see until they pick something. It also changes how the\n * query and the chip insertion are measured, since neither can anchor on a character that is not\n * there; {@link virtualTriggerBaseline} stands in for it.\n */\n private virtualTriggerOpen: boolean = false;\n /** Text length at the moment a virtual trigger opened — the origin for its query and deletion. */\n private virtualTriggerBaseline: number = 0;\n /**\n * The control that opened a virtual trigger, used to anchor the dropdown to it.\n *\n * STICKY for the whole session on purpose. `positionMentionDropdown()` re-runs on every keystroke\n * while the user filters, and once there is text the caret measures real coordinates — so\n * anchoring only on first paint would open at the button and then jump to the far-left caret on\n * the first keypress, which is worse than not anchoring at all.\n */\n private virtualTriggerAnchor: HTMLElement | null = null;\n /**\n * Monotonic sequence guarding the async suggestion fetch — a response only applies\n * when no newer keystroke (or dropdown close) has superseded it.\n */\n private suggestionRequestSeq: number = 0;\n /** Cap on the suggestions displayed; passed to providers as `MaxResults`. */\n private static readonly maxSuggestions: number = 50;\n\n /**\n * The trigger providers this editor consults: the explicit `TriggerProviders` list\n * when bound, otherwise ClassFactory discovery filtered by `ExcludedTriggerKeys`.\n * Empty when `enableMentions` is off (or nothing is registered) — the editor then\n * behaves as a plain text editor.\n */\n private get activeProviders(): ComposerTriggerProvider[] {\n if (!this.EnableMentions) {\n return [];\n }\n return this.TriggerProviders ?? DiscoverComposerTriggerProviders(this.ExcludedTriggerKeys);\n }\n\n /** Unique trigger characters across the active providers (priority order preserved). */\n private get mentionTriggers(): string[] {\n const triggers: string[] = [];\n for (const provider of this.activeProviders) {\n if (!triggers.includes(provider.TriggerChar)) {\n triggers.push(provider.TriggerChar);\n }\n }\n return triggers;\n }\n\n private onChange: (value: string) => void = () => {};\n public OnTouched: () => void = () => {};\n\n /** @deprecated Use {@link OnTouched}. */\n public get onTouched(): () => void {\n return this.OnTouched;\n }\n /** @deprecated Use {@link OnTouched}. */\n public set onTouched(value: () => void) {\n this.OnTouched = value;\n }\n /** Value written via writeValue() before the view (editorRef) exists — applied in ngAfterViewInit. */\n private pendingWriteValue: string | null = null;\n\n constructor(\n private cdr: ChangeDetectorRef,\n private hostRef: ElementRef<HTMLElement>\n ) {}\n\n /**\n * Close the dropdown when the pointer goes down anywhere outside it.\n *\n * Dismissal previously relied entirely on the editor's blur, which is not enough: clicking a\n * non-focusable area (the message list, page background) does not blur a contenteditable, so the\n * dropdown stayed open with nothing to close it. That was always true for a typed trigger; the\n * Skills button makes it easy to hit, because the button deliberately keeps focus in the editor\n * so the user's next click is the FIRST thing that could dismiss it.\n *\n * `mousedown` rather than `click`: it fires before the browser moves focus, so this decides\n * before blur's own 200ms timer gets involved and the two cannot race.\n *\n * The dropdown renders with fixed positioning but stays inside this component's host, so the\n * containment check covers a click on a suggestion row — which must select, not dismiss.\n */\n @HostListener('document:mousedown', ['$event'])\n onDocumentMouseDown(event: MouseEvent): void {\n // Also fires for a press still awaiting suggestions: on a cold session the provider load takes\n // hundreds of ms, and without this the user's dismissing click is ignored and the menu pops\n // open afterwards, unbidden. closeMentionDropdown bumps the request sequence, which drops the\n // in-flight response.\n if (!this.ShowMentionDropdown && !this.virtualTriggerOpen) {\n return;\n }\n const target = event.target as Node | null;\n if (target && this.hostRef.nativeElement.contains(target)) {\n return;\n }\n this.CloseMentionDropdown();\n this.cdr.markForCheck();\n }\n\n async ngOnInit(): Promise<void> {\n // Warm up the active providers (best-effort — a provider that fails to warm\n // simply serves its first real request cold).\n if (this.EnableMentions) {\n const user = this.CurrentUser ?? null;\n await Promise.all(\n this.activeProviders.map((p) => p.Initialize(user).catch(() => undefined))\n );\n }\n }\n\n ngAfterViewInit(): void {\n // Apply any value written through the ControlValueAccessor before the view existed\n // (NgModel calls writeValue during directive init, before this component's view is ready)\n if (this.pendingWriteValue !== null) {\n this.setEditorContent(this.pendingWriteValue);\n this.pendingWriteValue = null;\n }\n\n // Auto-focus the editor\n if (this.AutoFocus) {\n setTimeout(() => {\n this.EditorRef?.nativeElement?.focus();\n }, 100);\n }\n }\n\n /**\n * Handle clicks on the container - focus the editor if clicking outside the contentEditable\n */\n OnContainerClick(event: MouseEvent): void {\n const target = event.target as HTMLElement;\n const editor = this.EditorRef?.nativeElement;\n\n // Don't handle clicks on the dropdown or its children\n if (target.closest('mj-mention-dropdown')) {\n return;\n }\n\n // If clicking on container or any element that's not the editor itself, focus the editor\n if (target !== editor && !editor?.contains(target)) {\n editor?.focus();\n\n // Move cursor to end of content\n const selection = window.getSelection();\n const range = document.createRange();\n\n if (editor && selection) {\n range.selectNodeContents(editor);\n range.collapse(false); // Collapse to end\n selection.removeAllRanges();\n selection.addRange(range);\n }\n }\n }\n\n /** @deprecated Use {@link OnContainerClick}. */\n onContainerClick(event: MouseEvent): void {\n return this.OnContainerClick(event);\n }\n\n /**\n * Handle input changes in contentEditable\n */\n OnInput(): void {\n const plainText = this.getPlainText();\n this.onChange(plainText);\n this.ValueChange.emit(plainText);\n\n // Handle mention/command autocomplete via the active trigger providers\n if (this.EnableMentions) {\n this.handleMentionInput();\n }\n }\n\n /** @deprecated Use {@link OnInput}. */\n onInput(): void {\n return this.OnInput();\n }\n\n /**\n * Handle blur event - close dropdown when editor loses focus\n */\n OnBlur(): void {\n // Call form control touched callback\n this.OnTouched();\n this.EditorBlurred.emit();\n\n // Close dropdown when editor loses focus\n // Use setTimeout to allow mousedown events on dropdown to fire first\n setTimeout(() => {\n if (this.ShowMentionDropdown || this.virtualTriggerOpen) {\n this.CloseMentionDropdown();\n }\n }, 200);\n }\n\n /** @deprecated Use {@link OnBlur}. */\n onBlur(): void {\n return this.OnBlur();\n }\n\n /**\n * Handle paste event - images or plain text\n */\n OnPaste(event: ClipboardEvent): void {\n // Check for image data in clipboard\n if (this.EnableAttachments && event.clipboardData?.items) {\n const items = Array.from(event.clipboardData.items);\n const imageItems = items.filter(item => item.type.startsWith('image/'));\n\n if (imageItems.length > 0) {\n event.preventDefault();\n\n // Process each image\n for (const item of imageItems) {\n const file = item.getAsFile();\n if (file) {\n this.processFile(file);\n }\n }\n return;\n }\n }\n\n // No images - handle as plain text\n event.preventDefault();\n\n // Get plain text from clipboard\n const text = event.clipboardData?.getData('text/plain') || '';\n\n if (!text) return;\n\n // Insert plain text at cursor position\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) return;\n\n const range = selection.getRangeAt(0);\n range.deleteContents();\n\n // Insert text as text node (not HTML)\n const textNode = document.createTextNode(text);\n range.insertNode(textNode);\n\n // Move cursor to end of inserted text\n range.setStartAfter(textNode);\n range.collapse(true);\n selection.removeAllRanges();\n selection.addRange(range);\n\n // Trigger input event to update model\n this.OnInput();\n }\n\n /** @deprecated Use {@link OnPaste}. */\n onPaste(event: ClipboardEvent): void {\n return this.OnPaste(event);\n }\n\n /**\n * Handle keydown events\n */\n OnKeyDown(event: KeyboardEvent): void {\n // Enter alone: Send message. The dropdown only earns Enter when it has something to pick. A\n // button-opened menu stays open on an empty result set (so the press is not a silent no-op),\n // which made \"showing but empty\" reachable for the first time — and there Enter was neither\n // handled nor prevented, so it fell through to the contenteditable and inserted a newline\n // instead of sending.\n if (event.key === 'Enter' && !event.shiftKey && (!this.ShowMentionDropdown || this.MentionSuggestions.length === 0)) {\n event.preventDefault();\n if (this.ShowMentionDropdown) {\n this.CloseMentionDropdown();\n }\n const plainText = this.getPlainText();\n this.EnterPressed.emit(plainText);\n return;\n }\n\n // Backspace: Check if deleting a mention chip\n if (event.key === 'Backspace') {\n this.handleBackspace(event);\n }\n\n // Handle mention dropdown navigation\n if (this.ShowMentionDropdown) {\n // Let the dropdown handle arrow keys, enter, escape\n // (We'll pass these through to mention-dropdown component)\n }\n }\n\n /** @deprecated Use {@link OnKeyDown}. */\n onKeyDown(event: KeyboardEvent): void {\n return this.OnKeyDown(event);\n }\n\n /**\n * Handle mention/command trigger detection — finds the nearest active trigger char\n * before the cursor and kicks off the (async) provider suggestion fetch.\n */\n private handleMentionInput(): void {\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) return;\n\n const activeTriggers = this.mentionTriggers;\n if (activeTriggers.length === 0) {\n this.CloseMentionDropdown();\n return;\n }\n\n const range = selection.getRangeAt(0);\n const textBeforeCursor = this.getTextBeforeCursor(range);\n\n // Find the nearest active trigger char before the cursor — whichever is closest wins\n // A button-opened session only recognises trigger characters typed AFTER it opened. Without\n // this floor the scan runs over the whole message, so a URL ('.../docs'), an email ('a@b.io')\n // or a date ('9/11') already in the box is found instead, and the first keystroke either closes\n // the menu the button just opened or filters it by the wrong query. searchFrom is 0 on the\n // typed path, which leaves that path's behaviour byte-for-byte unchanged.\n const searchFrom = this.virtualTriggerOpen ? this.virtualTriggerBaseline : 0;\n let triggerIndex = -1;\n let triggerChar = '@';\n for (const t of activeTriggers) {\n const idx = textBeforeCursor.lastIndexOf(t);\n if (idx >= searchFrom && idx > triggerIndex) {\n triggerIndex = idx;\n triggerChar = t;\n }\n }\n\n if (triggerIndex === -1) {\n // A virtual trigger has no character in the text, so the search above finds nothing. Keep it\n // open and measure the query from where it opened, otherwise the first keystroke after\n // clicking the button would dismiss the list the button just produced.\n if (this.virtualTriggerOpen && textBeforeCursor.length >= this.virtualTriggerBaseline) {\n const query = textBeforeCursor.substring(this.virtualTriggerBaseline);\n if (!query.includes(' ')) {\n this.mentionQuery = query;\n void this.fetchSuggestions(this.activeTrigger, query);\n return;\n }\n }\n this.CloseMentionDropdown();\n return;\n }\n\n // Check if there's a space between the trigger and cursor (means mention was completed)\n const textAfterTrigger = textBeforeCursor.substring(triggerIndex + 1);\n if (textAfterTrigger.includes(' ')) {\n this.CloseMentionDropdown();\n return;\n }\n\n // A real trigger character now owns the session, so the virtual one must let go: otherwise\n // chip insertion still takes the virtual branch and deletes only the typed tail, orphaning the\n // trigger text, and the menu stays pinned to the button instead of the caret.\n if (this.virtualTriggerOpen) {\n this.virtualTriggerOpen = false;\n this.virtualTriggerBaseline = 0;\n this.virtualTriggerAnchor = null;\n this.MentionDropdownAlignRight = false;\n }\n\n // Extract query\n this.mentionQuery = textAfterTrigger;\n this.mentionStartIndex = triggerIndex;\n this.activeTrigger = triggerChar;\n\n // Fetch suggestions from the provider(s) owning this trigger (async, race-guarded)\n void this.fetchSuggestions(triggerChar, textAfterTrigger);\n }\n\n /**\n * Routes the suggestion request to every active provider whose TriggerChar matches,\n * concatenates their results in priority order, caps the merged list, and opens the\n * dropdown. A monotonic sequence drops stale responses when the user keeps typing.\n */\n private async fetchSuggestions(triggerChar: string, query: string): Promise<void> {\n const seq = ++this.suggestionRequestSeq;\n const providers = this.activeProviders.filter((p) => p.TriggerChar === triggerChar);\n\n const request: ComposerSuggestionRequest = {\n Query: query,\n MaxResults: MentionEditorComponent.maxSuggestions,\n ContextUser: this.CurrentUser ?? null,\n Provider: this.Provider\n };\n\n const resultSets = await Promise.all(\n providers.map((p) => p.GetSuggestions(request).catch(() => [] as MentionSuggestion[]))\n );\n\n if (seq !== this.suggestionRequestSeq) {\n return; // superseded by a newer keystroke or an explicit close\n }\n\n const merged = resultSets.flat().slice(0, MentionEditorComponent.maxSuggestions);\n this.MentionSuggestions = merged;\n\n if (merged.length > 0) {\n this.ShowMentionDropdown = true;\n this.positionMentionDropdown();\n } else if (this.virtualTriggerOpen) {\n // A button press must never be a silent no-op. Closing on empty results is right for a TYPED\n // trigger (the user is mid-word and nothing matched yet), but a host with zero skills clicking\n // the button would get no feedback at all and read it as broken. Staying open surfaces the\n // dropdown's own empty state, which was otherwise unreachable.\n this.ShowMentionDropdown = true;\n this.positionMentionDropdown();\n } else {\n this.CloseMentionDropdown();\n }\n this.cdr.detectChanges();\n }\n\n /**\n * Get text before cursor position\n */\n private getTextBeforeCursor(range: Range): string {\n const tempRange = range.cloneRange();\n tempRange.selectNodeContents(this.EditorRef.nativeElement);\n tempRange.setEnd(range.startContainer, range.startOffset);\n return tempRange.toString();\n }\n\n /**\n * Position the mention dropdown\n */\n private positionMentionDropdown(): void {\n const editor = this.EditorRef?.nativeElement;\n if (!editor) return;\n\n // Get the parent container (message-input-box-container) for alignment\n const container = editor.closest('.message-input-box-container');\n const containerRect = container?.getBoundingClientRect();\n\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) return;\n\n // A button-opened trigger anchors to the BUTTON, not the caret. On the typed path the user's\n // eyes and query are at the caret so the caret is right; on the button path nobody is looking at\n // the caret, they are looking at the control they just pressed. Sticky for the session (see\n // virtualTriggerAnchor) so filtering does not yank the menu to the caret on the first keystroke.\n if (this.virtualTriggerOpen && this.virtualTriggerAnchor) {\n this.positionToAnchor(this.virtualTriggerAnchor, containerRect);\n return;\n }\n\n const range = selection.getRangeAt(0);\n let cursorRect = range.getBoundingClientRect();\n\n // A collapsed range in an EMPTY editor measures 0x0 at 0,0 in every browser, which pinned the\n // dropdown to the bottom-left corner of the viewport and ran it off screen. Rare while typing\n // (there is text to measure) but the normal case when a BUTTON opens the trigger on an empty\n // composer. Fall back to the editor's own box so the menu lands over the composer either way.\n if (cursorRect.width === 0 && cursorRect.height === 0 && cursorRect.top === 0 && cursorRect.left === 0) {\n const editorRect = editor.getBoundingClientRect();\n cursorRect = editorRect as DOMRect;\n }\n\n // Check space below vs above\n const spaceBelow = window.innerHeight - cursorRect.bottom;\n const spaceAbove = cursorRect.top;\n const dropdownHeight = Math.min(this.MentionSuggestions.length * 56, 300);\n\n // Prefer ABOVE. The composer sits at the bottom of the chat, so a dropdown that grows downward\n // lands on top of the very text being typed. Below is the fallback for the rare host that\n // mounts the composer high in a tall viewport.\n this.MentionDropdownAlignRight = false;\n this.MentionDropdownShowAbove = spaceAbove >= dropdownHeight || spaceAbove > spaceBelow;\n\n if (this.MentionDropdownShowAbove) {\n // Position above, aligning with container top if possible\n this.MentionDropdownPosition = {\n top: (containerRect ? containerRect.top : cursorRect.top) + window.scrollY - 8,\n left: cursorRect.left + window.scrollX\n };\n } else {\n // Position below cursor, but align bottom edge with container top\n this.MentionDropdownPosition = {\n top: containerRect ? containerRect.top + window.scrollY : cursorRect.bottom + window.scrollY + 4,\n left: cursorRect.left + window.scrollX\n };\n }\n }\n\n\n /**\n * Right-align the dropdown above a trigger control, matching where the voice-options picker puts\n * its popover so two buttons in the same strip do not open menus on opposite corners.\n *\n * Right alignment is applied as a transform in CSS (`align-right`) rather than computed here,\n * because the dropdown's width is content-based; `left` is still clamped so no anchor position can\n * push it off the left edge on a narrow viewport.\n */\n private positionToAnchor(anchor: HTMLElement, containerRect: DOMRect | undefined): void {\n const GUTTER = 16;\n const rect = anchor.getBoundingClientRect();\n // The dropdown is rendered with `useFixedPositioning`, so `top`/`left` are VIEWPORT coordinates.\n // Never add window.scrollX/scrollY here — getBoundingClientRect is already viewport-relative, and\n // adding scroll converts to document coordinates, which under `position: fixed` drags the menu\n // off by exactly the scroll offset.\n\n // HORIZONTAL. Align the box's LEFT edge to the button's left edge and let it grow rightward.\n // Right-alignment is wrong for this control: the Skills button sits in `.attach-buttons` on the\n // LEFT of the composer, so pinning the box's right edge to the button's right edge sends a\n // 280-400px menu off the left of the screen, and clamping it back parks it over the middle of\n // the composer. Flip to right-aligned only when growing right would overflow the viewport,\n // which is what a menu anchored to a right-hand control needs.\n const assumedWidth = Math.min(400, window.innerWidth - GUTTER * 2);\n const overflowsRight = rect.left + assumedWidth > window.innerWidth - GUTTER;\n this.MentionDropdownAlignRight = overflowsRight;\n // align-right shifts the box back by its own width, so `left` is then its RIGHT edge; otherwise\n // `left` is its left edge. Clamp both forms inside the gutter.\n //\n // When flipping, align to the CONTAINER's right edge, not the button's. `.attach-buttons` is\n // pinned to the composer's bottom-right and Skills is the leftmost of five icons, so pinning the\n // box to that one button's right edge hangs its whole 400px body out to the left of the icon the\n // user pressed. Aligning to the composer instead puts the menu above the button cluster, which is\n // what \"above the button\" means when the menu is ten times the button's width.\n const flippedRightEdge = containerRect\n ? Math.min(containerRect.right, window.innerWidth - GUTTER)\n : Math.min(rect.right, window.innerWidth - GUTTER);\n const left = overflowsRight\n ? Math.max(assumedWidth + GUTTER, flippedRightEdge)\n : Math.min(Math.max(GUTTER, rect.left), window.innerWidth - GUTTER - assumedWidth);\n\n // VERTICAL. Prefer the composer's top edge so the menu clears the whole input box rather than\n // overlapping the text the user is composing; fall back to the button when there is no container.\n // Not unconditional: `show-above` lifts the box by its own height, so forcing it where there is\n // no room renders it off the top of the viewport where it cannot be reached.\n const anchorTop = containerRect ? containerRect.top : rect.top;\n const dropdownHeight = Math.min(Math.max(this.MentionSuggestions.length, 1) * 56, 300);\n // Prefer above, but when it does not fit, take whichever side has MORE room rather than\n // dropping below unconditionally — the composer is bottom-docked, so below is usually the worse\n // side. In a short viewport (a popped-out chat, or mobile with the keyboard up) that difference\n // is the whole menu versus a clipped sliver.\n const spaceBelow = window.innerHeight - rect.bottom;\n const showAbove = anchorTop >= dropdownHeight + GUTTER || anchorTop > spaceBelow;\n this.MentionDropdownShowAbove = showAbove;\n // Above: `top` is the box's BOTTOM edge (the transform lifts it). Below: it is the top edge.\n // Clamped either way, because dropdownHeight is an estimate (rows with descriptions run taller\n // than 56px) and an underestimate would otherwise clip the first row off the top of the screen.\n const rawTop = showAbove ? anchorTop - 8 : rect.bottom + 8;\n const top = showAbove\n ? Math.max(GUTTER + dropdownHeight, Math.min(rawTop, window.innerHeight - GUTTER))\n : Math.max(GUTTER, Math.min(rawTop, window.innerHeight - GUTTER - dropdownHeight));\n\n this.MentionDropdownPosition = { top, left };\n }\n\n /**\n * Handle mention selection from dropdown\n */\n OnMentionSelected(suggestion: MentionSuggestion): void {\n this.insertMentionChip(suggestion);\n this.CloseMentionDropdown();\n this.MentionSelected.emit(suggestion);\n\n // Refocus the editor after selection\n setTimeout(() => {\n this.EditorRef?.nativeElement?.focus();\n }, 50);\n }\n\n /** @deprecated Use {@link OnMentionSelected}. */\n onMentionSelected(suggestion: MentionSuggestion): void {\n return this.OnMentionSelected(suggestion);\n }\n\n /**\n * Insert a mention chip at the current cursor position\n */\n /**\n * Programmatically inserts a RESOLVED mention chip (+ a single trailing space) at\n * the END of the editor content and places the caret after it — the exact state a\n * user reaches by typing a trigger and picking from the dropdown. Unlike the\n * dropdown path this needs no active trigger context, so hosts can pre-address a\n * message (e.g. the omnibar's '@agent' flow staging a Sage pill) and leave the\n * user ready to type.\n *\n * @returns false when the editor view isn't mounted yet — callers may retry.\n */\n /** Focuses the editor and places the caret at the very end of its content. */\n public FocusCaretAtEnd(): boolean {\n const editor = this.EditorRef?.nativeElement;\n if (!editor) {\n return false;\n }\n editor.focus();\n const selection = window.getSelection();\n if (selection) {\n const range = document.createRange();\n range.selectNodeContents(editor);\n range.collapse(false);\n selection.removeAllRanges();\n selection.addRange(range);\n }\n return true;\n }\n\n /**\n * Open the suggestion dropdown for a trigger character, exactly as if the user had typed it.\n *\n * Exists so a trigger can have a BUTTON as well as a keystroke. `/` commands were previously\n * reachable only by knowing to type `/`, which is not an affordance — nothing on screen says the\n * feature is there.\n *\n * Deliberately inserts the character and re-runs the normal input path rather than opening the\n * dropdown directly. Everything downstream (which providers own the char, permission filtering,\n * the query the user then types, replacing the char with the chosen chip) is already driven by\n * that path; short-circuiting it would fork the flow and leave `mentionStartIndex` /\n * `activeTrigger` unset, so the first selection would insert in the wrong place.\n *\n * @returns false when the editor is disabled, unavailable, or no active provider owns the char.\n */\n public OpenTrigger(triggerChar: string, anchorEl?: HTMLElement | null): boolean {\n const editor = this.EditorRef?.nativeElement;\n if (!editor || this.Disabled) {\n return false;\n }\n if (!this.mentionTriggers.includes(triggerChar)) {\n return false;\n }\n if (!this.FocusCaretAtEnd()) {\n return false;\n }\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) {\n return false;\n }\n\n // NOTHING is written into the editor. An earlier version inserted the trigger character to\n // reuse the typed path, and cleaned it up on dismissal — but a character the user never typed,\n // appearing and then vanishing, is visible churn in their own message. The dropdown is opened\n // directly instead, and the character only ever exists as the chip the user chooses.\n this.virtualTriggerOpen = true;\n this.virtualTriggerAnchor = anchorEl ?? null;\n this.virtualTriggerBaseline = this.getTextBeforeCursor(selection.getRangeAt(0)).length;\n this.activeTrigger = triggerChar;\n this.mentionQuery = '';\n void this.fetchSuggestions(triggerChar, '');\n return true;\n }\n\n /**\n * True when the suggestion dropdown is open FOR THIS trigger character.\n *\n * Lets a control that opens a trigger render its own pressed state without duplicating the\n * editor's state. Both halves matter: `showMentionDropdown` alone would light the Skills button\n * while an unrelated `@` mention dropdown is open.\n */\n public IsTriggerOpen(triggerChar: string): boolean {\n // virtualTriggerOpen covers the window between the press and the provider's response. Reporting\n // \"closed\" there makes the second press of a quick double-click re-run the open path instead of\n // toggling, re-emitting the Before/After pair.\n return (this.ShowMentionDropdown || this.virtualTriggerOpen) && this.activeTrigger === triggerChar;\n }\n\n /** True when keyboard focus currently sits inside this editor. */\n public get HasFocus(): boolean {\n const editor = this.EditorRef?.nativeElement;\n return !!editor && (editor === document.activeElement || editor.contains(document.activeElement));\n }\n\n public InsertMention(suggestion: MentionSuggestion, focus: boolean = true): boolean {\n const editor = this.EditorRef?.nativeElement;\n if (!editor) {\n return false;\n }\n editor.focus();\n const selection = window.getSelection();\n if (!selection) {\n return false;\n }\n // Caret to the end of the current content, then chip + space + caret-after.\n const range = document.createRange();\n range.selectNodeContents(editor);\n range.collapse(false);\n const chip = this.createMentionChip(suggestion);\n range.insertNode(chip);\n const space = document.createTextNode(' ');\n range.setStartAfter(chip);\n range.collapse(true);\n range.insertNode(space);\n range.setStartAfter(space);\n range.collapse(true);\n selection.removeAllRanges();\n selection.addRange(range);\n if (!focus) {\n editor.blur();\n }\n this.OnInput();\n return true;\n }\n\n private insertMentionChip(suggestion: MentionSuggestion): void {\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) return;\n\n const range = selection.getRangeAt(0);\n\n // Delete the trigger + query text (use the active trigger char). A VIRTUAL trigger has no\n // character in the editor, so the span to remove is only what the user typed since it opened —\n // anchoring on the trigger char here would delete an unrelated earlier one, or nothing.\n const textBeforeCursor = this.getTextBeforeCursor(range);\n const deleteLength = this.virtualTriggerOpen\n ? Math.max(0, textBeforeCursor.length - this.virtualTriggerBaseline)\n : textBeforeCursor.length - textBeforeCursor.lastIndexOf(this.activeTrigger);\n\n if (deleteLength > 0) {\n range.setStart(range.startContainer, range.startOffset - deleteLength);\n range.deleteContents();\n }\n\n // Create mention chip element\n const chip = this.createMentionChip(suggestion);\n\n // Insert chip\n range.insertNode(chip);\n\n // Add space after chip\n const space = document.createTextNode(' ');\n range.collapse(false);\n range.insertNode(space);\n\n // Move cursor after the space\n range.setStartAfter(space);\n range.collapse(true);\n selection.removeAllRanges();\n selection.addRange(range);\n\n // Trigger change detection\n this.OnInput();\n }\n\n /**\n * Create a mention chip DOM element\n */\n private createMentionChip(suggestion: MentionSuggestion): HTMLSpanElement {\n const chip = document.createElement('span');\n chip.className = 'mention-chip';\n chip.contentEditable = 'false'; // Make chip non-editable\n chip.setAttribute('data-mention-id', suggestion.id);\n chip.setAttribute('data-mention-type', suggestion.type);\n chip.setAttribute('data-mention-name', suggestion.name);\n\n // Configuration presets ride along on the suggestion itself (supplied by the trigger\n // provider — e.g. the agent-mentions provider maps AI Agent Configuration presets in).\n // The composer has no knowledge of what a preset IS; it just stores the default's\n // ID/Name on the chip and offers a picker when there are 2+.\n const presets: MentionSuggestionPreset[] = suggestion.presets ?? [];\n if (presets.length > 0) {\n const defaultPreset = presets.find(p => p.IsDefault) || presets[0];\n if (defaultPreset) {\n chip.setAttribute('data-preset-id', defaultPreset.ID || '');\n chip.setAttribute('data-preset-name', defaultPreset.Name || '');\n }\n }\n\n // Apply inline styles directly — color by mention type. Skills carry their own accent Color\n // (AISkill.Color UX metadata); when present it drives the chip, otherwise the standard skill\n // green (--mj-status-success). Same color logic as the saved-message badge — keep in sync with\n // message-item's renderMentionHTML.\n const skillPalette = suggestion.type === 'skill'\n ? { bg: suggestion.color || 'var(--mj-status-success)', border: 'rgba(255, 255, 255, 0.35)' }\n : null;\n const palette =\n skillPalette\n ? skillPalette\n : suggestion.type === 'user'\n ? { bg: 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)', border: 'rgba(240, 147, 251, 0.4)' }\n : suggestion.type === 'entity'\n ? { bg: 'linear-gradient(135deg, #11998e 0%, #38ef7d 100%)', border: 'rgba(17, 153, 142, 0.4)' }\n : suggestion.type === 'query'\n ? { bg: 'linear-gradient(135deg, #FF6A00 0%, #FF9E2C 100%)', border: 'rgba(255, 106, 0, 0.4)' }\n : { bg: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', border: 'rgba(102, 126, 234, 0.4)' };\n // Skills render as a sharp-cornered rectangle (vs. the rounded pill for agents/users/entities)\n // — the shape is the at-a-glance differentiator. Same shape in the saved-message badge.\n const chipRadius = suggestion.type === 'skill' ? '4px' : '16px';\n chip.style.cssText = `\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 4px 12px;\n margin: 0 3px;\n border-radius: ${chipRadius};\n font-size: 13px;\n font-weight: 600;\n cursor: default;\n user-select: none;\n vertical-align: middle;\n white-space: nowrap;\n pointer-events: all;\n background: ${palette.bg};\n color: white;\n border: 2px solid ${palette.border};\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);\n `;\n\n // Add icon or image\n if (suggestion.type === 'agent' && suggestion.imageUrl) {\n // Use image if available (LogoURL from agent)\n const img = document.createElement('img');\n img.src = suggestion.imageUrl;\n img.alt = suggestion.displayName;\n img.style.cssText = 'width: 16px; height: 16px; border-radius: 50%; object-fit: cover;';\n chip.appendChild(img);\n } else if (suggestion.type === 'agent' && suggestion.icon === 'mj-icon-skip') {\n // Special handling for mj-icon-skip: use the SVG data URI as an image\n const img = document.createElement('img');\n img.src = \"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 101.89918457031249 96.83947368421053'%3E%3Cg transform='translate(-0.1288232421875,-0.0)'%3E%3Cpath d='M93.85,41.56c-.84,0-1.62.2-2.37.55-3-4.35-7.49-8.12-13.04-11.04l.04-7.18v-14.44h-10.24v17.6c-1.52-.43-3.07-.8-4.67-1.11V0h-10.24v24.72s-.09,0-.14,0h-4.38s-.1,0-.14,0V7.3h-10.24v18.62c-1.6.32-3.15.69-4.67,1.11v-11.67h-10.24v6.09l.04,9.6c-5.55,2.92-10.04,6.7-13.04,11.04-.75-.35-1.53-.55-2.37-.55-4.5,0-8.14,5.61-8.14,12.51s3.64,12.53,8.14,12.53c.58,0,1.14-.12,1.67-.29,4.1,6.62,11.54,12.06,20.98,15.28l.79.13v7.05c0,2.97,1.45,5.58,3.87,6.99,1.18.69,2.5,1.04,3.85,1.03,1.4,0,2.83-.37,4.15-1.12l7.54-4.29,7.56,4.3c1.31.74,2.73,1.12,4.13,1.12s2.67-.35,3.85-1.04c2.42-1.41,3.86-4.02,3.86-6.98v-7.05l.79-.13c9.44-3.22,16.89-8.66,20.98-15.28.54.17,1.09.29,1.68.29,4.5,0,8.14-5.61,8.14-12.53s-3.63-12.51-8.14-12.51' fill='%23AAAAAA'/%3E%3Cpath d='M86.69,50.87c0-12.22-13.6-19.1-28.94-20.66-4.48-.47-9.19-.54-13.52,0-15.34,1.53-28.93,8.41-28.93,20.66,0,8.55,5.7,15.55,12.68,15.55h7.94c3.05,2.5,6.93,4.1,11.08,4.71,2.65.4,5.44.46,8.01,0,4.15-.6,8.05-2.2,11.1-4.71h7.92c6.97,0,12.68-7,12.68-15.55' fill='white' opacity='0.9'/%3E%3Cpath d='M57.83,55.82c-1.19,2.58-3.8,4.35-6.84,4.35s-5.65-1.77-6.84-4.35h13.68Z' fill='%23AAAAAA'/%3E%3Cpath d='M32.52,41.14c1.74,0,3.18,2.13,3.18,4.76s-1.44,4.74-3.18,4.74-3.16-2.13-3.16-4.74,1.41-4.76,3.16-4.76' fill='%23AAAAAA'/%3E%3Cpath d='M69.46,41.14c1.74,0,3.16,2.13,3.16,4.76s-1.41,4.74-3.16,4.74-3.18-2.13-3.18-4.74,1.41-4.76,3.18-4.76' fill='%23AAAAAA'/%3E%3Cpath d='M63.91,76.15c-.82-.48-1.84-.43-2.8.12l-10.13,5.75-10.11-5.75c-.96-.55-1.98-.59-2.8-.12-.82.47-1.29,1.38-1.29,2.49v10.12c0,1.11.47,2.02,1.28,2.49.38.22.8.33,1.24.33.51,0,1.05-.15,1.57-.44l10.12-5.75,10.11,5.75c.52.29,1.05.44,1.56.44.44,0,.86-.11,1.24-.33.81-.48,1.28-1.38,1.28-2.49v-10.12c0-1.11-.47-2.02-1.28-2.49' fill='white' opacity='0.9'/%3E%3C/g%3E%3C/svg%3E\";\n img.alt = suggestion.displayName;\n img.style.cssText = 'width: 16px; height: 16px; border-radius: 50%; object-fit: cover;';\n chip.appendChild(img);\n } else {\n // Use icon for users or agents without images\n const icon = document.createElement('i');\n icon.style.cssText = 'font-size: 12px; opacity: 0.95;';\n if (suggestion.type === 'agent' && suggestion.icon) {\n icon.className = this.getIconClasses(suggestion.icon);\n } else if (suggestion.type === 'user') {\n icon.className = 'fa-solid fa-user';\n } else if (suggestion.type === 'entity') {\n icon.className = this.getIconClasses(suggestion.icon || 'fa-solid fa-table');\n } else if (suggestion.type === 'query') {\n icon.className = this.getIconClasses(suggestion.icon || 'fa-solid fa-database');\n } else if (suggestion.type === 'skill') {\n icon.className = this.getIconClasses(suggestion.icon || 'fa-solid fa-wand-magic-sparkles');\n } else {\n icon.className = 'fa-solid fa-robot';\n }\n chip.appendChild(icon);\n }\n\n // Add space between icon/image and text\n const space = document.createTextNode(' ');\n chip.appendChild(space);\n\n // Add text\n const text = document.createTextNode(suggestion.displayName);\n chip.appendChild(text);\n\n // Add dropdown when the suggestion carries 2+ presets\n if (presets.length >= 2) {\n this.addConfigurationDropdown(chip, presets);\n }\n\n return chip;\n }\n\n /**\n * Add configuration preset dropdown to a mention chip\n */\n private addConfigurationDropdown(chip: HTMLSpanElement, presets: MentionSuggestionPreset[]): void {\n // Store default preset for comparison\n const defaultPreset = presets.find(p => p.IsDefault) || presets[0];\n\n // Add preset indicator text (only shown when non-default selected)\n const presetIndicator = document.createElement('span');\n presetIndicator.className = 'preset-indicator';\n presetIndicator.style.cssText = `\n display: none;\n font-size: 10px;\n font-weight: 600;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;\n background: rgba(255, 255, 255, 0.25);\n padding: 2px 6px;\n border-radius: 4px;\n margin-left: 4px;\n letter-spacing: 0.3px;\n text-transform: uppercase;\n border: 1px solid rgba(255, 255, 255, 0.15);\n `;\n chip.appendChild(presetIndicator);\n\n // Add dropdown chevron button\n const chevron = document.createElement('i');\n chevron.className = 'fa-solid fa-chevron-down';\n chevron.style.cssText = `\n font-size: 10px;\n opacity: 0.9;\n cursor: pointer;\n padding: 2px;\n `;\n chip.appendChild(chevron);\n\n // Create dropdown menu (initially hidden) - append to body for global positioning\n const dropdown = document.createElement('div');\n dropdown.className = 'preset-dropdown';\n dropdown.style.cssText = `\n display: none;\n position: fixed;\n background: white;\n border: 1px solid #ddd;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n min-width: 200px;\n max-width: 300px;\n z-index: 10000;\n overflow: hidden;\n `;\n\n // Add preset options to dropdown\n presets.forEach(preset => {\n const option = document.createElement('div');\n option.className = 'preset-option';\n option.style.cssText = `\n padding: 10px 12px;\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: 8px;\n transition: background 0.2s;\n `;\n\n // Check if this is the selected preset\n const currentPresetId = chip.getAttribute('data-preset-id');\n const isSelected = UUIDsEqual(preset.ID, currentPresetId);\n\n // Add checkmark for selected option\n const checkmark = document.createElement('i');\n checkmark.className = 'fa-solid fa-check';\n checkmark.style.cssText = `\n font-size: 12px;\n color: #667eea;\n opacity: ${isSelected ? '1' : '0'};\n width: 14px;\n `;\n option.appendChild(checkmark);\n\n // Add preset text content\n const textContainer = document.createElement('div');\n textContainer.style.cssText = 'flex: 1;';\n\n const displayName = document.createElement('div');\n displayName.textContent = preset.DisplayName || preset.Name;\n displayName.style.cssText = `\n font-weight: 600;\n color: #333;\n font-size: 13px;\n `;\n textContainer.appendChild(displayName);\n\n if (preset.Description) {\n const description = document.createElement('div');\n description.textContent = preset.Description;\n description.style.cssText = `\n font-size: 11px;\n color: #666;\n margin-top: 2px;\n `;\n textContainer.appendChild(description);\n }\n\n option.appendChild(textContainer);\n\n // Hover effects\n option.addEventListener('mouseenter', () => {\n option.style.background = '#f5f5f5';\n });\n option.addEventListener('mouseleave', () => {\n option.style.background = 'white';\n });\n\n // Click handler to select preset\n option.addEventListener('click', (e) => {\n e.stopPropagation();\n\n // Update chip data attributes\n // IMPORTANT: Store preset.ID (AIAgentConfiguration.ID), not AIConfigurationID\n chip.setAttribute('data-preset-id', preset.ID || '');\n chip.setAttribute('data-preset-name', preset.Name || '');\n\n // Update preset indicator visibility and text\n const isDefault = UUIDsEqual(preset.ID, defaultPreset.ID);\n if (isDefault) {\n presetIndicator.style.display = 'none';\n } else {\n presetIndicator.style.display = 'inline';\n presetIndicator.textContent = preset.DisplayName || preset.Name;\n }\n\n // Update checkmarks\n dropdown.querySelectorAll('.preset-option').forEach((opt, idx) => {\n const check = opt.querySelector('i.fa-check') as HTMLElement;\n if (check) {\n check.style.opacity = idx === presets.indexOf(preset) ? '1' : '0';\n }\n });\n\n // Close dropdown\n dropdown.style.display = 'none';\n });\n\n dropdown.appendChild(option);\n });\n\n // Append dropdown to document body for global positioning\n document.body.appendChild(dropdown);\n\n // Helper function to position dropdown relative to chip\n const positionDropdown = () => {\n const chipRect = chip.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const spaceBelow = viewportHeight - chipRect.bottom;\n\n // Set left position (same for both above/below)\n dropdown.style.left = `${chipRect.left}px`;\n\n // First, show dropdown to measure its actual height\n const wasHidden = dropdown.style.display === 'none';\n if (wasHidden) {\n dropdown.style.visibility = 'hidden';\n dropdown.style.display = 'block';\n }\n\n const dropdownHeight = dropdown.offsetHeight;\n const spaceAbove = chipRect.top;\n\n // Position dropdown above chip if not enough space below\n if (spaceBelow < dropdownHeight && spaceAbove > spaceBelow) {\n // Show above - position so bottom of dropdown is 4px above top of chip\n dropdown.style.top = `${chipRect.top - dropdownHeight - 4}px`;\n } else {\n // Show below (default) - position 4px below bottom of chip\n dropdown.style.top = `${chipRect.bottom + 4}px`;\n }\n\n // Restore visibility\n if (wasHidden) {\n dropdown.style.visibility = 'visible';\n }\n };\n\n // Toggle dropdown on chevron click\n chevron.addEventListener('click', (e) => {\n e.stopPropagation();\n const isVisible = dropdown.style.display === 'block';\n\n if (isVisible) {\n dropdown.style.display = 'none';\n } else {\n positionDropdown();\n dropdown.style.display = 'block';\n }\n });\n\n // Close dropdown when clicking outside\n const closeDropdown = (e: MouseEvent) => {\n if (!dropdown.contains(e.target as Node) && !chip.contains(e.target as Node)) {\n dropdown.style.display = 'none';\n }\n };\n document.addEventListener('click', closeDropdown);\n\n // Cleanup: remove dropdown from body and event listeners when chip is removed\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n mutation.removedNodes.forEach((node) => {\n if (node === chip) {\n document.removeEventListener('click', closeDropdown);\n if (dropdown.parentNode) {\n dropdown.parentNode.removeChild(dropdown);\n }\n observer.disconnect();\n }\n });\n });\n });\n if (chip.parentNode) {\n observer.observe(chip.parentNode, { childList: true });\n }\n }\n\n /**\n * Get icon classes with proper FA prefix\n */\n private getIconClasses(iconClass: string): string {\n if (!iconClass) return 'fa-solid fa-robot';\n if (iconClass.includes('fa-')) {\n if (iconClass.match(/\\b(fa-solid|fa-regular|fa-light|fa-brands)\\b/)) {\n return iconClass;\n }\n return `fa-solid ${iconClass}`;\n }\n return iconClass;\n }\n\n /**\n * Handle backspace key - delete entire chip if cursor is right after one\n */\n private handleBackspace(event: KeyboardEvent): void {\n const selection = window.getSelection();\n if (!selection || selection.rangeCount === 0) return;\n\n const range = selection.getRangeAt(0);\n\n // Check if cursor is right after a mention chip\n if (range.collapsed && range.startOffset > 0) {\n const prevNode = range.startContainer.childNodes[range.startOffset - 1];\n\n if (prevNode && (prevNode as HTMLElement).classList?.contains('mention-chip')) {\n event.preventDefault();\n prevNode.remove();\n this.OnInput();\n }\n }\n }\n\n /**\n * Close mention dropdown\n */\n CloseMentionDropdown(): void {\n // No text cleanup: a virtual trigger never wrote anything into the editor, which is the whole\n // point of it. Dismissing leaves the message exactly as the user left it.\n this.virtualTriggerOpen = false;\n this.virtualTriggerBaseline = 0;\n this.virtualTriggerAnchor = null;\n this.MentionDropdownAlignRight = false;\n // Invalidate any in-flight suggestion fetch so a late response can't reopen the dropdown\n this.suggestionRequestSeq++;\n this.ShowMentionDropdown = false;\n this.MentionSuggestions = [];\n this.mentionStartIndex = -1;\n this.mentionQuery = '';\n this.activeTrigger = '@';\n }\n\n /** @deprecated Use {@link CloseMentionDropdown}. */\n closeMentionDropdown(): void {\n return this.CloseMentionDropdown();\n }\n\n /**\n * Convert editor HTML to plain text with @mentions\n */\n private getPlainText(): string {\n const editor = this.EditorRef?.nativeElement;\n if (!editor) return '';\n\n let text = '';\n const nodes = editor.childNodes;\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n\n if (node.nodeType === Node.TEXT_NODE) {\n text += node.textContent || '';\n } else if (node.nodeType === Node.ELEMENT_NODE) {\n const element = node as HTMLElement;\n\n if (element.classList.contains('mention-chip')) {\n const name = element.getAttribute('data-mention-name') || '';\n const mentionType = element.getAttribute('data-mention-type');\n const prefix = mentionType === 'entity' || mentionType === 'query' ? '#' : mentionType === 'skill' ? '/' : '@';\n // Use quoted format if name has spaces\n text += name.includes(' ') ? `${prefix}\"${name}\"` : `${prefix}${name}`;\n } else if (element.tagName === 'BR') {\n text += '\\n';\n } else if (element.tagName === 'DIV') {\n // Handle line breaks from contentEditable\n if (i > 0) text += '\\n';\n text += this.getNodeText(element);\n } else {\n text += element.textContent || '';\n }\n }\n }\n\n return text;\n }\n\n /**\n * Get text from a node recursively\n */\n private getNodeText(node: Node): string {\n let text = '';\n const children = node.childNodes;\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n\n if (child.nodeType === Node.TEXT_NODE) {\n text += child.textContent || '';\n } else if (child.nodeType === Node.ELEMENT_NODE) {\n const element = child as HTMLElement;\n\n if (element.classList.contains('mention-chip')) {\n const name = element.getAttribute('data-mention-name') || '';\n const mentionType = element.getAttribute('data-mention-type');\n const prefix = mentionType === 'entity' || mentionType === 'query' ? '#' : mentionType === 'skill' ? '/' : '@';\n text += name.includes(' ') ? `${prefix}\"${name}\"` : `${prefix}${name}`;\n } else {\n text += this.getNodeText(element);\n }\n }\n }\n\n return text;\n }\n\n /**\n * Set editor content from plain text (for programmatic updates)\n */\n /**\n * Renders a value into the editor, REHYDRATING any serialized mention tokens\n * (the `@{\"type\":…,\"id\":…,\"name\":…}` format produced by\n * {@link getPlainTextWithJsonMentions}) back into real chips — so persisted\n * drafts and any host-written serialized value round-trip losslessly. Plain\n * strings (no tokens) take the fast path.\n */\n private setEditorContent(text: string): void {\n const editor = this.EditorRef?.nativeElement;\n if (!editor) return;\n\n const segments = MentionEditorComponent.ParseSerializedMentions(text);\n if (segments.every((seg) => typeof seg === 'string')) {\n editor.textContent = text;\n return;\n }\n editor.textContent = '';\n for (const seg of segments) {\n if (typeof seg === 'string') {\n if (seg.length > 0) {\n editor.appendChild(document.createTextNode(seg));\n }\n } else {\n const chip = this.createMentionChip(seg.suggestion);\n if (seg.configId) {\n chip.setAttribute('data-preset-id', seg.configId);\n }\n if (seg.config) {\n chip.setAttribute('data-preset-name', seg.config);\n }\n editor.appendChild(chip);\n }\n }\n }\n\n /**\n * Splits text containing serialized mention tokens into plain-string segments and\n * parsed mention segments. Token = '@' followed by a JSON object with at least\n * {type,id,name}; brace matching is string-aware so names containing braces or\n * escaped quotes parse correctly. Malformed candidates stay as literal text.\n */\n public static ParseSerializedMentions(\n text: string\n ): Array<string | { suggestion: MentionSuggestion; configId?: string; config?: string }> {\n const segments: Array<string | { suggestion: MentionSuggestion; configId?: string; config?: string }> = [];\n let cursor = 0;\n let searchFrom = 0;\n while (true) {\n const start = text.indexOf('@{', searchFrom);\n if (start === -1) {\n break;\n }\n const end = MentionEditorComponent.findJsonEnd(text, start + 1);\n if (end === -1) {\n searchFrom = start + 2;\n continue;\n }\n const candidate = text.substring(start + 1, end + 1);\n let parsed: { type?: string; id?: string; name?: string; configId?: string; config?: string } | null = null;\n try {\n parsed = JSON.parse(candidate);\n } catch {\n parsed = null;\n }\n if (!parsed || typeof parsed.type !== 'string' || typeof parsed.id !== 'string' || typeof parsed.name !== 'string') {\n searchFrom = start + 2; // not a mention token — keep scanning past it\n continue;\n }\n if (start > cursor) {\n segments.push(text.substring(cursor, start));\n }\n segments.push({\n suggestion: { type: parsed.type, id: parsed.id, name: parsed.name, displayName: parsed.name },\n configId: parsed.configId,\n config: parsed.config,\n });\n cursor = end + 1;\n searchFrom = cursor;\n }\n if (cursor < text.length) {\n segments.push(text.substring(cursor));\n }\n if (segments.length === 0) {\n segments.push(text);\n }\n return segments;\n }\n\n /** Index of the matching closing brace for the object starting at `openIndex` ('{'), string-aware. -1 when unbalanced. */\n private static findJsonEnd(text: string, openIndex: number): number {\n let depth = 0;\n let inString = false;\n for (let i = openIndex; i < text.length; i++) {\n const ch = text[i];\n if (inString) {\n if (ch === '\\\\') {\n i++; // skip escaped char\n } else if (ch === '\"') {\n inString = false;\n }\n continue;\n }\n if (ch === '\"') {\n inString = true;\n } else if (ch === '{') {\n depth++;\n } else if (ch === '}') {\n depth--;\n if (depth === 0) {\n return i;\n }\n }\n }\n return -1;\n }\n\n // ControlValueAccessor implementation\n writeValue(value: string): void {\n const editor = this.EditorRef?.nativeElement;\n if (!editor) {\n // View not created yet — buffer the value; ngAfterViewInit applies it\n this.pendingWriteValue = value ?? '';\n return;\n }\n if (value) {\n this.setEditorContent(value);\n } else {\n editor.textContent = '';\n }\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.OnTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.Disabled = isDisabled;\n if (this.EditorRef?.nativeElement) {\n this.EditorRef.nativeElement.contentEditable = (!isDisabled).toString();\n }\n }\n\n /**\n * Focus the editor\n */\n public Focus(): void {\n this.EditorRef?.nativeElement?.focus();\n }\n\n /** @deprecated Use {@link Focus}. */\n public focus(): void {\n return this.Focus();\n }\n\n /**\n * Clear the editor content and pending attachments\n */\n public Clear(): void {\n if (this.EditorRef?.nativeElement) {\n this.EditorRef.nativeElement.textContent = '';\n this.OnInput();\n }\n this.ClearPendingAttachments();\n }\n\n /** @deprecated Use {@link Clear}. */\n public clear(): void {\n return this.Clear();\n }\n\n /**\n * Extract mention chips with their configuration data\n * Returns array of objects containing mention info and preset configuration\n */\n public GetMentionChipsData(): Array<{ id: string; type: string; name: string; presetId?: string; presetName?: string }> {\n const editor = this.EditorRef?.nativeElement;\n if (!editor) return [];\n\n const chips: Array<{ id: string; type: string; name: string; presetId?: string; presetName?: string }> = [];\n const mentionElements = editor.querySelectorAll('.mention-chip');\n\n mentionElements.forEach(chip => {\n const element = chip as HTMLElement;\n const id = element.getAttribute('data-mention-id') || '';\n const type = element.getAttribute('data-mention-type') || '';\n const name = element.getAttribute('data-mention-name') || '';\n const presetId = element.getAttribute('data-preset-id') || undefined;\n const presetName = element.getAttribute('data-preset-name') || undefined;\n\n chips.push({\n id,\n type,\n name,\n ...(presetId ? { presetId } : {}),\n ...(presetName ? { presetName } : {})\n });\n });\n\n return chips;\n }\n\n /** @deprecated Use {@link GetMentionChipsData}. */\n public getMentionChipsData(): Array<{ id: string; type: string; name: string; presetId?: string; presetName?: string }> {\n return this.GetMentionChipsData();\n }\n\n /**\n * Get the plain text value with mentions encoded as JSON\n * This format preserves configuration information when messages are saved\n * Format: @{type:\"agent\",id:\"uuid\",name:\"Agent Name\",configId:\"uuid\",config:\"High\"}\n */\n public GetPlainTextWithJsonMentions(): string {\n const editor = this.EditorRef?.nativeElement;\n if (!editor) return '';\n\n let plainText = '';\n const childNodes = Array.from(editor.childNodes);\n\n for (const node of childNodes) {\n if (node.nodeType === Node.TEXT_NODE) {\n // Regular text node\n plainText += node.textContent || '';\n } else if (node.nodeType === Node.ELEMENT_NODE) {\n const element = node as HTMLElement;\n\n if (element.classList.contains('mention-chip')) {\n // Extract mention data attributes\n const type = element.getAttribute('data-mention-type') || '';\n const id = element.getAttribute('data-mention-id') || '';\n const name = element.getAttribute('data-mention-name') || '';\n const presetId = element.getAttribute('data-preset-id');\n const presetName = element.getAttribute('data-preset-name');\n\n // Build JSON mention object (compact format - no spaces)\n const mentionObj: Record<string, string> = {\n type,\n id,\n name\n };\n\n // Add configuration fields if present (for agents with non-default presets)\n if (presetId) {\n mentionObj.configId = presetId;\n }\n if (presetName) {\n mentionObj.config = presetName;\n }\n\n // Encode as JSON mention\n // Don't remove spaces from the JSON string - spaces in values (like agent names) need to be preserved\n plainText += `@${JSON.stringify(mentionObj)}`;\n } else {\n // Other HTML element (e.g., <br>)\n if (element.tagName === 'BR') {\n plainText += '\\n';\n } else {\n plainText += element.textContent || '';\n }\n }\n }\n }\n\n return plainText;\n }\n\n /** @deprecated Use {@link GetPlainTextWithJsonMentions}. */\n public getPlainTextWithJsonMentions(): string {\n return this.GetPlainTextWithJsonMentions();\n }\n\n // ==================== Attachment Handling Methods ====================\n\n /**\n * Handle drag over event\n */\n OnDragOver(event: DragEvent): void {\n if (!this.EnableAttachments) return;\n\n event.preventDefault();\n event.stopPropagation();\n this.IsDragOver = true;\n }\n\n /** @deprecated Use {@link OnDragOver}. */\n onDragOver(event: DragEvent): void {\n return this.OnDragOver(event);\n }\n\n /**\n * Handle drag leave event\n */\n OnDragLeave(event: DragEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.IsDragOver = false;\n }\n\n /** @deprecated Use {@link OnDragLeave}. */\n onDragLeave(event: DragEvent): void {\n return this.OnDragLeave(event);\n }\n\n /**\n * Handle drop event\n */\n OnDrop(event: DragEvent): void {\n if (!this.EnableAttachments) return;\n\n event.preventDefault();\n event.stopPropagation();\n this.IsDragOver = false;\n\n if (event.dataTransfer?.files) {\n const files = Array.from(event.dataTransfer.files);\n for (const file of files) {\n if (this.isAcceptedFile(file)) {\n this.processFile(file);\n }\n }\n }\n }\n\n /** @deprecated Use {@link OnDrop}. */\n onDrop(event: DragEvent): void {\n return this.OnDrop(event);\n }\n\n /**\n * Handle file input change (from file picker)\n */\n OnFileSelected(event: Event): void {\n const input = event.target as HTMLInputElement;\n if (input.files) {\n const files = Array.from(input.files);\n for (const file of files) {\n this.processFile(file);\n }\n // Reset input so same file can be selected again\n input.value = '';\n }\n }\n\n /** @deprecated Use {@link OnFileSelected}. */\n onFileSelected(event: Event): void {\n return this.OnFileSelected(event);\n }\n\n /**\n * Process a file for attachment\n */\n private async processFile(file: File): Promise<void> {\n // Validate file\n const validation = this.validateFile(file);\n if (!validation.valid) {\n this.AttachmentError.emit(validation.error!);\n return;\n }\n\n // Read file as data URL\n const dataUrl = await this.readFileAsDataUrl(file);\n if (!dataUrl) {\n this.AttachmentError.emit('Failed to read file');\n return;\n }\n\n // Get image dimensions if applicable\n let width: number | undefined;\n let height: number | undefined;\n\n if (file.type.startsWith('image/')) {\n const dimensions = await this.getImageDimensions(dataUrl);\n width = dimensions.width;\n height = dimensions.height;\n }\n\n // Create pending attachment\n const attachment: PendingAttachment = {\n id: this.generateAttachmentId(),\n file,\n dataUrl,\n mimeType: file.type,\n fileName: file.name,\n sizeBytes: file.size,\n width,\n height,\n thumbnailUrl: file.type.startsWith('image/') ? dataUrl : undefined\n };\n\n // Add to pending attachments\n this.PendingAttachments.push(attachment);\n this.AttachmentsChanged.emit([...this.PendingAttachments]);\n this.cdr.detectChanges();\n }\n\n /**\n * Validate a file against settings\n */\n private validateFile(file: File): { valid: boolean; error?: string } {\n // Check count limit\n if (this.PendingAttachments.length >= this.MaxAttachments) {\n return {\n valid: false,\n error: `Maximum ${this.MaxAttachments} attachments allowed`\n };\n }\n\n // Check size limit\n if (file.size > this.MaxAttachmentSizeBytes) {\n const maxMB = (this.MaxAttachmentSizeBytes / (1024 * 1024)).toFixed(1);\n const fileMB = (file.size / (1024 * 1024)).toFixed(1);\n return {\n valid: false,\n error: `File size (${fileMB}MB) exceeds maximum (${maxMB}MB)`\n };\n }\n\n // Check file type\n if (!this.isAcceptedFile(file)) {\n return {\n valid: false,\n error: `File type ${file.type || 'unknown'} not accepted`\n };\n }\n\n return { valid: true };\n }\n\n /**\n * Check if file type is accepted\n */\n private isAcceptedFile(file: File): boolean {\n if (this.AcceptedFileTypes === '*' || this.AcceptedFileTypes === '*/*') {\n return true;\n }\n\n const acceptedTypes = this.AcceptedFileTypes.split(',').map(t => t.trim());\n\n for (const accepted of acceptedTypes) {\n // Handle universal wildcard */* anywhere in the list\n if (accepted === '*/*') {\n return true;\n }\n // Handle wildcard MIME types like \"image/*\"\n if (accepted.endsWith('/*')) {\n const category = accepted.slice(0, -2);\n if (file.type.startsWith(category + '/')) {\n return true;\n }\n } else if (accepted.startsWith('.')) {\n // Handle file extensions like \".png\"\n if (file.name.toLowerCase().endsWith(accepted.toLowerCase())) {\n return true;\n }\n } else if (file.type === accepted) {\n // Exact MIME type match\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Read file as data URL\n */\n private readFileAsDataUrl(file: File): Promise<string | null> {\n return new Promise((resolve) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = () => resolve(null);\n reader.readAsDataURL(file);\n });\n }\n\n /**\n * Get image dimensions\n */\n private getImageDimensions(dataUrl: string): Promise<{ width: number; height: number }> {\n return new Promise((resolve) => {\n const img = new Image();\n img.onload = () => {\n resolve({ width: img.naturalWidth, height: img.naturalHeight });\n };\n img.onerror = () => {\n resolve({ width: 0, height: 0 });\n };\n img.src = dataUrl;\n });\n }\n\n /**\n * Generate unique attachment ID\n */\n private generateAttachmentId(): string {\n return `att_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;\n }\n\n /**\n * Remove a pending attachment by ID\n */\n public RemoveAttachment(id: string): void {\n const index = this.PendingAttachments.findIndex(a => a.id === id);\n if (index !== -1) {\n this.PendingAttachments.splice(index, 1);\n this.AttachmentsChanged.emit([...this.PendingAttachments]);\n this.cdr.detectChanges();\n }\n }\n\n /** @deprecated Use {@link RemoveAttachment}. */\n public removeAttachment(id: string): void {\n return this.RemoveAttachment(id);\n }\n\n /**\n * Get all pending attachments\n */\n public GetPendingAttachments(): PendingAttachment[] {\n return [...this.PendingAttachments];\n }\n\n /** @deprecated Use {@link GetPendingAttachments}. */\n public getPendingAttachments(): PendingAttachment[] {\n return this.GetPendingAttachments();\n }\n\n /**\n * Add an artifact as a pending attachment programmatically.\n * Used by the artifact picker to attach artifacts as conversation inputs.\n */\n public AddArtifactAttachment(artifact: {\n fileID: string; fileName: string; mimeType: string;\n sizeBytes: number; artifactVersionId?: string;\n }): PendingAttachment {\n const attachment: PendingAttachment = {\n id: crypto.randomUUID(),\n file: null,\n dataUrl: '',\n mimeType: artifact.mimeType,\n fileName: artifact.fileName,\n sizeBytes: artifact.sizeBytes,\n fileID: artifact.fileID,\n source: 'artifact',\n artifactVersionId: artifact.artifactVersionId\n };\n this.PendingAttachments.push(attachment);\n this.AttachmentsChanged.emit([...this.PendingAttachments]);\n return attachment;\n }\n\n /**\n * Clear all pending attachments\n */\n public ClearPendingAttachments(): void {\n this.PendingAttachments = [];\n this.AttachmentsChanged.emit([]);\n this.cdr.detectChanges();\n }\n\n /** @deprecated Use {@link ClearPendingAttachments}. */\n public clearPendingAttachments(): void {\n return this.ClearPendingAttachments();\n }\n\n /**\n * Handle click on an attachment thumbnail\n */\n public OnAttachmentClick(attachment: PendingAttachment): void {\n this.AttachmentClicked.emit(attachment);\n }\n\n /** @deprecated Use {@link OnAttachmentClick}. */\n public onAttachmentClick(attachment: PendingAttachment): void {\n return this.OnAttachmentClick(attachment);\n }\n\n /**\n * Check if there are any pending attachments\n */\n public HasAttachments(): boolean {\n return this.PendingAttachments.length > 0;\n }\n\n /** @deprecated Use {@link HasAttachments}. */\n public hasAttachments(): boolean {\n return this.HasAttachments();\n }\n\n /**\n * Trigger file picker programmatically\n */\n public OpenFilePicker(): void {\n const input = document.createElement('input');\n input.type = 'file';\n // If */* is in the list, accept all files (some browsers don't handle */* correctly)\n input.accept = this.AcceptedFileTypes.includes('*/*') ? '' : this.AcceptedFileTypes;\n input.multiple = true;\n input.onchange = (e) => this.OnFileSelected(e);\n input.click();\n }\n\n /** @deprecated Use {@link OpenFilePicker}. */\n public openFilePicker(): void {\n return this.OpenFilePicker();\n }\n}\n","<div class=\"mention-editor-container\"\n [class.drag-over]=\"isDragOver\"\n (click)=\"onContainerClick($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\">\n\n <!-- Pending Attachments Preview -->\n @if (pendingAttachments.length > 0) {\n <div class=\"pending-attachments\">\n @for (attachment of pendingAttachments; track attachment) {\n <div class=\"attachment-thumbnail\"\n (click)=\"onAttachmentClick(attachment)\">\n @if (attachment.thumbnailUrl) {\n <img\n [src]=\"attachment.thumbnailUrl\"\n [alt]=\"attachment.fileName\"\n class=\"thumbnail-image\">\n }\n @if (!attachment.thumbnailUrl) {\n <div class=\"thumbnail-placeholder\">\n <i class=\"fa-solid fa-file\"></i>\n <span class=\"file-name\">{{ attachment.fileName }}</span>\n </div>\n }\n <button class=\"remove-attachment\"\n (click)=\"removeAttachment(attachment.id); $event.stopPropagation()\"\n title=\"Remove attachment\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n </div>\n }\n </div>\n }\n\n <div\n #editor\n class=\"mention-editor\"\n contenteditable=\"true\"\n [attr.contenteditable]=\"!disabled\"\n [attr.data-placeholder]=\"placeholder\"\n (input)=\"onInput()\"\n (keydown)=\"onKeyDown($event)\"\n (blur)=\"onBlur()\"\n (paste)=\"onPaste($event)\"\n ></div>\n\n <!-- Drag & Drop Overlay -->\n @if (isDragOver) {\n <div class=\"drop-overlay\">\n <div class=\"drop-message\">\n <i class=\"fa-solid fa-cloud-arrow-up\"></i>\n <span>Drop files here</span>\n </div>\n </div>\n }\n\n <!-- Mention Dropdown -->\n @if (showMentionDropdown && enableMentions) {\n <mj-mention-dropdown\n [suggestions]=\"mentionSuggestions\"\n [position]=\"mentionDropdownPosition\"\n [showAbove]=\"mentionDropdownShowAbove\"\n [alignRight]=\"mentionDropdownAlignRight\"\n [useFixedPositioning]=\"true\"\n [visible]=\"true\"\n (suggestionSelected)=\"onMentionSelected($event)\"\n (closed)=\"closeMentionDropdown()\">\n </mj-mention-dropdown>\n }\n</div>\n"]}