ngx-core-components 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/ai-chat/ai-chat.component.d.ts +31 -0
- package/ai/ai-chat/models.d.ts +36 -0
- package/ai/index.d.ts +5 -0
- package/ai/public-api.d.ts +2 -0
- package/charts/gantt-chart/gantt-chart.component.d.ts +30 -1
- package/charts/gantt-chart/models/gantt-config.model.d.ts +2 -0
- package/fesm2022/ngx-core-components-ai.mjs +496 -0
- package/fesm2022/ngx-core-components-ai.mjs.map +1 -0
- package/fesm2022/ngx-core-components-charts.mjs +221 -7
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
- package/fesm2022/ngx-core-components-inputs.mjs +72 -9
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
- package/fesm2022/ngx-core-components.mjs +1 -0
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/inputs/numeric-textbox/numeric-textbox.component.d.ts +9 -1
- package/inputs/textbox/textbox.component.d.ts +5 -1
- package/package.json +5 -1
- package/public-api.d.ts +2 -0
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, viewChild, effect, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from '@angular/forms';
|
|
6
|
+
import { FormsModule } from '@angular/forms';
|
|
7
|
+
|
|
8
|
+
class AIChatComponent {
|
|
9
|
+
messages = input([]);
|
|
10
|
+
agentName = input('AI Agent');
|
|
11
|
+
agentAvatarUrl = input('');
|
|
12
|
+
isOnline = input(true);
|
|
13
|
+
isTyping = input(false);
|
|
14
|
+
showSenderNames = input(false);
|
|
15
|
+
theme = input('light');
|
|
16
|
+
placeholder = input('Type a message...');
|
|
17
|
+
disabled = input(false);
|
|
18
|
+
quickReplies = input([]);
|
|
19
|
+
avatarBg = input('#4f46e5');
|
|
20
|
+
sendMessage = output();
|
|
21
|
+
quickReplyClick = output();
|
|
22
|
+
cardActionClick = output();
|
|
23
|
+
clearHistory = output();
|
|
24
|
+
chatBody = viewChild('chatBody');
|
|
25
|
+
inputText = '';
|
|
26
|
+
constructor() {
|
|
27
|
+
// Automatically scroll to bottom when messages or typing status changes
|
|
28
|
+
effect(() => {
|
|
29
|
+
this.messages();
|
|
30
|
+
this.isTyping();
|
|
31
|
+
this.scrollToBottom();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
onSubmit() {
|
|
35
|
+
const text = this.inputText.trim();
|
|
36
|
+
if (!text || this.disabled())
|
|
37
|
+
return;
|
|
38
|
+
this.sendMessage.emit(text);
|
|
39
|
+
this.inputText = '';
|
|
40
|
+
}
|
|
41
|
+
toggleStep(step) {
|
|
42
|
+
step.collapsed = !step.collapsed;
|
|
43
|
+
}
|
|
44
|
+
getCompletedStepsCount(steps) {
|
|
45
|
+
return steps.filter(s => s.status === 'success' || s.status === 'error').length;
|
|
46
|
+
}
|
|
47
|
+
getInitials(name) {
|
|
48
|
+
if (!name)
|
|
49
|
+
return 'AI';
|
|
50
|
+
const parts = name.split(' ');
|
|
51
|
+
if (parts.length >= 2) {
|
|
52
|
+
return (parts[0][0] + parts[1][0]).toUpperCase();
|
|
53
|
+
}
|
|
54
|
+
return name.slice(0, 2).toUpperCase();
|
|
55
|
+
}
|
|
56
|
+
scrollToBottom() {
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
const el = this.chatBody()?.nativeElement;
|
|
59
|
+
if (el) {
|
|
60
|
+
el.scrollTop = el.scrollHeight;
|
|
61
|
+
}
|
|
62
|
+
}, 100);
|
|
63
|
+
}
|
|
64
|
+
formatMessage(content) {
|
|
65
|
+
if (!content)
|
|
66
|
+
return '';
|
|
67
|
+
// Very basic escaping and formatting to keep it lightweight.
|
|
68
|
+
// In actual project, a custom template or markdown pipe can be used.
|
|
69
|
+
let formatted = content
|
|
70
|
+
.replace(/&/g, '&')
|
|
71
|
+
.replace(/</g, '<')
|
|
72
|
+
.replace(/>/g, '>');
|
|
73
|
+
// Bold markdown helper
|
|
74
|
+
formatted = formatted.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
|
|
75
|
+
// Code blocks helper
|
|
76
|
+
formatted = formatted.replace(/```(\w*)\n([\s\S]*?)```/g, (_, lang, code) => {
|
|
77
|
+
const language = lang || 'code';
|
|
78
|
+
return `
|
|
79
|
+
<div class="code-container" style="background: rgba(0,0,0,0.05); padding: 8px 12px; border-radius: 6px; font-family: monospace; font-size: 12px; margin: 8px 0; border-left: 3px solid #3b82f6; overflow-x: auto;">
|
|
80
|
+
<div style="font-size: 10px; font-weight: bold; opacity: 0.6; margin-bottom: 4px; text-transform: uppercase;">${language}</div>
|
|
81
|
+
<pre style="margin: 0; white-space: pre-wrap;"><code>${code.trim()}</code></pre>
|
|
82
|
+
</div>
|
|
83
|
+
`;
|
|
84
|
+
});
|
|
85
|
+
// Inline code helper
|
|
86
|
+
formatted = formatted.replace(/`(.*?)`/g, '<code style="background: rgba(0,0,0,0.06); padding: 2px 4px; border-radius: 4px; font-family: monospace; font-size: 12px;">$1</code>');
|
|
87
|
+
return formatted;
|
|
88
|
+
}
|
|
89
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIChatComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
90
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AIChatComponent, isStandalone: true, selector: "ngx-ai-chat", inputs: { messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, agentName: { classPropertyName: "agentName", publicName: "agentName", isSignal: true, isRequired: false, transformFunction: null }, agentAvatarUrl: { classPropertyName: "agentAvatarUrl", publicName: "agentAvatarUrl", isSignal: true, isRequired: false, transformFunction: null }, isOnline: { classPropertyName: "isOnline", publicName: "isOnline", isSignal: true, isRequired: false, transformFunction: null }, isTyping: { classPropertyName: "isTyping", publicName: "isTyping", isSignal: true, isRequired: false, transformFunction: null }, showSenderNames: { classPropertyName: "showSenderNames", publicName: "showSenderNames", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, quickReplies: { classPropertyName: "quickReplies", publicName: "quickReplies", isSignal: true, isRequired: false, transformFunction: null }, avatarBg: { classPropertyName: "avatarBg", publicName: "avatarBg", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sendMessage: "sendMessage", quickReplyClick: "quickReplyClick", cardActionClick: "cardActionClick", clearHistory: "clearHistory" }, viewQueries: [{ propertyName: "chatBody", first: true, predicate: ["chatBody"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
91
|
+
<div class="ngx-ai-chat-container" [class.dark-mode]="theme() === 'dark'">
|
|
92
|
+
<!-- Chat Header -->
|
|
93
|
+
<div class="ngx-ai-chat-header">
|
|
94
|
+
<div class="header-avatar" [style.background]="avatarBg()">
|
|
95
|
+
@if (agentAvatarUrl()) {
|
|
96
|
+
<img [src]="agentAvatarUrl()" [alt]="agentName()" />
|
|
97
|
+
} @else {
|
|
98
|
+
<span class="avatar-initials">{{ getInitials(agentName()) }}</span>
|
|
99
|
+
}
|
|
100
|
+
<span class="status-indicator" [class.online]="isOnline()"></span>
|
|
101
|
+
</div>
|
|
102
|
+
<div class="header-info">
|
|
103
|
+
<div class="agent-title">{{ agentName() }}</div>
|
|
104
|
+
<div class="agent-status">{{ isOnline() ? 'Active Now' : 'Offline' }}</div>
|
|
105
|
+
</div>
|
|
106
|
+
<div class="header-actions">
|
|
107
|
+
<button class="header-btn" (click)="clearHistory.emit()" title="Clear chat history">
|
|
108
|
+
<svg viewBox="0 0 24 24" class="svg-icon"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>
|
|
109
|
+
</button>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
<!-- Messages Thread -->
|
|
114
|
+
<div class="ngx-ai-chat-body" #chatBody>
|
|
115
|
+
<div class="messages-list">
|
|
116
|
+
@for (msg of messages(); track msg.id) {
|
|
117
|
+
<div class="message-wrapper" [class.user-msg]="msg.role === 'user'" [class.assistant-msg]="msg.role === 'assistant'">
|
|
118
|
+
<!-- Avatar -->
|
|
119
|
+
@if (msg.role !== 'user') {
|
|
120
|
+
<div class="msg-avatar" [style.background]="avatarBg()">
|
|
121
|
+
@if (msg.avatarUrl || agentAvatarUrl()) {
|
|
122
|
+
<img [src]="msg.avatarUrl || agentAvatarUrl()" [alt]="msg.senderName || agentName()" />
|
|
123
|
+
} @else {
|
|
124
|
+
<span>{{ getInitials(msg.senderName || agentName()) }}</span>
|
|
125
|
+
}
|
|
126
|
+
</div>
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
<!-- Content Area -->
|
|
130
|
+
<div class="msg-bubble-container">
|
|
131
|
+
<!-- Sender Name -->
|
|
132
|
+
@if (msg.role !== 'user' && showSenderNames()) {
|
|
133
|
+
<span class="msg-sender">{{ msg.senderName || agentName() }}</span>
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
<div class="msg-bubble">
|
|
137
|
+
<!-- Text Content -->
|
|
138
|
+
<div class="msg-text" [innerHTML]="formatMessage(msg.content)"></div>
|
|
139
|
+
|
|
140
|
+
<!-- Agent Steps (Accordion) -->
|
|
141
|
+
@if (msg.steps && msg.steps.length > 0) {
|
|
142
|
+
<div class="agent-steps-container">
|
|
143
|
+
<div class="steps-header">
|
|
144
|
+
<span class="steps-title-text">Execution Steps</span>
|
|
145
|
+
<span class="steps-badge">{{ getCompletedStepsCount(msg.steps) }}/{{ msg.steps.length }}</span>
|
|
146
|
+
</div>
|
|
147
|
+
<div class="steps-list">
|
|
148
|
+
@for (step of msg.steps; track step.id) {
|
|
149
|
+
<div class="agent-step-item" [class.step-error]="step.status === 'error'">
|
|
150
|
+
<div class="step-summary" (click)="toggleStep(step)">
|
|
151
|
+
<span class="step-status-icon" [class.running]="step.status === 'running'" [class.success]="step.status === 'success'" [class.error]="step.status === 'error'">
|
|
152
|
+
@if (step.status === 'running') {
|
|
153
|
+
<span class="spinner"></span>
|
|
154
|
+
} @else if (step.status === 'success') {
|
|
155
|
+
✓
|
|
156
|
+
} @else {
|
|
157
|
+
✕
|
|
158
|
+
}
|
|
159
|
+
</span>
|
|
160
|
+
<span class="step-name">{{ step.name }}</span>
|
|
161
|
+
@if (step.duration) {
|
|
162
|
+
<span class="step-duration">{{ step.duration }}</span>
|
|
163
|
+
}
|
|
164
|
+
<span class="step-chevron" [class.expanded]="!step.collapsed">▼</span>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
@if (!step.collapsed) {
|
|
168
|
+
<div class="step-details">
|
|
169
|
+
@if (step.input) {
|
|
170
|
+
<div class="step-detail-section">
|
|
171
|
+
<div class="detail-label">Input Parameters</div>
|
|
172
|
+
<pre class="detail-code"><code>{{ step.input }}</code></pre>
|
|
173
|
+
</div>
|
|
174
|
+
}
|
|
175
|
+
@if (step.output) {
|
|
176
|
+
<div class="step-detail-section">
|
|
177
|
+
<div class="detail-label">Output Result</div>
|
|
178
|
+
<pre class="detail-code"><code>{{ step.output }}</code></pre>
|
|
179
|
+
</div>
|
|
180
|
+
}
|
|
181
|
+
</div>
|
|
182
|
+
}
|
|
183
|
+
</div>
|
|
184
|
+
}
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
}
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<!-- Structured Cards (Carousel) -->
|
|
191
|
+
@if (msg.cards && msg.cards.length > 0) {
|
|
192
|
+
<div class="cards-carousel">
|
|
193
|
+
@for (card of msg.cards; track card.title) {
|
|
194
|
+
<div class="ai-carousel-card">
|
|
195
|
+
@if (card.imageUrl) {
|
|
196
|
+
<div class="card-img-container">
|
|
197
|
+
<img [src]="card.imageUrl" [alt]="card.title" />
|
|
198
|
+
</div>
|
|
199
|
+
}
|
|
200
|
+
<div class="card-body">
|
|
201
|
+
<h4 class="card-title">{{ card.title }}</h4>
|
|
202
|
+
@if (card.subtitle) {
|
|
203
|
+
<h5 class="card-subtitle">{{ card.subtitle }}</h5>
|
|
204
|
+
}
|
|
205
|
+
@if (card.description) {
|
|
206
|
+
<p class="card-description">{{ card.description }}</p>
|
|
207
|
+
}
|
|
208
|
+
@if (card.actions && card.actions.length > 0) {
|
|
209
|
+
<div class="card-actions">
|
|
210
|
+
@for (act of card.actions; track act.label) {
|
|
211
|
+
<button
|
|
212
|
+
class="card-action-btn"
|
|
213
|
+
[class.btn-primary]="act.variant === 'primary'"
|
|
214
|
+
(click)="cardActionClick.emit(act)"
|
|
215
|
+
>
|
|
216
|
+
{{ act.label }}
|
|
217
|
+
</button>
|
|
218
|
+
}
|
|
219
|
+
</div>
|
|
220
|
+
}
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
}
|
|
224
|
+
</div>
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
<!-- Time -->
|
|
228
|
+
<span class="msg-time">{{ msg.timestamp | date:'shortTime' }}</span>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
<!-- Typing Indicator -->
|
|
234
|
+
@if (isTyping()) {
|
|
235
|
+
<div class="message-wrapper assistant-msg">
|
|
236
|
+
<div class="msg-avatar" [style.background]="avatarBg()">
|
|
237
|
+
<span>{{ getInitials(agentName()) }}</span>
|
|
238
|
+
</div>
|
|
239
|
+
<div class="msg-bubble-container">
|
|
240
|
+
<div class="msg-bubble typing-bubble">
|
|
241
|
+
<div class="typing-indicator">
|
|
242
|
+
<span></span>
|
|
243
|
+
<span></span>
|
|
244
|
+
<span></span>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
}
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
|
|
253
|
+
<!-- Quick Replies -->
|
|
254
|
+
@if (quickReplies() && quickReplies().length > 0) {
|
|
255
|
+
<div class="quick-replies-container">
|
|
256
|
+
<div class="quick-replies-list">
|
|
257
|
+
@for (reply of quickReplies(); track reply.value) {
|
|
258
|
+
<button class="quick-reply-btn" (click)="quickReplyClick.emit(reply)">
|
|
259
|
+
@if (reply.icon) {
|
|
260
|
+
<span class="reply-icon">{{ reply.icon }}</span>
|
|
261
|
+
}
|
|
262
|
+
<span>{{ reply.label }}</span>
|
|
263
|
+
</button>
|
|
264
|
+
}
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
<!-- Chat Footer / Input -->
|
|
270
|
+
<div class="ngx-ai-chat-footer">
|
|
271
|
+
<form (ngSubmit)="onSubmit()" class="input-form">
|
|
272
|
+
<input
|
|
273
|
+
type="text"
|
|
274
|
+
class="chat-input"
|
|
275
|
+
[placeholder]="placeholder()"
|
|
276
|
+
[(ngModel)]="inputText"
|
|
277
|
+
name="messageText"
|
|
278
|
+
[disabled]="disabled()"
|
|
279
|
+
autocomplete="off"
|
|
280
|
+
/>
|
|
281
|
+
<button type="submit" class="send-btn" [disabled]="!inputText.trim() || disabled()" title="Send message">
|
|
282
|
+
<svg viewBox="0 0 24 24" class="svg-icon"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>
|
|
283
|
+
</button>
|
|
284
|
+
</form>
|
|
285
|
+
</div>
|
|
286
|
+
</div>
|
|
287
|
+
`, isInline: true, styles: [":host{display:block;height:100%;font-family:var(--ngx-font-family, system-ui, -apple-system, sans-serif)}.ngx-ai-chat-container{display:flex;flex-direction:column;height:100%;background:var(--ngx-ai-chat-bg, #ffffff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;box-shadow:0 4px 20px #0000000d;transition:all .3s ease}.ngx-ai-chat-container.dark-mode{--ngx-ai-chat-bg: #1e293b;--ngx-ai-chat-border: #334155;--ngx-ai-header-bg: #0f172a;--ngx-ai-header-text: #f8fafc;--ngx-ai-bubble-user-bg: #3b82f6;--ngx-ai-bubble-user-text: #ffffff;--ngx-ai-bubble-assistant-bg: #334155;--ngx-ai-bubble-assistant-text: #f8fafc;--ngx-ai-input-bg: #0f172a;--ngx-ai-input-text: #f8fafc;--ngx-ai-input-border: #334155}.ngx-ai-chat-header{display:flex;align-items:center;padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-ai-chat-border, #e2e8f0);gap:12px}.header-avatar{position:relative;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:14px}.header-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.status-indicator{position:absolute;bottom:0;right:0;width:10px;height:10px;border-radius:50%;background:#94a3b8;border:2px solid var(--ngx-ai-chat-bg, #fff)}.status-indicator.online{background:#10b981}.header-info{flex:1}.agent-title{font-weight:600;font-size:15px;color:var(--ngx-ai-header-text, #1e293b)}.agent-status{font-size:12px;color:#64748b}.header-actions{display:flex;gap:8px}.header-btn{background:none;border:none;padding:8px;border-radius:50%;cursor:pointer;color:#64748b;display:flex;align-items:center;justify-content:center;transition:background-color .2s}.header-btn:hover{background-color:#64748b1a}.svg-icon{width:20px;height:20px;fill:currentColor}.ngx-ai-chat-body{flex:1;overflow-y:auto;padding:16px 20px;display:flex;flex-direction:column}.messages-list{display:flex;flex-direction:column;gap:20px}.message-wrapper{display:flex;gap:12px;max-width:85%}.message-wrapper.user-msg{align-self:flex-end;flex-direction:row-reverse;max-width:75%}.message-wrapper.assistant-msg{align-self:flex-start}.msg-avatar{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:600;font-size:12px;flex-shrink:0}.msg-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.msg-bubble-container{display:flex;flex-direction:column;gap:4px}.user-msg .msg-bubble-container{align-items:flex-end}.msg-sender{font-size:11px;font-weight:600;color:#64748b;margin-left:4px}.msg-bubble{padding:12px 16px;border-radius:16px;font-size:14px;line-height:1.5;word-break:break-word}.user-msg .msg-bubble{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-text, #ffffff);border-bottom-right-radius:4px}.assistant-msg .msg-bubble{background:var(--ngx-ai-bubble-assistant-bg, #f1f5f9);color:var(--ngx-ai-bubble-assistant-text, #1e293b);border-bottom-left-radius:4px}.msg-text{white-space:pre-wrap}.msg-time{font-size:10px;color:#94a3b8;margin:0 4px}.agent-steps-container{margin-top:10px;border:1px solid rgba(148,163,184,.2);border-radius:8px;overflow:hidden;background:#ffffff0d}.steps-header{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:#94a3b81a;border-bottom:1px solid rgba(148,163,184,.1)}.steps-title-text{font-size:12px;font-weight:600;opacity:.8}.steps-badge{font-size:10px;font-weight:700;background:#94a3b833;padding:2px 6px;border-radius:10px}.steps-list{display:flex;flex-direction:column}.agent-step-item{border-bottom:1px solid rgba(148,163,184,.08)}.agent-step-item:last-child{border-bottom:none}.step-summary{display:flex;align-items:center;padding:8px 12px;cursor:pointer;font-size:12px;gap:8px;transition:background-color .2s}.step-summary:hover{background:#94a3b80d}.step-status-icon{width:16px;height:16px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff}.step-status-icon.success{background:#10b981}.step-status-icon.error{background:#ef4444}.step-status-icon.running{background:#3b82f6}.step-name{flex:1;font-weight:500}.step-duration{font-size:10px;opacity:.6}.step-chevron{font-size:8px;transition:transform .2s;opacity:.5}.step-chevron.expanded{transform:rotate(180deg)}.step-details{padding:8px 12px;background:#00000005;display:flex;flex-direction:column;gap:8px;border-top:1px solid rgba(148,163,184,.05)}.step-detail-section{display:flex;flex-direction:column;gap:4px}.detail-label{font-size:10px;font-weight:600;opacity:.6;text-transform:uppercase;letter-spacing:.3px}.detail-code{margin:0;padding:6px 10px;background:#0000000d;border-radius:4px;font-family:monospace;font-size:11px;overflow-x:auto;white-space:pre-wrap;max-height:120px}.cards-carousel{display:flex;gap:12px;overflow-x:auto;padding:10px 4px 6px;margin-top:8px;scroll-snap-type:x mandatory;scrollbar-width:thin}.cards-carousel::-webkit-scrollbar{height:6px}.cards-carousel::-webkit-scrollbar-thumb{background:#94a3b84d;border-radius:3px}.ai-carousel-card{flex:0 0 240px;background:var(--ngx-ai-chat-bg, #fff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;scroll-snap-align:start;box-shadow:0 2px 8px #0000000a}.card-img-container{height:120px;overflow:hidden}.card-img-container img{width:100%;height:100%;object-fit:cover}.card-body{padding:12px;display:flex;flex-direction:column;flex:1}.card-title{font-size:14px;font-weight:600;margin:0 0 2px}.card-subtitle{font-size:12px;font-weight:500;color:#64748b;margin:0 0 6px}.card-description{font-size:12px;color:#64748b;line-height:1.4;margin:0 0 12px;flex:1}.card-actions{display:flex;flex-direction:column;gap:6px}.card-action-btn{width:100%;padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:none;cursor:pointer;transition:all .2s}.card-action-btn.btn-primary{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border-color:transparent}.card-action-btn:hover{opacity:.9;transform:translateY(-1px)}.typing-bubble{display:flex;align-items:center;justify-content:center;padding:12px 20px}.typing-indicator{display:flex;gap:4px}.typing-indicator span{width:8px;height:8px;background:#94a3b8;border-radius:50%;animation:typing 1.4s infinite ease-in-out both}.typing-indicator span:nth-child(1){animation-delay:-.32s}.typing-indicator span:nth-child(2){animation-delay:-.16s}@keyframes typing{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.spinner{width:10px;height:10px;border:2px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#fff;animation:spin 1s ease-in-out infinite}@keyframes spin{to{transform:rotate(360deg)}}.quick-replies-container{padding:10px 16px 4px;background:transparent}.quick-replies-list{display:flex;gap:8px;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}.quick-replies-list::-webkit-scrollbar{display:none}.quick-reply-btn{flex:0 0 auto;padding:6px 14px;border-radius:18px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:var(--ngx-ai-chat-bg, #fff);font-size:13px;font-weight:500;color:#64748b;cursor:pointer;display:flex;align-items:center;gap:6px;transition:all .2s}.quick-reply-btn:hover{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-bg, #1a73e8);background-color:#1a73e80a}.ngx-ai-chat-footer{padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-top:1px solid var(--ngx-ai-chat-border, #e2e8f0)}.input-form{display:flex;gap:10px}.chat-input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid var(--ngx-ai-input-border, #cbd5e1);background:var(--ngx-ai-input-bg, #fff);color:var(--ngx-ai-input-text, #1e293b);font-size:14px;outline:none;transition:border-color .2s}.chat-input:focus{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8)}.send-btn{width:38px;height:38px;border-radius:8px;background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .2s,transform .1s}.send-btn:hover:not(:disabled){background-color:#1557b0;transform:translateY(-1px)}.send-btn:disabled{background-color:#94a3b8;cursor:not-allowed}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.DatePipe, name: "date" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
288
|
+
}
|
|
289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AIChatComponent, decorators: [{
|
|
290
|
+
type: Component,
|
|
291
|
+
args: [{ selector: 'ngx-ai-chat', standalone: true, imports: [CommonModule, FormsModule], template: `
|
|
292
|
+
<div class="ngx-ai-chat-container" [class.dark-mode]="theme() === 'dark'">
|
|
293
|
+
<!-- Chat Header -->
|
|
294
|
+
<div class="ngx-ai-chat-header">
|
|
295
|
+
<div class="header-avatar" [style.background]="avatarBg()">
|
|
296
|
+
@if (agentAvatarUrl()) {
|
|
297
|
+
<img [src]="agentAvatarUrl()" [alt]="agentName()" />
|
|
298
|
+
} @else {
|
|
299
|
+
<span class="avatar-initials">{{ getInitials(agentName()) }}</span>
|
|
300
|
+
}
|
|
301
|
+
<span class="status-indicator" [class.online]="isOnline()"></span>
|
|
302
|
+
</div>
|
|
303
|
+
<div class="header-info">
|
|
304
|
+
<div class="agent-title">{{ agentName() }}</div>
|
|
305
|
+
<div class="agent-status">{{ isOnline() ? 'Active Now' : 'Offline' }}</div>
|
|
306
|
+
</div>
|
|
307
|
+
<div class="header-actions">
|
|
308
|
+
<button class="header-btn" (click)="clearHistory.emit()" title="Clear chat history">
|
|
309
|
+
<svg viewBox="0 0 24 24" class="svg-icon"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>
|
|
310
|
+
</button>
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
<!-- Messages Thread -->
|
|
315
|
+
<div class="ngx-ai-chat-body" #chatBody>
|
|
316
|
+
<div class="messages-list">
|
|
317
|
+
@for (msg of messages(); track msg.id) {
|
|
318
|
+
<div class="message-wrapper" [class.user-msg]="msg.role === 'user'" [class.assistant-msg]="msg.role === 'assistant'">
|
|
319
|
+
<!-- Avatar -->
|
|
320
|
+
@if (msg.role !== 'user') {
|
|
321
|
+
<div class="msg-avatar" [style.background]="avatarBg()">
|
|
322
|
+
@if (msg.avatarUrl || agentAvatarUrl()) {
|
|
323
|
+
<img [src]="msg.avatarUrl || agentAvatarUrl()" [alt]="msg.senderName || agentName()" />
|
|
324
|
+
} @else {
|
|
325
|
+
<span>{{ getInitials(msg.senderName || agentName()) }}</span>
|
|
326
|
+
}
|
|
327
|
+
</div>
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
<!-- Content Area -->
|
|
331
|
+
<div class="msg-bubble-container">
|
|
332
|
+
<!-- Sender Name -->
|
|
333
|
+
@if (msg.role !== 'user' && showSenderNames()) {
|
|
334
|
+
<span class="msg-sender">{{ msg.senderName || agentName() }}</span>
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
<div class="msg-bubble">
|
|
338
|
+
<!-- Text Content -->
|
|
339
|
+
<div class="msg-text" [innerHTML]="formatMessage(msg.content)"></div>
|
|
340
|
+
|
|
341
|
+
<!-- Agent Steps (Accordion) -->
|
|
342
|
+
@if (msg.steps && msg.steps.length > 0) {
|
|
343
|
+
<div class="agent-steps-container">
|
|
344
|
+
<div class="steps-header">
|
|
345
|
+
<span class="steps-title-text">Execution Steps</span>
|
|
346
|
+
<span class="steps-badge">{{ getCompletedStepsCount(msg.steps) }}/{{ msg.steps.length }}</span>
|
|
347
|
+
</div>
|
|
348
|
+
<div class="steps-list">
|
|
349
|
+
@for (step of msg.steps; track step.id) {
|
|
350
|
+
<div class="agent-step-item" [class.step-error]="step.status === 'error'">
|
|
351
|
+
<div class="step-summary" (click)="toggleStep(step)">
|
|
352
|
+
<span class="step-status-icon" [class.running]="step.status === 'running'" [class.success]="step.status === 'success'" [class.error]="step.status === 'error'">
|
|
353
|
+
@if (step.status === 'running') {
|
|
354
|
+
<span class="spinner"></span>
|
|
355
|
+
} @else if (step.status === 'success') {
|
|
356
|
+
✓
|
|
357
|
+
} @else {
|
|
358
|
+
✕
|
|
359
|
+
}
|
|
360
|
+
</span>
|
|
361
|
+
<span class="step-name">{{ step.name }}</span>
|
|
362
|
+
@if (step.duration) {
|
|
363
|
+
<span class="step-duration">{{ step.duration }}</span>
|
|
364
|
+
}
|
|
365
|
+
<span class="step-chevron" [class.expanded]="!step.collapsed">▼</span>
|
|
366
|
+
</div>
|
|
367
|
+
|
|
368
|
+
@if (!step.collapsed) {
|
|
369
|
+
<div class="step-details">
|
|
370
|
+
@if (step.input) {
|
|
371
|
+
<div class="step-detail-section">
|
|
372
|
+
<div class="detail-label">Input Parameters</div>
|
|
373
|
+
<pre class="detail-code"><code>{{ step.input }}</code></pre>
|
|
374
|
+
</div>
|
|
375
|
+
}
|
|
376
|
+
@if (step.output) {
|
|
377
|
+
<div class="step-detail-section">
|
|
378
|
+
<div class="detail-label">Output Result</div>
|
|
379
|
+
<pre class="detail-code"><code>{{ step.output }}</code></pre>
|
|
380
|
+
</div>
|
|
381
|
+
}
|
|
382
|
+
</div>
|
|
383
|
+
}
|
|
384
|
+
</div>
|
|
385
|
+
}
|
|
386
|
+
</div>
|
|
387
|
+
</div>
|
|
388
|
+
}
|
|
389
|
+
</div>
|
|
390
|
+
|
|
391
|
+
<!-- Structured Cards (Carousel) -->
|
|
392
|
+
@if (msg.cards && msg.cards.length > 0) {
|
|
393
|
+
<div class="cards-carousel">
|
|
394
|
+
@for (card of msg.cards; track card.title) {
|
|
395
|
+
<div class="ai-carousel-card">
|
|
396
|
+
@if (card.imageUrl) {
|
|
397
|
+
<div class="card-img-container">
|
|
398
|
+
<img [src]="card.imageUrl" [alt]="card.title" />
|
|
399
|
+
</div>
|
|
400
|
+
}
|
|
401
|
+
<div class="card-body">
|
|
402
|
+
<h4 class="card-title">{{ card.title }}</h4>
|
|
403
|
+
@if (card.subtitle) {
|
|
404
|
+
<h5 class="card-subtitle">{{ card.subtitle }}</h5>
|
|
405
|
+
}
|
|
406
|
+
@if (card.description) {
|
|
407
|
+
<p class="card-description">{{ card.description }}</p>
|
|
408
|
+
}
|
|
409
|
+
@if (card.actions && card.actions.length > 0) {
|
|
410
|
+
<div class="card-actions">
|
|
411
|
+
@for (act of card.actions; track act.label) {
|
|
412
|
+
<button
|
|
413
|
+
class="card-action-btn"
|
|
414
|
+
[class.btn-primary]="act.variant === 'primary'"
|
|
415
|
+
(click)="cardActionClick.emit(act)"
|
|
416
|
+
>
|
|
417
|
+
{{ act.label }}
|
|
418
|
+
</button>
|
|
419
|
+
}
|
|
420
|
+
</div>
|
|
421
|
+
}
|
|
422
|
+
</div>
|
|
423
|
+
</div>
|
|
424
|
+
}
|
|
425
|
+
</div>
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
<!-- Time -->
|
|
429
|
+
<span class="msg-time">{{ msg.timestamp | date:'shortTime' }}</span>
|
|
430
|
+
</div>
|
|
431
|
+
</div>
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
<!-- Typing Indicator -->
|
|
435
|
+
@if (isTyping()) {
|
|
436
|
+
<div class="message-wrapper assistant-msg">
|
|
437
|
+
<div class="msg-avatar" [style.background]="avatarBg()">
|
|
438
|
+
<span>{{ getInitials(agentName()) }}</span>
|
|
439
|
+
</div>
|
|
440
|
+
<div class="msg-bubble-container">
|
|
441
|
+
<div class="msg-bubble typing-bubble">
|
|
442
|
+
<div class="typing-indicator">
|
|
443
|
+
<span></span>
|
|
444
|
+
<span></span>
|
|
445
|
+
<span></span>
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
</div>
|
|
449
|
+
</div>
|
|
450
|
+
}
|
|
451
|
+
</div>
|
|
452
|
+
</div>
|
|
453
|
+
|
|
454
|
+
<!-- Quick Replies -->
|
|
455
|
+
@if (quickReplies() && quickReplies().length > 0) {
|
|
456
|
+
<div class="quick-replies-container">
|
|
457
|
+
<div class="quick-replies-list">
|
|
458
|
+
@for (reply of quickReplies(); track reply.value) {
|
|
459
|
+
<button class="quick-reply-btn" (click)="quickReplyClick.emit(reply)">
|
|
460
|
+
@if (reply.icon) {
|
|
461
|
+
<span class="reply-icon">{{ reply.icon }}</span>
|
|
462
|
+
}
|
|
463
|
+
<span>{{ reply.label }}</span>
|
|
464
|
+
</button>
|
|
465
|
+
}
|
|
466
|
+
</div>
|
|
467
|
+
</div>
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
<!-- Chat Footer / Input -->
|
|
471
|
+
<div class="ngx-ai-chat-footer">
|
|
472
|
+
<form (ngSubmit)="onSubmit()" class="input-form">
|
|
473
|
+
<input
|
|
474
|
+
type="text"
|
|
475
|
+
class="chat-input"
|
|
476
|
+
[placeholder]="placeholder()"
|
|
477
|
+
[(ngModel)]="inputText"
|
|
478
|
+
name="messageText"
|
|
479
|
+
[disabled]="disabled()"
|
|
480
|
+
autocomplete="off"
|
|
481
|
+
/>
|
|
482
|
+
<button type="submit" class="send-btn" [disabled]="!inputText.trim() || disabled()" title="Send message">
|
|
483
|
+
<svg viewBox="0 0 24 24" class="svg-icon"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>
|
|
484
|
+
</button>
|
|
485
|
+
</form>
|
|
486
|
+
</div>
|
|
487
|
+
</div>
|
|
488
|
+
`, styles: [":host{display:block;height:100%;font-family:var(--ngx-font-family, system-ui, -apple-system, sans-serif)}.ngx-ai-chat-container{display:flex;flex-direction:column;height:100%;background:var(--ngx-ai-chat-bg, #ffffff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;box-shadow:0 4px 20px #0000000d;transition:all .3s ease}.ngx-ai-chat-container.dark-mode{--ngx-ai-chat-bg: #1e293b;--ngx-ai-chat-border: #334155;--ngx-ai-header-bg: #0f172a;--ngx-ai-header-text: #f8fafc;--ngx-ai-bubble-user-bg: #3b82f6;--ngx-ai-bubble-user-text: #ffffff;--ngx-ai-bubble-assistant-bg: #334155;--ngx-ai-bubble-assistant-text: #f8fafc;--ngx-ai-input-bg: #0f172a;--ngx-ai-input-text: #f8fafc;--ngx-ai-input-border: #334155}.ngx-ai-chat-header{display:flex;align-items:center;padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-ai-chat-border, #e2e8f0);gap:12px}.header-avatar{position:relative;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;color:#fff;font-size:14px}.header-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.status-indicator{position:absolute;bottom:0;right:0;width:10px;height:10px;border-radius:50%;background:#94a3b8;border:2px solid var(--ngx-ai-chat-bg, #fff)}.status-indicator.online{background:#10b981}.header-info{flex:1}.agent-title{font-weight:600;font-size:15px;color:var(--ngx-ai-header-text, #1e293b)}.agent-status{font-size:12px;color:#64748b}.header-actions{display:flex;gap:8px}.header-btn{background:none;border:none;padding:8px;border-radius:50%;cursor:pointer;color:#64748b;display:flex;align-items:center;justify-content:center;transition:background-color .2s}.header-btn:hover{background-color:#64748b1a}.svg-icon{width:20px;height:20px;fill:currentColor}.ngx-ai-chat-body{flex:1;overflow-y:auto;padding:16px 20px;display:flex;flex-direction:column}.messages-list{display:flex;flex-direction:column;gap:20px}.message-wrapper{display:flex;gap:12px;max-width:85%}.message-wrapper.user-msg{align-self:flex-end;flex-direction:row-reverse;max-width:75%}.message-wrapper.assistant-msg{align-self:flex-start}.msg-avatar{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:600;font-size:12px;flex-shrink:0}.msg-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.msg-bubble-container{display:flex;flex-direction:column;gap:4px}.user-msg .msg-bubble-container{align-items:flex-end}.msg-sender{font-size:11px;font-weight:600;color:#64748b;margin-left:4px}.msg-bubble{padding:12px 16px;border-radius:16px;font-size:14px;line-height:1.5;word-break:break-word}.user-msg .msg-bubble{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-text, #ffffff);border-bottom-right-radius:4px}.assistant-msg .msg-bubble{background:var(--ngx-ai-bubble-assistant-bg, #f1f5f9);color:var(--ngx-ai-bubble-assistant-text, #1e293b);border-bottom-left-radius:4px}.msg-text{white-space:pre-wrap}.msg-time{font-size:10px;color:#94a3b8;margin:0 4px}.agent-steps-container{margin-top:10px;border:1px solid rgba(148,163,184,.2);border-radius:8px;overflow:hidden;background:#ffffff0d}.steps-header{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:#94a3b81a;border-bottom:1px solid rgba(148,163,184,.1)}.steps-title-text{font-size:12px;font-weight:600;opacity:.8}.steps-badge{font-size:10px;font-weight:700;background:#94a3b833;padding:2px 6px;border-radius:10px}.steps-list{display:flex;flex-direction:column}.agent-step-item{border-bottom:1px solid rgba(148,163,184,.08)}.agent-step-item:last-child{border-bottom:none}.step-summary{display:flex;align-items:center;padding:8px 12px;cursor:pointer;font-size:12px;gap:8px;transition:background-color .2s}.step-summary:hover{background:#94a3b80d}.step-status-icon{width:16px;height:16px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff}.step-status-icon.success{background:#10b981}.step-status-icon.error{background:#ef4444}.step-status-icon.running{background:#3b82f6}.step-name{flex:1;font-weight:500}.step-duration{font-size:10px;opacity:.6}.step-chevron{font-size:8px;transition:transform .2s;opacity:.5}.step-chevron.expanded{transform:rotate(180deg)}.step-details{padding:8px 12px;background:#00000005;display:flex;flex-direction:column;gap:8px;border-top:1px solid rgba(148,163,184,.05)}.step-detail-section{display:flex;flex-direction:column;gap:4px}.detail-label{font-size:10px;font-weight:600;opacity:.6;text-transform:uppercase;letter-spacing:.3px}.detail-code{margin:0;padding:6px 10px;background:#0000000d;border-radius:4px;font-family:monospace;font-size:11px;overflow-x:auto;white-space:pre-wrap;max-height:120px}.cards-carousel{display:flex;gap:12px;overflow-x:auto;padding:10px 4px 6px;margin-top:8px;scroll-snap-type:x mandatory;scrollbar-width:thin}.cards-carousel::-webkit-scrollbar{height:6px}.cards-carousel::-webkit-scrollbar-thumb{background:#94a3b84d;border-radius:3px}.ai-carousel-card{flex:0 0 240px;background:var(--ngx-ai-chat-bg, #fff);border:1px solid var(--ngx-ai-chat-border, #e2e8f0);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;scroll-snap-align:start;box-shadow:0 2px 8px #0000000a}.card-img-container{height:120px;overflow:hidden}.card-img-container img{width:100%;height:100%;object-fit:cover}.card-body{padding:12px;display:flex;flex-direction:column;flex:1}.card-title{font-size:14px;font-weight:600;margin:0 0 2px}.card-subtitle{font-size:12px;font-weight:500;color:#64748b;margin:0 0 6px}.card-description{font-size:12px;color:#64748b;line-height:1.4;margin:0 0 12px;flex:1}.card-actions{display:flex;flex-direction:column;gap:6px}.card-action-btn{width:100%;padding:6px 12px;font-size:12px;font-weight:600;border-radius:6px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:none;cursor:pointer;transition:all .2s}.card-action-btn.btn-primary{background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border-color:transparent}.card-action-btn:hover{opacity:.9;transform:translateY(-1px)}.typing-bubble{display:flex;align-items:center;justify-content:center;padding:12px 20px}.typing-indicator{display:flex;gap:4px}.typing-indicator span{width:8px;height:8px;background:#94a3b8;border-radius:50%;animation:typing 1.4s infinite ease-in-out both}.typing-indicator span:nth-child(1){animation-delay:-.32s}.typing-indicator span:nth-child(2){animation-delay:-.16s}@keyframes typing{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}.spinner{width:10px;height:10px;border:2px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#fff;animation:spin 1s ease-in-out infinite}@keyframes spin{to{transform:rotate(360deg)}}.quick-replies-container{padding:10px 16px 4px;background:transparent}.quick-replies-list{display:flex;gap:8px;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}.quick-replies-list::-webkit-scrollbar{display:none}.quick-reply-btn{flex:0 0 auto;padding:6px 14px;border-radius:18px;border:1px solid var(--ngx-ai-chat-border, #e2e8f0);background:var(--ngx-ai-chat-bg, #fff);font-size:13px;font-weight:500;color:#64748b;cursor:pointer;display:flex;align-items:center;gap:6px;transition:all .2s}.quick-reply-btn:hover{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8);color:var(--ngx-ai-bubble-user-bg, #1a73e8);background-color:#1a73e80a}.ngx-ai-chat-footer{padding:14px 18px;background:var(--ngx-ai-header-bg, #f8fafc);border-top:1px solid var(--ngx-ai-chat-border, #e2e8f0)}.input-form{display:flex;gap:10px}.chat-input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid var(--ngx-ai-input-border, #cbd5e1);background:var(--ngx-ai-input-bg, #fff);color:var(--ngx-ai-input-text, #1e293b);font-size:14px;outline:none;transition:border-color .2s}.chat-input:focus{border-color:var(--ngx-ai-bubble-user-bg, #1a73e8)}.send-btn{width:38px;height:38px;border-radius:8px;background:var(--ngx-ai-bubble-user-bg, #1a73e8);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .2s,transform .1s}.send-btn:hover:not(:disabled){background-color:#1557b0;transform:translateY(-1px)}.send-btn:disabled{background-color:#94a3b8;cursor:not-allowed}\n"] }]
|
|
489
|
+
}], ctorParameters: () => [] });
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Generated bundle index. Do not edit.
|
|
493
|
+
*/
|
|
494
|
+
|
|
495
|
+
export { AIChatComponent };
|
|
496
|
+
//# sourceMappingURL=ngx-core-components-ai.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-core-components-ai.mjs","sources":["../../../projects/ngx-core-components/ai/ai-chat/ai-chat.component.ts","../../../projects/ngx-core-components/ai/ngx-core-components-ai.ts"],"sourcesContent":["import { Component, input, output, model, viewChild, ElementRef, computed, effect } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { AIMessage, AgentStep, AICard, AICardAction, QuickReply } from './models';\n\n@Component({\n selector: 'ngx-ai-chat',\n standalone: true,\n imports: [CommonModule, FormsModule],\n template: `\n <div class=\"ngx-ai-chat-container\" [class.dark-mode]=\"theme() === 'dark'\">\n <!-- Chat Header -->\n <div class=\"ngx-ai-chat-header\">\n <div class=\"header-avatar\" [style.background]=\"avatarBg()\">\n @if (agentAvatarUrl()) {\n <img [src]=\"agentAvatarUrl()\" [alt]=\"agentName()\" />\n } @else {\n <span class=\"avatar-initials\">{{ getInitials(agentName()) }}</span>\n }\n <span class=\"status-indicator\" [class.online]=\"isOnline()\"></span>\n </div>\n <div class=\"header-info\">\n <div class=\"agent-title\">{{ agentName() }}</div>\n <div class=\"agent-status\">{{ isOnline() ? 'Active Now' : 'Offline' }}</div>\n </div>\n <div class=\"header-actions\">\n <button class=\"header-btn\" (click)=\"clearHistory.emit()\" title=\"Clear chat history\">\n <svg viewBox=\"0 0 24 24\" class=\"svg-icon\"><path d=\"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z\"/></svg>\n </button>\n </div>\n </div>\n\n <!-- Messages Thread -->\n <div class=\"ngx-ai-chat-body\" #chatBody>\n <div class=\"messages-list\">\n @for (msg of messages(); track msg.id) {\n <div class=\"message-wrapper\" [class.user-msg]=\"msg.role === 'user'\" [class.assistant-msg]=\"msg.role === 'assistant'\">\n <!-- Avatar -->\n @if (msg.role !== 'user') {\n <div class=\"msg-avatar\" [style.background]=\"avatarBg()\">\n @if (msg.avatarUrl || agentAvatarUrl()) {\n <img [src]=\"msg.avatarUrl || agentAvatarUrl()\" [alt]=\"msg.senderName || agentName()\" />\n } @else {\n <span>{{ getInitials(msg.senderName || agentName()) }}</span>\n }\n </div>\n }\n\n <!-- Content Area -->\n <div class=\"msg-bubble-container\">\n <!-- Sender Name -->\n @if (msg.role !== 'user' && showSenderNames()) {\n <span class=\"msg-sender\">{{ msg.senderName || agentName() }}</span>\n }\n\n <div class=\"msg-bubble\">\n <!-- Text Content -->\n <div class=\"msg-text\" [innerHTML]=\"formatMessage(msg.content)\"></div>\n\n <!-- Agent Steps (Accordion) -->\n @if (msg.steps && msg.steps.length > 0) {\n <div class=\"agent-steps-container\">\n <div class=\"steps-header\">\n <span class=\"steps-title-text\">Execution Steps</span>\n <span class=\"steps-badge\">{{ getCompletedStepsCount(msg.steps) }}/{{ msg.steps.length }}</span>\n </div>\n <div class=\"steps-list\">\n @for (step of msg.steps; track step.id) {\n <div class=\"agent-step-item\" [class.step-error]=\"step.status === 'error'\">\n <div class=\"step-summary\" (click)=\"toggleStep(step)\">\n <span class=\"step-status-icon\" [class.running]=\"step.status === 'running'\" [class.success]=\"step.status === 'success'\" [class.error]=\"step.status === 'error'\">\n @if (step.status === 'running') {\n <span class=\"spinner\"></span>\n } @else if (step.status === 'success') {\n ✓\n } @else {\n ✕\n }\n </span>\n <span class=\"step-name\">{{ step.name }}</span>\n @if (step.duration) {\n <span class=\"step-duration\">{{ step.duration }}</span>\n }\n <span class=\"step-chevron\" [class.expanded]=\"!step.collapsed\">▼</span>\n </div>\n\n @if (!step.collapsed) {\n <div class=\"step-details\">\n @if (step.input) {\n <div class=\"step-detail-section\">\n <div class=\"detail-label\">Input Parameters</div>\n <pre class=\"detail-code\"><code>{{ step.input }}</code></pre>\n </div>\n }\n @if (step.output) {\n <div class=\"step-detail-section\">\n <div class=\"detail-label\">Output Result</div>\n <pre class=\"detail-code\"><code>{{ step.output }}</code></pre>\n </div>\n }\n </div>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n\n <!-- Structured Cards (Carousel) -->\n @if (msg.cards && msg.cards.length > 0) {\n <div class=\"cards-carousel\">\n @for (card of msg.cards; track card.title) {\n <div class=\"ai-carousel-card\">\n @if (card.imageUrl) {\n <div class=\"card-img-container\">\n <img [src]=\"card.imageUrl\" [alt]=\"card.title\" />\n </div>\n }\n <div class=\"card-body\">\n <h4 class=\"card-title\">{{ card.title }}</h4>\n @if (card.subtitle) {\n <h5 class=\"card-subtitle\">{{ card.subtitle }}</h5>\n }\n @if (card.description) {\n <p class=\"card-description\">{{ card.description }}</p>\n }\n @if (card.actions && card.actions.length > 0) {\n <div class=\"card-actions\">\n @for (act of card.actions; track act.label) {\n <button\n class=\"card-action-btn\"\n [class.btn-primary]=\"act.variant === 'primary'\"\n (click)=\"cardActionClick.emit(act)\"\n >\n {{ act.label }}\n </button>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n }\n\n <!-- Time -->\n <span class=\"msg-time\">{{ msg.timestamp | date:'shortTime' }}</span>\n </div>\n </div>\n }\n\n <!-- Typing Indicator -->\n @if (isTyping()) {\n <div class=\"message-wrapper assistant-msg\">\n <div class=\"msg-avatar\" [style.background]=\"avatarBg()\">\n <span>{{ getInitials(agentName()) }}</span>\n </div>\n <div class=\"msg-bubble-container\">\n <div class=\"msg-bubble typing-bubble\">\n <div class=\"typing-indicator\">\n <span></span>\n <span></span>\n <span></span>\n </div>\n </div>\n </div>\n </div>\n }\n </div>\n </div>\n\n <!-- Quick Replies -->\n @if (quickReplies() && quickReplies().length > 0) {\n <div class=\"quick-replies-container\">\n <div class=\"quick-replies-list\">\n @for (reply of quickReplies(); track reply.value) {\n <button class=\"quick-reply-btn\" (click)=\"quickReplyClick.emit(reply)\">\n @if (reply.icon) {\n <span class=\"reply-icon\">{{ reply.icon }}</span>\n }\n <span>{{ reply.label }}</span>\n </button>\n }\n </div>\n </div>\n }\n\n <!-- Chat Footer / Input -->\n <div class=\"ngx-ai-chat-footer\">\n <form (ngSubmit)=\"onSubmit()\" class=\"input-form\">\n <input\n type=\"text\"\n class=\"chat-input\"\n [placeholder]=\"placeholder()\"\n [(ngModel)]=\"inputText\"\n name=\"messageText\"\n [disabled]=\"disabled()\"\n autocomplete=\"off\"\n />\n <button type=\"submit\" class=\"send-btn\" [disabled]=\"!inputText.trim() || disabled()\" title=\"Send message\">\n <svg viewBox=\"0 0 24 24\" class=\"svg-icon\"><path d=\"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z\"/></svg>\n </button>\n </form>\n </div>\n </div>\n `,\n styles: [`\n :host {\n display: block;\n height: 100%;\n font-family: var(--ngx-font-family, system-ui, -apple-system, sans-serif);\n }\n\n .ngx-ai-chat-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n background: var(--ngx-ai-chat-bg, #ffffff);\n border: 1px solid var(--ngx-ai-chat-border, #e2e8f0);\n border-radius: 12px;\n overflow: hidden;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);\n transition: all 0.3s ease;\n }\n\n .ngx-ai-chat-container.dark-mode {\n --ngx-ai-chat-bg: #1e293b;\n --ngx-ai-chat-border: #334155;\n --ngx-ai-header-bg: #0f172a;\n --ngx-ai-header-text: #f8fafc;\n --ngx-ai-bubble-user-bg: #3b82f6;\n --ngx-ai-bubble-user-text: #ffffff;\n --ngx-ai-bubble-assistant-bg: #334155;\n --ngx-ai-bubble-assistant-text: #f8fafc;\n --ngx-ai-input-bg: #0f172a;\n --ngx-ai-input-text: #f8fafc;\n --ngx-ai-input-border: #334155;\n }\n\n /* Header */\n .ngx-ai-chat-header {\n display: flex;\n align-items: center;\n padding: 14px 18px;\n background: var(--ngx-ai-header-bg, #f8fafc);\n border-bottom: 1px solid var(--ngx-ai-chat-border, #e2e8f0);\n gap: 12px;\n }\n\n .header-avatar {\n position: relative;\n width: 40px;\n height: 40px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: 700;\n color: #fff;\n font-size: 14px;\n }\n\n .header-avatar img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: 50%;\n }\n\n .status-indicator {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: #94a3b8;\n border: 2px solid var(--ngx-ai-chat-bg, #fff);\n }\n\n .status-indicator.online {\n background: #10b981;\n }\n\n .header-info {\n flex: 1;\n }\n\n .agent-title {\n font-weight: 600;\n font-size: 15px;\n color: var(--ngx-ai-header-text, #1e293b);\n }\n\n .agent-status {\n font-size: 12px;\n color: #64748b;\n }\n\n .header-actions {\n display: flex;\n gap: 8px;\n }\n\n .header-btn {\n background: none;\n border: none;\n padding: 8px;\n border-radius: 50%;\n cursor: pointer;\n color: #64748b;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background-color 0.2s;\n }\n\n .header-btn:hover {\n background-color: rgba(100, 116, 139, 0.1);\n }\n\n .svg-icon {\n width: 20px;\n height: 20px;\n fill: currentColor;\n }\n\n /* Chat Body */\n .ngx-ai-chat-body {\n flex: 1;\n overflow-y: auto;\n padding: 16px 20px;\n display: flex;\n flex-direction: column;\n }\n\n .messages-list {\n display: flex;\n flex-direction: column;\n gap: 20px;\n }\n\n .message-wrapper {\n display: flex;\n gap: 12px;\n max-width: 85%;\n }\n\n .message-wrapper.user-msg {\n align-self: flex-end;\n flex-direction: row-reverse;\n max-width: 75%;\n }\n\n .message-wrapper.assistant-msg {\n align-self: flex-start;\n }\n\n .msg-avatar {\n width: 32px;\n height: 32px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n font-weight: 600;\n font-size: 12px;\n flex-shrink: 0;\n }\n\n .msg-avatar img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: 50%;\n }\n\n .msg-bubble-container {\n display: flex;\n flex-direction: column;\n gap: 4px;\n }\n\n .user-msg .msg-bubble-container {\n align-items: flex-end;\n }\n\n .msg-sender {\n font-size: 11px;\n font-weight: 600;\n color: #64748b;\n margin-left: 4px;\n }\n\n .msg-bubble {\n padding: 12px 16px;\n border-radius: 16px;\n font-size: 14px;\n line-height: 1.5;\n word-break: break-word;\n }\n\n .user-msg .msg-bubble {\n background: var(--ngx-ai-bubble-user-bg, #1a73e8);\n color: var(--ngx-ai-bubble-user-text, #ffffff);\n border-bottom-right-radius: 4px;\n }\n\n .assistant-msg .msg-bubble {\n background: var(--ngx-ai-bubble-assistant-bg, #f1f5f9);\n color: var(--ngx-ai-bubble-assistant-text, #1e293b);\n border-bottom-left-radius: 4px;\n }\n\n .msg-text {\n white-space: pre-wrap;\n }\n\n .msg-time {\n font-size: 10px;\n color: #94a3b8;\n margin: 0 4px;\n }\n\n /* Agent Steps Accordion */\n .agent-steps-container {\n margin-top: 10px;\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 8px;\n overflow: hidden;\n background: rgba(255, 255, 255, 0.05);\n }\n\n .steps-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px 12px;\n background: rgba(148, 163, 184, 0.1);\n border-bottom: 1px solid rgba(148, 163, 184, 0.1);\n }\n\n .steps-title-text {\n font-size: 12px;\n font-weight: 600;\n opacity: 0.8;\n }\n\n .steps-badge {\n font-size: 10px;\n font-weight: 700;\n background: rgba(148, 163, 184, 0.2);\n padding: 2px 6px;\n border-radius: 10px;\n }\n\n .steps-list {\n display: flex;\n flex-direction: column;\n }\n\n .agent-step-item {\n border-bottom: 1px solid rgba(148, 163, 184, 0.08);\n }\n\n .agent-step-item:last-child {\n border-bottom: none;\n }\n\n .step-summary {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n cursor: pointer;\n font-size: 12px;\n gap: 8px;\n transition: background-color 0.2s;\n }\n\n .step-summary:hover {\n background: rgba(148, 163, 184, 0.05);\n }\n\n .step-status-icon {\n width: 16px;\n height: 16px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n color: #fff;\n }\n\n .step-status-icon.success {\n background: #10b981;\n }\n\n .step-status-icon.error {\n background: #ef4444;\n }\n\n .step-status-icon.running {\n background: #3b82f6;\n }\n\n .step-name {\n flex: 1;\n font-weight: 500;\n }\n\n .step-duration {\n font-size: 10px;\n opacity: 0.6;\n }\n\n .step-chevron {\n font-size: 8px;\n transition: transform 0.2s;\n opacity: 0.5;\n }\n\n .step-chevron.expanded {\n transform: rotate(180deg);\n }\n\n .step-details {\n padding: 8px 12px;\n background: rgba(0, 0, 0, 0.02);\n display: flex;\n flex-direction: column;\n gap: 8px;\n border-top: 1px solid rgba(148, 163, 184, 0.05);\n }\n\n .step-detail-section {\n display: flex;\n flex-direction: column;\n gap: 4px;\n }\n\n .detail-label {\n font-size: 10px;\n font-weight: 600;\n opacity: 0.6;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n }\n\n .detail-code {\n margin: 0;\n padding: 6px 10px;\n background: rgba(0, 0, 0, 0.05);\n border-radius: 4px;\n font-family: monospace;\n font-size: 11px;\n overflow-x: auto;\n white-space: pre-wrap;\n max-height: 120px;\n }\n\n /* Structured Response Carousel Cards */\n .cards-carousel {\n display: flex;\n gap: 12px;\n overflow-x: auto;\n padding: 10px 4px 6px;\n margin-top: 8px;\n scroll-snap-type: x mandatory;\n scrollbar-width: thin;\n }\n\n .cards-carousel::-webkit-scrollbar {\n height: 6px;\n }\n .cards-carousel::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .ai-carousel-card {\n flex: 0 0 240px;\n background: var(--ngx-ai-chat-bg, #fff);\n border: 1px solid var(--ngx-ai-chat-border, #e2e8f0);\n border-radius: 12px;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n scroll-snap-align: start;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);\n }\n\n .card-img-container {\n height: 120px;\n overflow: hidden;\n }\n\n .card-img-container img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .card-body {\n padding: 12px;\n display: flex;\n flex-direction: column;\n flex: 1;\n }\n\n .card-title {\n font-size: 14px;\n font-weight: 600;\n margin: 0 0 2px;\n }\n\n .card-subtitle {\n font-size: 12px;\n font-weight: 500;\n color: #64748b;\n margin: 0 0 6px;\n }\n\n .card-description {\n font-size: 12px;\n color: #64748b;\n line-height: 1.4;\n margin: 0 0 12px;\n flex: 1;\n }\n\n .card-actions {\n display: flex;\n flex-direction: column;\n gap: 6px;\n }\n\n .card-action-btn {\n width: 100%;\n padding: 6px 12px;\n font-size: 12px;\n font-weight: 600;\n border-radius: 6px;\n border: 1px solid var(--ngx-ai-chat-border, #e2e8f0);\n background: none;\n cursor: pointer;\n transition: all 0.2s;\n }\n\n .card-action-btn.btn-primary {\n background: var(--ngx-ai-bubble-user-bg, #1a73e8);\n color: #fff;\n border-color: transparent;\n }\n\n .card-action-btn:hover {\n opacity: 0.9;\n transform: translateY(-1px);\n }\n\n /* Typing Indicator Bubble */\n .typing-bubble {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 12px 20px;\n }\n\n .typing-indicator {\n display: flex;\n gap: 4px;\n }\n\n .typing-indicator span {\n width: 8px;\n height: 8px;\n background: #94a3b8;\n border-radius: 50%;\n animation: typing 1.4s infinite ease-in-out both;\n }\n\n .typing-indicator span:nth-child(1) { animation-delay: -0.32s; }\n .typing-indicator span:nth-child(2) { animation-delay: -0.16s; }\n\n @keyframes typing {\n 0%, 80%, 100% { transform: scale(0); }\n 40% { transform: scale(1.0); }\n }\n\n /* Spinner */\n .spinner {\n width: 10px;\n height: 10px;\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-radius: 50%;\n border-top-color: #fff;\n animation: spin 1s ease-in-out infinite;\n }\n\n @keyframes spin {\n to { transform: rotate(360deg); }\n }\n\n /* Quick Replies */\n .quick-replies-container {\n padding: 10px 16px 4px;\n background: transparent;\n }\n\n .quick-replies-list {\n display: flex;\n gap: 8px;\n overflow-x: auto;\n padding-bottom: 6px;\n scrollbar-width: none;\n }\n\n .quick-replies-list::-webkit-scrollbar {\n display: none;\n }\n\n .quick-reply-btn {\n flex: 0 0 auto;\n padding: 6px 14px;\n border-radius: 18px;\n border: 1px solid var(--ngx-ai-chat-border, #e2e8f0);\n background: var(--ngx-ai-chat-bg, #fff);\n font-size: 13px;\n font-weight: 500;\n color: #64748b;\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: 6px;\n transition: all 0.2s;\n }\n\n .quick-reply-btn:hover {\n border-color: var(--ngx-ai-bubble-user-bg, #1a73e8);\n color: var(--ngx-ai-bubble-user-bg, #1a73e8);\n background-color: rgba(26, 115, 232, 0.04);\n }\n\n /* Chat Footer */\n .ngx-ai-chat-footer {\n padding: 14px 18px;\n background: var(--ngx-ai-header-bg, #f8fafc);\n border-top: 1px solid var(--ngx-ai-chat-border, #e2e8f0);\n }\n\n .input-form {\n display: flex;\n gap: 10px;\n }\n\n .chat-input {\n flex: 1;\n padding: 10px 14px;\n border-radius: 8px;\n border: 1px solid var(--ngx-ai-input-border, #cbd5e1);\n background: var(--ngx-ai-input-bg, #fff);\n color: var(--ngx-ai-input-text, #1e293b);\n font-size: 14px;\n outline: none;\n transition: border-color 0.2s;\n }\n\n .chat-input:focus {\n border-color: var(--ngx-ai-bubble-user-bg, #1a73e8);\n }\n\n .send-btn {\n width: 38px;\n height: 38px;\n border-radius: 8px;\n background: var(--ngx-ai-bubble-user-bg, #1a73e8);\n color: #fff;\n border: none;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background-color 0.2s, transform 0.1s;\n }\n\n .send-btn:hover:not(:disabled) {\n background-color: #1557b0;\n transform: translateY(-1px);\n }\n\n .send-btn:disabled {\n background-color: #94a3b8;\n cursor: not-allowed;\n }\n `]\n})\nexport class AIChatComponent {\n messages = input<AIMessage[]>([]);\n agentName = input('AI Agent');\n agentAvatarUrl = input('');\n isOnline = input(true);\n isTyping = input(false);\n showSenderNames = input(false);\n theme = input<'light' | 'dark'>('light');\n placeholder = input('Type a message...');\n disabled = input(false);\n quickReplies = input<QuickReply[]>([]);\n avatarBg = input('#4f46e5');\n\n sendMessage = output<string>();\n quickReplyClick = output<QuickReply>();\n cardActionClick = output<AICardAction>();\n clearHistory = output<void>();\n\n chatBody = viewChild<ElementRef>('chatBody');\n\n inputText = '';\n\n constructor() {\n // Automatically scroll to bottom when messages or typing status changes\n effect(() => {\n this.messages();\n this.isTyping();\n this.scrollToBottom();\n });\n }\n\n onSubmit(): void {\n const text = this.inputText.trim();\n if (!text || this.disabled()) return;\n this.sendMessage.emit(text);\n this.inputText = '';\n }\n\n toggleStep(step: AgentStep): void {\n step.collapsed = !step.collapsed;\n }\n\n getCompletedStepsCount(steps: AgentStep[]): number {\n return steps.filter(s => s.status === 'success' || s.status === 'error').length;\n }\n\n getInitials(name: string): string {\n if (!name) return 'AI';\n const parts = name.split(' ');\n if (parts.length >= 2) {\n return (parts[0][0] + parts[1][0]).toUpperCase();\n }\n return name.slice(0, 2).toUpperCase();\n }\n\n scrollToBottom(): void {\n setTimeout(() => {\n const el = this.chatBody()?.nativeElement;\n if (el) {\n el.scrollTop = el.scrollHeight;\n }\n }, 100);\n }\n\n formatMessage(content: string): string {\n if (!content) return '';\n // Very basic escaping and formatting to keep it lightweight.\n // In actual project, a custom template or markdown pipe can be used.\n let formatted = content\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>');\n\n // Bold markdown helper\n formatted = formatted.replace(/\\*\\*(.*?)\\*\\*/g, '<strong>$1</strong>');\n\n // Code blocks helper\n formatted = formatted.replace(/```(\\w*)\\n([\\s\\S]*?)```/g, (_, lang, code) => {\n const language = lang || 'code';\n return `\n <div class=\"code-container\" style=\"background: rgba(0,0,0,0.05); padding: 8px 12px; border-radius: 6px; font-family: monospace; font-size: 12px; margin: 8px 0; border-left: 3px solid #3b82f6; overflow-x: auto;\">\n <div style=\"font-size: 10px; font-weight: bold; opacity: 0.6; margin-bottom: 4px; text-transform: uppercase;\">${language}</div>\n <pre style=\"margin: 0; white-space: pre-wrap;\"><code>${code.trim()}</code></pre>\n </div>\n `;\n });\n\n // Inline code helper\n formatted = formatted.replace(/`(.*?)`/g, '<code style=\"background: rgba(0,0,0,0.06); padding: 2px 4px; border-radius: 4px; font-family: monospace; font-size: 12px;\">$1</code>');\n\n return formatted;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MA+xBa,eAAe,CAAA;AAC1B,IAAA,QAAQ,GAAG,KAAK,CAAc,EAAE,CAAC;AACjC,IAAA,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC;AAC7B,IAAA,cAAc,GAAG,KAAK,CAAC,EAAE,CAAC;AAC1B,IAAA,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC;AACtB,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC;AACvB,IAAA,eAAe,GAAG,KAAK,CAAC,KAAK,CAAC;AAC9B,IAAA,KAAK,GAAG,KAAK,CAAmB,OAAO,CAAC;AACxC,IAAA,WAAW,GAAG,KAAK,CAAC,mBAAmB,CAAC;AACxC,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC;AACvB,IAAA,YAAY,GAAG,KAAK,CAAe,EAAE,CAAC;AACtC,IAAA,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC;IAE3B,WAAW,GAAG,MAAM,EAAU;IAC9B,eAAe,GAAG,MAAM,EAAc;IACtC,eAAe,GAAG,MAAM,EAAgB;IACxC,YAAY,GAAG,MAAM,EAAQ;AAE7B,IAAA,QAAQ,GAAG,SAAS,CAAa,UAAU,CAAC;IAE5C,SAAS,GAAG,EAAE;AAEd,IAAA,WAAA,GAAA;;QAEE,MAAM,CAAC,MAAK;YACV,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,cAAc,EAAE;AACvB,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