emanate-ai-chat-lib 0.1.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.
- package/README.md +409 -0
- package/bundles/emanate-ai-chat-lib.umd.js +1545 -0
- package/bundles/emanate-ai-chat-lib.umd.js.map +1 -0
- package/emanate-ai-chat-lib.d.ts +5 -0
- package/esm2015/emanate-ai-chat-lib.js +5 -0
- package/esm2015/lib/components/ai-chat.component.js +706 -0
- package/esm2015/lib/emanate-ai-chat-lib.component.js +26 -0
- package/esm2015/lib/emanate-ai-chat-lib.module.js +45 -0
- package/esm2015/lib/emanate-ai-chat-lib.service.js +14 -0
- package/esm2015/lib/models/icon-config.interface.js +113 -0
- package/esm2015/lib/services/ai-agent.service.js +86 -0
- package/esm2015/public-api.js +12 -0
- package/fesm2015/emanate-ai-chat-lib.js +985 -0
- package/fesm2015/emanate-ai-chat-lib.js.map +1 -0
- package/lib/components/ai-chat.component.d.ts +131 -0
- package/lib/emanate-ai-chat-lib.component.d.ts +8 -0
- package/lib/emanate-ai-chat-lib.module.d.ts +11 -0
- package/lib/emanate-ai-chat-lib.service.d.ts +6 -0
- package/lib/models/icon-config.interface.d.ts +45 -0
- package/lib/services/ai-agent.service.d.ts +60 -0
- package/package.json +38 -0
- package/public-api.d.ts +6 -0
|
@@ -0,0 +1,1545 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('@angular/platform-browser')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('emanate-ai-chat-lib', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/common/http', 'rxjs', 'rxjs/operators', '@angular/platform-browser'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["emanate-ai-chat-lib"] = {}, global.ng.core, global.ng.common, global.ng.forms, global.ng.common.http, global.rxjs, global.rxjs.operators, global.ng.platformBrowser));
|
|
5
|
+
})(this, (function (exports, i0, i3, i4, i1, rxjs, operators, i2) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
26
|
+
var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
|
|
27
|
+
var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
|
|
28
|
+
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
|
+
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
30
|
+
|
|
31
|
+
var EmanateAiChatLibService = /** @class */ (function () {
|
|
32
|
+
function EmanateAiChatLibService() {
|
|
33
|
+
}
|
|
34
|
+
return EmanateAiChatLibService;
|
|
35
|
+
}());
|
|
36
|
+
EmanateAiChatLibService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EmanateAiChatLibService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
37
|
+
EmanateAiChatLibService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EmanateAiChatLibService, providedIn: 'root' });
|
|
38
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EmanateAiChatLibService, decorators: [{
|
|
39
|
+
type: i0.Injectable,
|
|
40
|
+
args: [{
|
|
41
|
+
providedIn: 'root'
|
|
42
|
+
}]
|
|
43
|
+
}], ctorParameters: function () { return []; } });
|
|
44
|
+
|
|
45
|
+
var EmanateAiChatLibComponent = /** @class */ (function () {
|
|
46
|
+
function EmanateAiChatLibComponent() {
|
|
47
|
+
}
|
|
48
|
+
EmanateAiChatLibComponent.prototype.ngOnInit = function () {
|
|
49
|
+
};
|
|
50
|
+
return EmanateAiChatLibComponent;
|
|
51
|
+
}());
|
|
52
|
+
EmanateAiChatLibComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EmanateAiChatLibComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
53
|
+
EmanateAiChatLibComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: EmanateAiChatLibComponent, selector: "lib-emanate-ai-chat-lib", ngImport: i0__namespace, template: "\n <p>\n Emanate AI Chat Library v1.0.0 - Use lib-ai-chat component directly\n </p>\n ", isInline: true });
|
|
54
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EmanateAiChatLibComponent, decorators: [{
|
|
55
|
+
type: i0.Component,
|
|
56
|
+
args: [{
|
|
57
|
+
selector: 'lib-emanate-ai-chat-lib',
|
|
58
|
+
template: "\n <p>\n Emanate AI Chat Library v1.0.0 - Use lib-ai-chat component directly\n </p>\n ",
|
|
59
|
+
styles: []
|
|
60
|
+
}]
|
|
61
|
+
}], ctorParameters: function () { return []; } });
|
|
62
|
+
|
|
63
|
+
/******************************************************************************
|
|
64
|
+
Copyright (c) Microsoft Corporation.
|
|
65
|
+
|
|
66
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
67
|
+
purpose with or without fee is hereby granted.
|
|
68
|
+
|
|
69
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
70
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
71
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
72
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
73
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
74
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
75
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
76
|
+
***************************************************************************** */
|
|
77
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
78
|
+
var extendStatics = function (d, b) {
|
|
79
|
+
extendStatics = Object.setPrototypeOf ||
|
|
80
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
81
|
+
function (d, b) { for (var p in b)
|
|
82
|
+
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
83
|
+
d[p] = b[p]; };
|
|
84
|
+
return extendStatics(d, b);
|
|
85
|
+
};
|
|
86
|
+
function __extends(d, b) {
|
|
87
|
+
if (typeof b !== "function" && b !== null)
|
|
88
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
89
|
+
extendStatics(d, b);
|
|
90
|
+
function __() { this.constructor = d; }
|
|
91
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
92
|
+
}
|
|
93
|
+
var __assign = function () {
|
|
94
|
+
__assign = Object.assign || function __assign(t) {
|
|
95
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
96
|
+
s = arguments[i];
|
|
97
|
+
for (var p in s)
|
|
98
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
99
|
+
t[p] = s[p];
|
|
100
|
+
}
|
|
101
|
+
return t;
|
|
102
|
+
};
|
|
103
|
+
return __assign.apply(this, arguments);
|
|
104
|
+
};
|
|
105
|
+
function __rest(s, e) {
|
|
106
|
+
var t = {};
|
|
107
|
+
for (var p in s)
|
|
108
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
109
|
+
t[p] = s[p];
|
|
110
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
111
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
112
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
113
|
+
t[p[i]] = s[p[i]];
|
|
114
|
+
}
|
|
115
|
+
return t;
|
|
116
|
+
}
|
|
117
|
+
function __decorate(decorators, target, key, desc) {
|
|
118
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
119
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
120
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
121
|
+
else
|
|
122
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
123
|
+
if (d = decorators[i])
|
|
124
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
125
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
126
|
+
}
|
|
127
|
+
function __param(paramIndex, decorator) {
|
|
128
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
129
|
+
}
|
|
130
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
131
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function")
|
|
132
|
+
throw new TypeError("Function expected"); return f; }
|
|
133
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
134
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
135
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
136
|
+
var _, done = false;
|
|
137
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
138
|
+
var context = {};
|
|
139
|
+
for (var p in contextIn)
|
|
140
|
+
context[p] = p === "access" ? {} : contextIn[p];
|
|
141
|
+
for (var p in contextIn.access)
|
|
142
|
+
context.access[p] = contextIn.access[p];
|
|
143
|
+
context.addInitializer = function (f) { if (done)
|
|
144
|
+
throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
145
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
146
|
+
if (kind === "accessor") {
|
|
147
|
+
if (result === void 0)
|
|
148
|
+
continue;
|
|
149
|
+
if (result === null || typeof result !== "object")
|
|
150
|
+
throw new TypeError("Object expected");
|
|
151
|
+
if (_ = accept(result.get))
|
|
152
|
+
descriptor.get = _;
|
|
153
|
+
if (_ = accept(result.set))
|
|
154
|
+
descriptor.set = _;
|
|
155
|
+
if (_ = accept(result.init))
|
|
156
|
+
initializers.unshift(_);
|
|
157
|
+
}
|
|
158
|
+
else if (_ = accept(result)) {
|
|
159
|
+
if (kind === "field")
|
|
160
|
+
initializers.unshift(_);
|
|
161
|
+
else
|
|
162
|
+
descriptor[key] = _;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (target)
|
|
166
|
+
Object.defineProperty(target, contextIn.name, descriptor);
|
|
167
|
+
done = true;
|
|
168
|
+
}
|
|
169
|
+
;
|
|
170
|
+
function __runInitializers(thisArg, initializers, value) {
|
|
171
|
+
var useValue = arguments.length > 2;
|
|
172
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
173
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
174
|
+
}
|
|
175
|
+
return useValue ? value : void 0;
|
|
176
|
+
}
|
|
177
|
+
;
|
|
178
|
+
function __propKey(x) {
|
|
179
|
+
return typeof x === "symbol" ? x : "".concat(x);
|
|
180
|
+
}
|
|
181
|
+
;
|
|
182
|
+
function __setFunctionName(f, name, prefix) {
|
|
183
|
+
if (typeof name === "symbol")
|
|
184
|
+
name = name.description ? "[".concat(name.description, "]") : "";
|
|
185
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
186
|
+
}
|
|
187
|
+
;
|
|
188
|
+
function __metadata(metadataKey, metadataValue) {
|
|
189
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
190
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
191
|
+
}
|
|
192
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
193
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
194
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
195
|
+
function fulfilled(value) { try {
|
|
196
|
+
step(generator.next(value));
|
|
197
|
+
}
|
|
198
|
+
catch (e) {
|
|
199
|
+
reject(e);
|
|
200
|
+
} }
|
|
201
|
+
function rejected(value) { try {
|
|
202
|
+
step(generator["throw"](value));
|
|
203
|
+
}
|
|
204
|
+
catch (e) {
|
|
205
|
+
reject(e);
|
|
206
|
+
} }
|
|
207
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
208
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function __generator(thisArg, body) {
|
|
212
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
213
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
214
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
215
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
216
|
+
function step(op) {
|
|
217
|
+
if (f)
|
|
218
|
+
throw new TypeError("Generator is already executing.");
|
|
219
|
+
while (g && (g = 0, op[0] && (_ = 0)), _)
|
|
220
|
+
try {
|
|
221
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
222
|
+
return t;
|
|
223
|
+
if (y = 0, t)
|
|
224
|
+
op = [op[0] & 2, t.value];
|
|
225
|
+
switch (op[0]) {
|
|
226
|
+
case 0:
|
|
227
|
+
case 1:
|
|
228
|
+
t = op;
|
|
229
|
+
break;
|
|
230
|
+
case 4:
|
|
231
|
+
_.label++;
|
|
232
|
+
return { value: op[1], done: false };
|
|
233
|
+
case 5:
|
|
234
|
+
_.label++;
|
|
235
|
+
y = op[1];
|
|
236
|
+
op = [0];
|
|
237
|
+
continue;
|
|
238
|
+
case 7:
|
|
239
|
+
op = _.ops.pop();
|
|
240
|
+
_.trys.pop();
|
|
241
|
+
continue;
|
|
242
|
+
default:
|
|
243
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
244
|
+
_ = 0;
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
248
|
+
_.label = op[1];
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
252
|
+
_.label = t[1];
|
|
253
|
+
t = op;
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
if (t && _.label < t[2]) {
|
|
257
|
+
_.label = t[2];
|
|
258
|
+
_.ops.push(op);
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
if (t[2])
|
|
262
|
+
_.ops.pop();
|
|
263
|
+
_.trys.pop();
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
op = body.call(thisArg, _);
|
|
267
|
+
}
|
|
268
|
+
catch (e) {
|
|
269
|
+
op = [6, e];
|
|
270
|
+
y = 0;
|
|
271
|
+
}
|
|
272
|
+
finally {
|
|
273
|
+
f = t = 0;
|
|
274
|
+
}
|
|
275
|
+
if (op[0] & 5)
|
|
276
|
+
throw op[1];
|
|
277
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
281
|
+
if (k2 === undefined)
|
|
282
|
+
k2 = k;
|
|
283
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
284
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
285
|
+
desc = { enumerable: true, get: function () { return m[k]; } };
|
|
286
|
+
}
|
|
287
|
+
Object.defineProperty(o, k2, desc);
|
|
288
|
+
}) : (function (o, m, k, k2) {
|
|
289
|
+
if (k2 === undefined)
|
|
290
|
+
k2 = k;
|
|
291
|
+
o[k2] = m[k];
|
|
292
|
+
});
|
|
293
|
+
function __exportStar(m, o) {
|
|
294
|
+
for (var p in m)
|
|
295
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
296
|
+
__createBinding(o, m, p);
|
|
297
|
+
}
|
|
298
|
+
function __values(o) {
|
|
299
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
300
|
+
if (m)
|
|
301
|
+
return m.call(o);
|
|
302
|
+
if (o && typeof o.length === "number")
|
|
303
|
+
return {
|
|
304
|
+
next: function () {
|
|
305
|
+
if (o && i >= o.length)
|
|
306
|
+
o = void 0;
|
|
307
|
+
return { value: o && o[i++], done: !o };
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
311
|
+
}
|
|
312
|
+
function __read(o, n) {
|
|
313
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
314
|
+
if (!m)
|
|
315
|
+
return o;
|
|
316
|
+
var i = m.call(o), r, ar = [], e;
|
|
317
|
+
try {
|
|
318
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
319
|
+
ar.push(r.value);
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
e = { error: error };
|
|
323
|
+
}
|
|
324
|
+
finally {
|
|
325
|
+
try {
|
|
326
|
+
if (r && !r.done && (m = i["return"]))
|
|
327
|
+
m.call(i);
|
|
328
|
+
}
|
|
329
|
+
finally {
|
|
330
|
+
if (e)
|
|
331
|
+
throw e.error;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return ar;
|
|
335
|
+
}
|
|
336
|
+
/** @deprecated */
|
|
337
|
+
function __spread() {
|
|
338
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
339
|
+
ar = ar.concat(__read(arguments[i]));
|
|
340
|
+
return ar;
|
|
341
|
+
}
|
|
342
|
+
/** @deprecated */
|
|
343
|
+
function __spreadArrays() {
|
|
344
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
345
|
+
s += arguments[i].length;
|
|
346
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
347
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
348
|
+
r[k] = a[j];
|
|
349
|
+
return r;
|
|
350
|
+
}
|
|
351
|
+
function __spreadArray(to, from, pack) {
|
|
352
|
+
if (pack || arguments.length === 2)
|
|
353
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
354
|
+
if (ar || !(i in from)) {
|
|
355
|
+
if (!ar)
|
|
356
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
357
|
+
ar[i] = from[i];
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
361
|
+
}
|
|
362
|
+
function __await(v) {
|
|
363
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
364
|
+
}
|
|
365
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
366
|
+
if (!Symbol.asyncIterator)
|
|
367
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
368
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
369
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
370
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
371
|
+
function verb(n, f) { if (g[n]) {
|
|
372
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); };
|
|
373
|
+
if (f)
|
|
374
|
+
i[n] = f(i[n]);
|
|
375
|
+
} }
|
|
376
|
+
function resume(n, v) { try {
|
|
377
|
+
step(g[n](v));
|
|
378
|
+
}
|
|
379
|
+
catch (e) {
|
|
380
|
+
settle(q[0][3], e);
|
|
381
|
+
} }
|
|
382
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
383
|
+
function fulfill(value) { resume("next", value); }
|
|
384
|
+
function reject(value) { resume("throw", value); }
|
|
385
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
386
|
+
resume(q[0][0], q[0][1]); }
|
|
387
|
+
}
|
|
388
|
+
function __asyncDelegator(o) {
|
|
389
|
+
var i, p;
|
|
390
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
391
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
392
|
+
}
|
|
393
|
+
function __asyncValues(o) {
|
|
394
|
+
if (!Symbol.asyncIterator)
|
|
395
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
396
|
+
var m = o[Symbol.asyncIterator], i;
|
|
397
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
398
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
399
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
400
|
+
}
|
|
401
|
+
function __makeTemplateObject(cooked, raw) {
|
|
402
|
+
if (Object.defineProperty) {
|
|
403
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
cooked.raw = raw;
|
|
407
|
+
}
|
|
408
|
+
return cooked;
|
|
409
|
+
}
|
|
410
|
+
;
|
|
411
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
412
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
413
|
+
}) : function (o, v) {
|
|
414
|
+
o["default"] = v;
|
|
415
|
+
};
|
|
416
|
+
var ownKeys = function (o) {
|
|
417
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
418
|
+
var ar = [];
|
|
419
|
+
for (var k in o)
|
|
420
|
+
if (Object.prototype.hasOwnProperty.call(o, k))
|
|
421
|
+
ar[ar.length] = k;
|
|
422
|
+
return ar;
|
|
423
|
+
};
|
|
424
|
+
return ownKeys(o);
|
|
425
|
+
};
|
|
426
|
+
function __importStar(mod) {
|
|
427
|
+
if (mod && mod.__esModule)
|
|
428
|
+
return mod;
|
|
429
|
+
var result = {};
|
|
430
|
+
if (mod != null)
|
|
431
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++)
|
|
432
|
+
if (k[i] !== "default")
|
|
433
|
+
__createBinding(result, mod, k[i]);
|
|
434
|
+
__setModuleDefault(result, mod);
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
437
|
+
function __importDefault(mod) {
|
|
438
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
439
|
+
}
|
|
440
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
441
|
+
if (kind === "a" && !f)
|
|
442
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
443
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
444
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
445
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
446
|
+
}
|
|
447
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
448
|
+
if (kind === "m")
|
|
449
|
+
throw new TypeError("Private method is not writable");
|
|
450
|
+
if (kind === "a" && !f)
|
|
451
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
452
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
453
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
454
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
455
|
+
}
|
|
456
|
+
function __classPrivateFieldIn(state, receiver) {
|
|
457
|
+
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
|
|
458
|
+
throw new TypeError("Cannot use 'in' operator on non-object");
|
|
459
|
+
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
460
|
+
}
|
|
461
|
+
function __addDisposableResource(env, value, async) {
|
|
462
|
+
if (value !== null && value !== void 0) {
|
|
463
|
+
if (typeof value !== "object" && typeof value !== "function")
|
|
464
|
+
throw new TypeError("Object expected.");
|
|
465
|
+
var dispose, inner;
|
|
466
|
+
if (async) {
|
|
467
|
+
if (!Symbol.asyncDispose)
|
|
468
|
+
throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
469
|
+
dispose = value[Symbol.asyncDispose];
|
|
470
|
+
}
|
|
471
|
+
if (dispose === void 0) {
|
|
472
|
+
if (!Symbol.dispose)
|
|
473
|
+
throw new TypeError("Symbol.dispose is not defined.");
|
|
474
|
+
dispose = value[Symbol.dispose];
|
|
475
|
+
if (async)
|
|
476
|
+
inner = dispose;
|
|
477
|
+
}
|
|
478
|
+
if (typeof dispose !== "function")
|
|
479
|
+
throw new TypeError("Object not disposable.");
|
|
480
|
+
if (inner)
|
|
481
|
+
dispose = function () { try {
|
|
482
|
+
inner.call(this);
|
|
483
|
+
}
|
|
484
|
+
catch (e) {
|
|
485
|
+
return Promise.reject(e);
|
|
486
|
+
} };
|
|
487
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
488
|
+
}
|
|
489
|
+
else if (async) {
|
|
490
|
+
env.stack.push({ async: true });
|
|
491
|
+
}
|
|
492
|
+
return value;
|
|
493
|
+
}
|
|
494
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
495
|
+
var e = new Error(message);
|
|
496
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
497
|
+
};
|
|
498
|
+
function __disposeResources(env) {
|
|
499
|
+
function fail(e) {
|
|
500
|
+
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
501
|
+
env.hasError = true;
|
|
502
|
+
}
|
|
503
|
+
var r, s = 0;
|
|
504
|
+
function next() {
|
|
505
|
+
while (r = env.stack.pop()) {
|
|
506
|
+
try {
|
|
507
|
+
if (!r.async && s === 1)
|
|
508
|
+
return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
509
|
+
if (r.dispose) {
|
|
510
|
+
var result = r.dispose.call(r.value);
|
|
511
|
+
if (r.async)
|
|
512
|
+
return s |= 2, Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
|
|
513
|
+
}
|
|
514
|
+
else
|
|
515
|
+
s |= 1;
|
|
516
|
+
}
|
|
517
|
+
catch (e) {
|
|
518
|
+
fail(e);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
if (s === 1)
|
|
522
|
+
return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
523
|
+
if (env.hasError)
|
|
524
|
+
throw env.error;
|
|
525
|
+
}
|
|
526
|
+
return next();
|
|
527
|
+
}
|
|
528
|
+
function __rewriteRelativeImportExtension(path, preserveJsx) {
|
|
529
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
530
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
531
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
return path;
|
|
535
|
+
}
|
|
536
|
+
var tslib_es6 = {
|
|
537
|
+
__extends: __extends,
|
|
538
|
+
__assign: __assign,
|
|
539
|
+
__rest: __rest,
|
|
540
|
+
__decorate: __decorate,
|
|
541
|
+
__param: __param,
|
|
542
|
+
__esDecorate: __esDecorate,
|
|
543
|
+
__runInitializers: __runInitializers,
|
|
544
|
+
__propKey: __propKey,
|
|
545
|
+
__setFunctionName: __setFunctionName,
|
|
546
|
+
__metadata: __metadata,
|
|
547
|
+
__awaiter: __awaiter,
|
|
548
|
+
__generator: __generator,
|
|
549
|
+
__createBinding: __createBinding,
|
|
550
|
+
__exportStar: __exportStar,
|
|
551
|
+
__values: __values,
|
|
552
|
+
__read: __read,
|
|
553
|
+
__spread: __spread,
|
|
554
|
+
__spreadArrays: __spreadArrays,
|
|
555
|
+
__spreadArray: __spreadArray,
|
|
556
|
+
__await: __await,
|
|
557
|
+
__asyncGenerator: __asyncGenerator,
|
|
558
|
+
__asyncDelegator: __asyncDelegator,
|
|
559
|
+
__asyncValues: __asyncValues,
|
|
560
|
+
__makeTemplateObject: __makeTemplateObject,
|
|
561
|
+
__importStar: __importStar,
|
|
562
|
+
__importDefault: __importDefault,
|
|
563
|
+
__classPrivateFieldGet: __classPrivateFieldGet,
|
|
564
|
+
__classPrivateFieldSet: __classPrivateFieldSet,
|
|
565
|
+
__classPrivateFieldIn: __classPrivateFieldIn,
|
|
566
|
+
__addDisposableResource: __addDisposableResource,
|
|
567
|
+
__disposeResources: __disposeResources,
|
|
568
|
+
__rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Icon configuration interfaces for the chat component
|
|
573
|
+
*/
|
|
574
|
+
/**
|
|
575
|
+
* Feather Icons - Default icon set
|
|
576
|
+
* Clean, minimal, professional
|
|
577
|
+
*/
|
|
578
|
+
var FEATHER_ICONS = {
|
|
579
|
+
compactView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"></rect></svg>',
|
|
580
|
+
defaultView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect><line x1="8" y1="21" x2="16" y2="21"></line><line x1="12" y1="17" x2="12" y2="21"></line></svg>',
|
|
581
|
+
expandedView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="20" height="20" rx="2.18" ry="2.18"></rect><line x1="7" y1="2" x2="7" y2="22"></line><line x1="17" y1="2" x2="17" y2="22"></line><line x1="2" y1="12" x2="22" y2="12"></line><line x1="2" y1="7" x2="7" y2="7"></line><line x1="2" y1="17" x2="7" y2="17"></line><line x1="17" y1="17" x2="22" y2="17"></line><line x1="17" y1="7" x2="22" y2="7"></line></svg>',
|
|
582
|
+
send: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>',
|
|
583
|
+
sendLoading: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="2" x2="12" y2="6"></line><line x1="12" y1="18" x2="12" y2="22"></line><line x1="4.93" y1="4.93" x2="7.76" y2="7.76"></line><line x1="16.24" y1="16.24" x2="19.07" y2="19.07"></line><line x1="2" y1="12" x2="6" y2="12"></line><line x1="18" y1="12" x2="22" y2="12"></line><line x1="4.93" y1="19.07" x2="7.76" y2="16.24"></line><line x1="16.24" y1="7.76" x2="19.07" y2="4.93"></line></svg>',
|
|
584
|
+
userAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>',
|
|
585
|
+
aiAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="7" width="20" height="14" rx="2" ry="2"></rect><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"></path></svg>',
|
|
586
|
+
loadingAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="2" x2="12" y2="6"></line><line x1="12" y1="18" x2="12" y2="22"></line><line x1="4.93" y1="4.93" x2="7.76" y2="7.76"></line><line x1="16.24" y1="16.24" x2="19.07" y2="19.07"></line><line x1="2" y1="12" x2="6" y2="12"></line><line x1="18" y1="12" x2="22" y2="12"></line><line x1="4.93" y1="19.07" x2="7.76" y2="16.24"></line><line x1="16.24" y1="7.76" x2="19.07" y2="4.93"></line></svg>',
|
|
587
|
+
imageUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>',
|
|
588
|
+
fileUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"></path></svg>'
|
|
589
|
+
};
|
|
590
|
+
/**
|
|
591
|
+
* Material Icons - Google's Material Design
|
|
592
|
+
* Rounded, friendly, modern
|
|
593
|
+
*/
|
|
594
|
+
var MATERIAL_ICONS = {
|
|
595
|
+
compactView: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M17 19H7V5h10m0-2H7c-1.11 0-2 .89-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2z"/></svg>',
|
|
596
|
+
defaultView: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M21 2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h7v2H8v2h8v-2h-2v-2h7c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H3V4h18v12z"/></svg>',
|
|
597
|
+
expandedView: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2 2h4v-2H5v-4zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2z"/></svg>',
|
|
598
|
+
send: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/></svg>',
|
|
599
|
+
sendLoading: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/></svg>',
|
|
600
|
+
userAvatar: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>',
|
|
601
|
+
aiAvatar: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20 9V7c0-1.1-.9-2-2-2h-3c0-1.66-1.34-3-3-3S9 3.34 9 5H6c-1.1 0-2 .9-2 2v2c-1.66 0-3 1.34-3 3s1.34 3 3 3v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c1.66 0 3-1.34 3-3s-1.34-3-3-3zM6 19V7h12v12H6zm3-6c-.83 0-1.5-.67-1.5-1.5S8.17 10 9 10s1.5.67 1.5 1.5S9.83 13 9 13zm7.5-1.5c0 .83-.67 1.5-1.5 1.5s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5 1.5.67 1.5 1.5zM8 15h8v2H8v-2z"/></svg>',
|
|
602
|
+
loadingAvatar: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/></svg>',
|
|
603
|
+
imageUpload: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>',
|
|
604
|
+
fileUpload: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5a2.5 2.5 0 0 1 5 0v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5a2.5 2.5 0 0 0 5 0V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6h-1.5z"/></svg>'
|
|
605
|
+
};
|
|
606
|
+
/**
|
|
607
|
+
* Heroicons - By Tailwind CSS team
|
|
608
|
+
* Bold, clear, professional
|
|
609
|
+
*/
|
|
610
|
+
var HEROICONS = {
|
|
611
|
+
compactView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="2" width="14" height="20" rx="2" ry="2"></rect><path d="M9 22V12h6v10"></path></svg>',
|
|
612
|
+
defaultView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect><line x1="8" y1="21" x2="16" y2="21"></line><line x1="12" y1="17" x2="12" y2="21"></line></svg>',
|
|
613
|
+
expandedView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><line x1="3" y1="9" x2="21" y2="9"></line><line x1="9" y1="21" x2="9" y2="9"></line></svg>',
|
|
614
|
+
send: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>',
|
|
615
|
+
sendLoading: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>',
|
|
616
|
+
userAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>',
|
|
617
|
+
aiAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"></path><rect x="2" y="8" width="20" height="12" rx="2" ry="2"></rect><circle cx="8" cy="14" r="2"></circle><circle cx="16" cy="14" r="2"></circle></svg>',
|
|
618
|
+
loadingAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>',
|
|
619
|
+
imageUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>',
|
|
620
|
+
fileUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline></svg>'
|
|
621
|
+
};
|
|
622
|
+
/**
|
|
623
|
+
* Lucide Icons - Community-driven Feather fork
|
|
624
|
+
* Similar to Feather but more extensive
|
|
625
|
+
*/
|
|
626
|
+
var LUCIDE_ICONS = {
|
|
627
|
+
compactView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"></rect><path d="M12.667 8 10 12h4l-2.667 4"></path></svg>',
|
|
628
|
+
defaultView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="14" x="2" y="3" rx="2"></rect><line x1="8" x2="16" y1="21" y2="21"></line><line x1="12" x2="12" y1="17" y2="21"></line></svg>',
|
|
629
|
+
expandedView: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2"></rect><path d="M9 3v18"></path><path d="M15 3v18"></path><path d="M3 9h18"></path><path d="M3 15h18"></path></svg>',
|
|
630
|
+
send: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m22 2-7 20-4-9-9-4Z"></path><path d="M22 2 11 13"></path></svg>',
|
|
631
|
+
sendLoading: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>',
|
|
632
|
+
userAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="5"></circle><path d="M20 21a8 8 0 1 0-16 0"></path></svg>',
|
|
633
|
+
aiAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"></path><rect width="16" height="12" x="4" y="8" rx="2"></rect><path d="M2 14h2"></path><path d="M20 14h2"></path><path d="M15 13v2"></path><path d="M9 13v2"></path></svg>',
|
|
634
|
+
loadingAvatar: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"></path></svg>',
|
|
635
|
+
imageUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect><circle cx="9" cy="9" r="2"></circle><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"></path></svg>',
|
|
636
|
+
fileUpload: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"></path><polyline points="14 2 14 8 20 8"></polyline></svg>'
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* Bootstrap Icons - Clean and versatile
|
|
640
|
+
* Familiar, simple, widely used
|
|
641
|
+
*/
|
|
642
|
+
var BOOTSTRAP_ICONS = {
|
|
643
|
+
compactView: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h6zM5 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H5z"/><path d="M8 14a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></svg>',
|
|
644
|
+
defaultView: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M0 1.5A.5.5 0 0 1 .5 1H2a.5.5 0 0 1 .485.379L2.89 3H14.5a.5.5 0 0 1 .49.598l-1 5a.5.5 0 0 1-.465.401l-9.397.472L4.415 11H13a.5.5 0 0 1 0 1H4a.5.5 0 0 1-.491-.408L2.01 3.607 1.61 2H.5a.5.5 0 0 1-.5-.5zM3.102 4l.84 4.479 9.144-.459L13.89 4H3.102zM5 12a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm7 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm-7 1a1 1 0 1 1 0 2 1 1 0 0 1 0-2zm7 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/></svg>',
|
|
645
|
+
expandedView: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M0 2.5A.5.5 0 0 1 .5 2H2a.5.5 0 0 1 .485.379L2.89 4H14.5a.5.5 0 0 1 .485.621l-1.5 6A.5.5 0 0 1 13 11H4a.5.5 0 0 1-.485-.379L1.61 3H.5a.5.5 0 0 1-.5-.5zM3.14 5l1.25 5h8.22l1.25-5H3.14zM5 13a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0zm9-1a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0z"/></svg>',
|
|
646
|
+
send: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576 6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76 7.494-7.493Z"/></svg>',
|
|
647
|
+
sendLoading: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z"/><path fill-rule="evenodd" d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5.002 5.002 0 0 0 8 3zM3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9H3.1z"/></svg>',
|
|
648
|
+
userAvatar: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/><path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/></svg>',
|
|
649
|
+
aiAvatar: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>',
|
|
650
|
+
loadingAvatar: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z"/></svg>',
|
|
651
|
+
imageUpload: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"/><path d="M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z"/></svg>',
|
|
652
|
+
fileUpload: '<svg viewBox="0 0 16 16" fill="currentColor"><path d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5L14 4.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5h-2z"/></svg>'
|
|
653
|
+
};
|
|
654
|
+
/**
|
|
655
|
+
* Get icon configuration by type
|
|
656
|
+
*/
|
|
657
|
+
function getIconSet(iconSetType, customIcons) {
|
|
658
|
+
var baseIcons;
|
|
659
|
+
switch (iconSetType) {
|
|
660
|
+
case 'material':
|
|
661
|
+
baseIcons = MATERIAL_ICONS;
|
|
662
|
+
break;
|
|
663
|
+
case 'heroicons':
|
|
664
|
+
baseIcons = HEROICONS;
|
|
665
|
+
break;
|
|
666
|
+
case 'lucide':
|
|
667
|
+
baseIcons = LUCIDE_ICONS;
|
|
668
|
+
break;
|
|
669
|
+
case 'bootstrap':
|
|
670
|
+
baseIcons = BOOTSTRAP_ICONS;
|
|
671
|
+
break;
|
|
672
|
+
case 'custom':
|
|
673
|
+
baseIcons = FEATHER_ICONS; // Fallback to Feather for missing custom icons
|
|
674
|
+
break;
|
|
675
|
+
case 'feather':
|
|
676
|
+
default:
|
|
677
|
+
baseIcons = FEATHER_ICONS;
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
// Merge custom icons if provided
|
|
681
|
+
return customIcons ? Object.assign(Object.assign({}, baseIcons), customIcons) : baseIcons;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
var AiAgentService = /** @class */ (function () {
|
|
685
|
+
function AiAgentService(http) {
|
|
686
|
+
this.http = http;
|
|
687
|
+
this.defaultConfig = {
|
|
688
|
+
apiUrl: 'https://localhost:7237/api/AIAgent',
|
|
689
|
+
timeout: 30000,
|
|
690
|
+
retries: 3
|
|
691
|
+
};
|
|
692
|
+
this.config = Object.assign({}, this.defaultConfig);
|
|
693
|
+
}
|
|
694
|
+
AiAgentService.prototype.configure = function (config) {
|
|
695
|
+
this.config = Object.assign(Object.assign({}, this.defaultConfig), config);
|
|
696
|
+
};
|
|
697
|
+
AiAgentService.prototype.testConfiguration = function () {
|
|
698
|
+
// For development purposes, simulate a successful connection
|
|
699
|
+
// when the backend is not available
|
|
700
|
+
console.log('Testing configuration at:', this.config.apiUrl + "/TestConfiguration");
|
|
701
|
+
var headers = new i1.HttpHeaders(Object.assign({ 'Content-Type': 'application/json' }, (this.config.appKey && { 'x-api-key': this.config.appKey })));
|
|
702
|
+
return this.http.get(this.config.apiUrl + "/TestConfiguration", { headers: headers })
|
|
703
|
+
.pipe(operators.timeout(this.config.timeout || 30000), operators.catchError(function (error) {
|
|
704
|
+
console.log('Backend API not available, running in demo mode:', error);
|
|
705
|
+
// Return a mock successful response for demo purposes
|
|
706
|
+
return rxjs.throwError({
|
|
707
|
+
success: false,
|
|
708
|
+
error: 'Backend API not available (Demo Mode)'
|
|
709
|
+
});
|
|
710
|
+
}));
|
|
711
|
+
};
|
|
712
|
+
AiAgentService.prototype.processInquiry = function (request) {
|
|
713
|
+
var headers = new i1.HttpHeaders(Object.assign({ 'Content-Type': 'application/json' }, (this.config.appKey && { 'x-api-key': this.config.appKey })));
|
|
714
|
+
return this.http.post(this.config.apiUrl + "/ProcessInquiry", request, { headers: headers })
|
|
715
|
+
.pipe(operators.timeout(this.config.timeout || 30000), operators.catchError(function (error) {
|
|
716
|
+
console.log('ProcessInquiry API not available, returning demo response:', error);
|
|
717
|
+
// Return a mock response for demo purposes
|
|
718
|
+
var mockResponse = {
|
|
719
|
+
answer: "Demo Mode: I received your query \"" + request.query + "\". The backend API is currently not available, but the UI is working correctly!",
|
|
720
|
+
contents: [{
|
|
721
|
+
content: "Demo Mode: I received your query \"" + request.query + "\". The backend API is currently not available, but the UI is working correctly!",
|
|
722
|
+
role: 'assistant',
|
|
723
|
+
authorName: 'Maestro (Demo)'
|
|
724
|
+
}]
|
|
725
|
+
};
|
|
726
|
+
// Return the mock response as an Observable
|
|
727
|
+
return new rxjs.Observable(function (observer) {
|
|
728
|
+
setTimeout(function () {
|
|
729
|
+
observer.next(mockResponse);
|
|
730
|
+
observer.complete();
|
|
731
|
+
}, 1000); // Simulate network delay
|
|
732
|
+
});
|
|
733
|
+
}));
|
|
734
|
+
};
|
|
735
|
+
AiAgentService.prototype.handleError = function (error) {
|
|
736
|
+
var errorMessage = 'An error occurred while processing your request.';
|
|
737
|
+
if (error.error instanceof ErrorEvent) {
|
|
738
|
+
// Client-side error
|
|
739
|
+
errorMessage = "Client Error: " + error.error.message;
|
|
740
|
+
}
|
|
741
|
+
else {
|
|
742
|
+
// Server-side error
|
|
743
|
+
errorMessage = "Server Error: " + error.status + " - " + error.message;
|
|
744
|
+
if (error.error && error.error.message) {
|
|
745
|
+
errorMessage += " - " + error.error.message;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
console.error('AiAgentService Error:', error);
|
|
749
|
+
return rxjs.throwError({
|
|
750
|
+
success: false,
|
|
751
|
+
error: errorMessage
|
|
752
|
+
});
|
|
753
|
+
};
|
|
754
|
+
return AiAgentService;
|
|
755
|
+
}());
|
|
756
|
+
AiAgentService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: AiAgentService, deps: [{ token: i1__namespace.HttpClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
757
|
+
AiAgentService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: AiAgentService, providedIn: 'root' });
|
|
758
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: AiAgentService, decorators: [{
|
|
759
|
+
type: i0.Injectable,
|
|
760
|
+
args: [{
|
|
761
|
+
providedIn: 'root'
|
|
762
|
+
}]
|
|
763
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.HttpClient }]; } });
|
|
764
|
+
|
|
765
|
+
var AiChatComponent = /** @class */ (function () {
|
|
766
|
+
function AiChatComponent(aiAgentService, sanitizer) {
|
|
767
|
+
this.aiAgentService = aiAgentService;
|
|
768
|
+
this.sanitizer = sanitizer;
|
|
769
|
+
this.title = 'Chat with Maestro';
|
|
770
|
+
this.placeholder = 'Type your inquiry here... (Press Enter to send, Shift+Enter for new line)';
|
|
771
|
+
this.showDebugInfo = false;
|
|
772
|
+
this.enableImageUpload = false; // Enable/disable image upload button
|
|
773
|
+
this.enableFileUpload = false; // Enable/disable file upload button
|
|
774
|
+
this.iconSet = 'feather'; // Icon set selection
|
|
775
|
+
this.messageReceived = new i0.EventEmitter();
|
|
776
|
+
this.messageSent = new i0.EventEmitter();
|
|
777
|
+
this.fileUploaded = new i0.EventEmitter();
|
|
778
|
+
this.sizeChanged = new i0.EventEmitter();
|
|
779
|
+
this.messages = [];
|
|
780
|
+
this.currentInquiry = '';
|
|
781
|
+
this.authorName = '';
|
|
782
|
+
this.intent = '';
|
|
783
|
+
this.isLoading = false;
|
|
784
|
+
this.configurationStatus = '';
|
|
785
|
+
// Resizing properties
|
|
786
|
+
this.currentSize = 'default';
|
|
787
|
+
this.isFullscreen = false;
|
|
788
|
+
this.isResizing = false;
|
|
789
|
+
this.containerWidth = 800;
|
|
790
|
+
this.containerHeight = 600;
|
|
791
|
+
this.minWidth = 400;
|
|
792
|
+
this.maxWidth = 1400;
|
|
793
|
+
this.minHeight = 400;
|
|
794
|
+
this.maxHeight = window.innerHeight - 100;
|
|
795
|
+
this.startX = 0;
|
|
796
|
+
this.startY = 0;
|
|
797
|
+
this.startWidth = 0;
|
|
798
|
+
this.startHeight = 0;
|
|
799
|
+
// File upload properties
|
|
800
|
+
this.maxFileSize = 10 * 1024 * 1024; // 10MB
|
|
801
|
+
this.allowedImageTypes = ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/webp'];
|
|
802
|
+
this.allowedFileTypes = ['application/pdf', 'application/msword',
|
|
803
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
804
|
+
'text/plain', 'text/csv'];
|
|
805
|
+
this.selectedFiles = [];
|
|
806
|
+
// Icon configuration
|
|
807
|
+
this.icons = getIconSet('feather');
|
|
808
|
+
this.sanitizedIcons = {};
|
|
809
|
+
this.destroy$ = new rxjs.Subject();
|
|
810
|
+
}
|
|
811
|
+
AiChatComponent.prototype.ngOnInit = function () {
|
|
812
|
+
this.configurationStatus = 'Initializing...';
|
|
813
|
+
console.log('AI Chat Component initialized');
|
|
814
|
+
// Load icon set
|
|
815
|
+
this.icons = getIconSet(this.iconSet, this.customIcons);
|
|
816
|
+
this.sanitizeIcons();
|
|
817
|
+
// Configure API URL and App Key if provided
|
|
818
|
+
if (this.apiUrl || this.appKey) {
|
|
819
|
+
this.aiAgentService.configure({
|
|
820
|
+
apiUrl: this.apiUrl,
|
|
821
|
+
appKey: this.appKey
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
try {
|
|
825
|
+
// Load historical messages if provided
|
|
826
|
+
if (this.historicalMessages && this.historicalMessages.length > 0) {
|
|
827
|
+
this.loadHistoricalMessages(this.historicalMessages);
|
|
828
|
+
}
|
|
829
|
+
else {
|
|
830
|
+
this.addWelcomeMessage();
|
|
831
|
+
}
|
|
832
|
+
this.testConfiguration();
|
|
833
|
+
this.loadSavedSize();
|
|
834
|
+
this.applySizePreset(this.currentSize);
|
|
835
|
+
}
|
|
836
|
+
catch (error) {
|
|
837
|
+
console.error('Error during component initialization:', error);
|
|
838
|
+
this.configurationStatus = 'Initialization error';
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
AiChatComponent.prototype.ngOnChanges = function (changes) {
|
|
842
|
+
var _this = this;
|
|
843
|
+
// Detect when historicalMessages input changes
|
|
844
|
+
if (changes['historicalMessages'] && !changes['historicalMessages'].firstChange) {
|
|
845
|
+
var newMessages = changes['historicalMessages'].currentValue;
|
|
846
|
+
// console.log('Historical messages changed:', newMessages);
|
|
847
|
+
// Clear existing messages and reload
|
|
848
|
+
this.messages = [];
|
|
849
|
+
if (newMessages && newMessages.length > 0) {
|
|
850
|
+
this.loadHistoricalMessages(newMessages);
|
|
851
|
+
}
|
|
852
|
+
else {
|
|
853
|
+
this.addWelcomeMessage();
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
// Detect when conversationId changes
|
|
857
|
+
if (changes['conversationId'] && !changes['conversationId'].firstChange) {
|
|
858
|
+
// console.log('Conversation ID changed:', changes['conversationId'].currentValue);
|
|
859
|
+
// Update all existing messages with new conversationId if needed
|
|
860
|
+
this.messages.forEach(function (msg) {
|
|
861
|
+
if (msg.conversationId !== _this.conversationId) {
|
|
862
|
+
msg.conversationId = _this.conversationId;
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
// Detect when icon set changes
|
|
867
|
+
if (changes['iconSet'] || changes['customIcons']) {
|
|
868
|
+
this.icons = getIconSet(this.iconSet, this.customIcons);
|
|
869
|
+
this.sanitizeIcons();
|
|
870
|
+
}
|
|
871
|
+
};
|
|
872
|
+
AiChatComponent.prototype.ngOnDestroy = function () {
|
|
873
|
+
this.destroy$.next();
|
|
874
|
+
this.destroy$.complete();
|
|
875
|
+
};
|
|
876
|
+
/**
|
|
877
|
+
* Sanitize icon SVG strings for safe rendering in innerHTML bindings
|
|
878
|
+
*/
|
|
879
|
+
AiChatComponent.prototype.sanitizeIcons = function () {
|
|
880
|
+
var _this = this;
|
|
881
|
+
this.sanitizedIcons = {};
|
|
882
|
+
Object.keys(this.icons).forEach(function (key) {
|
|
883
|
+
var svgString = _this.icons[key];
|
|
884
|
+
if (svgString) {
|
|
885
|
+
_this.sanitizedIcons[key] = _this.sanitizer.bypassSecurityTrustHtml(svgString);
|
|
886
|
+
}
|
|
887
|
+
});
|
|
888
|
+
};
|
|
889
|
+
AiChatComponent.prototype.testConfiguration = function () {
|
|
890
|
+
var _this = this;
|
|
891
|
+
this.configurationStatus = 'Testing connection...';
|
|
892
|
+
this.aiAgentService.testConfiguration()
|
|
893
|
+
.pipe(operators.takeUntil(this.destroy$))
|
|
894
|
+
.subscribe({
|
|
895
|
+
next: function (response) {
|
|
896
|
+
if (response.success) {
|
|
897
|
+
_this.configurationStatus = 'AI Agent is ready';
|
|
898
|
+
}
|
|
899
|
+
else {
|
|
900
|
+
_this.configurationStatus = "Configuration error: " + response.error;
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
error: function (errorResponse) {
|
|
904
|
+
_this.configurationStatus = "Connection error: Cannot connect to backend service";
|
|
905
|
+
console.error('API connection test failed:', errorResponse);
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
};
|
|
909
|
+
AiChatComponent.prototype.addWelcomeMessage = function () {
|
|
910
|
+
var welcomeText = this.welcomeMessage ||
|
|
911
|
+
"<h3>Hello " + this.firstName + "!</h3>Hi, I'm Maestro\u2014your AI assistant. I'm here to help with your policy-related inquiries.<br><br>How can I assist you today?";
|
|
912
|
+
this.messages.push({
|
|
913
|
+
isUser: false,
|
|
914
|
+
content: welcomeText,
|
|
915
|
+
intent: 'welcome',
|
|
916
|
+
timestamp: new Date()
|
|
917
|
+
});
|
|
918
|
+
};
|
|
919
|
+
/**
|
|
920
|
+
* Load and transform historical messages from parent component
|
|
921
|
+
* Accepts messages in the format from your backend/state management
|
|
922
|
+
*/
|
|
923
|
+
AiChatComponent.prototype.loadHistoricalMessages = function (historicalMessages) {
|
|
924
|
+
var _c;
|
|
925
|
+
var _this = this;
|
|
926
|
+
// console.log('Loading historical messages:', historicalMessages);
|
|
927
|
+
// console.log('Number of messages to load:', historicalMessages.length);
|
|
928
|
+
// Transform your backend format to ChatMessage format
|
|
929
|
+
var transformedMessages = historicalMessages.map(function (msg) {
|
|
930
|
+
// Determine if message is from user based on sender or role
|
|
931
|
+
var isUserMessage = _this.isUserMessage(msg);
|
|
932
|
+
var transformed = {
|
|
933
|
+
messageId: msg.messageId || msg.id,
|
|
934
|
+
conversationId: msg.conversationId || _this.conversationId,
|
|
935
|
+
isUser: isUserMessage,
|
|
936
|
+
content: msg.messageText || msg.message || msg.text || msg.content || '',
|
|
937
|
+
sender: msg.sender || (isUserMessage ? _this.userName || 'User' : 'Maestro'),
|
|
938
|
+
intent: msg.intent || '',
|
|
939
|
+
authorName: msg.authorName || msg.sender,
|
|
940
|
+
confidenceScore: msg.confidenceScore || msg.confidence || 0,
|
|
941
|
+
timestamp: msg.timestamp || msg.createdAt
|
|
942
|
+
? new Date(msg.timestamp || msg.createdAt)
|
|
943
|
+
: new Date(),
|
|
944
|
+
isLoading: false
|
|
945
|
+
};
|
|
946
|
+
// console.log('Transformed message:', transformed);
|
|
947
|
+
return transformed;
|
|
948
|
+
});
|
|
949
|
+
// Sort messages by timestamp to maintain chronological order
|
|
950
|
+
transformedMessages.sort(function (a, b) { return a.timestamp.getTime() - b.timestamp.getTime(); });
|
|
951
|
+
// console.log('Sorted messages count:', transformedMessages.length);
|
|
952
|
+
// Add welcome message first if no messages or load historical messages
|
|
953
|
+
if (transformedMessages.length === 0) {
|
|
954
|
+
// console.log('No messages to load, adding welcome message');
|
|
955
|
+
this.addWelcomeMessage();
|
|
956
|
+
}
|
|
957
|
+
else {
|
|
958
|
+
// Check if first message is a welcome message, if not add one
|
|
959
|
+
var hasWelcome = transformedMessages.some(function (msg) { return msg.intent === 'welcome' || msg.content.includes('Hello'); });
|
|
960
|
+
if (!hasWelcome) {
|
|
961
|
+
// console.log('No welcome message found, adding one');
|
|
962
|
+
this.addWelcomeMessage();
|
|
963
|
+
}
|
|
964
|
+
// console.log('Pushing transformed messages to messages array');
|
|
965
|
+
(_c = this.messages).push.apply(_c, __spreadArray([], __read(transformedMessages)));
|
|
966
|
+
}
|
|
967
|
+
// console.log('Total loaded messages in component:', this.messages.length);
|
|
968
|
+
// console.log('Messages array:', this.messages);
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* Helper method to determine if a message is from the user
|
|
972
|
+
*/
|
|
973
|
+
AiChatComponent.prototype.isUserMessage = function (msg) {
|
|
974
|
+
var _a, _b;
|
|
975
|
+
// Check various properties that might indicate user message
|
|
976
|
+
if (msg.isUser !== undefined)
|
|
977
|
+
return msg.isUser;
|
|
978
|
+
if (msg.role)
|
|
979
|
+
return msg.role.toLowerCase() === 'user';
|
|
980
|
+
if (msg.sender) {
|
|
981
|
+
var sender = msg.sender.toLowerCase();
|
|
982
|
+
return sender === 'user' ||
|
|
983
|
+
sender === ((_a = this.userName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) ||
|
|
984
|
+
sender === ((_b = this.userId) === null || _b === void 0 ? void 0 : _b.toLowerCase()) ||
|
|
985
|
+
sender.includes('user');
|
|
986
|
+
}
|
|
987
|
+
// Default to false (bot message) if can't determine
|
|
988
|
+
return false;
|
|
989
|
+
};
|
|
990
|
+
AiChatComponent.prototype.sendInquiry = function () {
|
|
991
|
+
var _this = this;
|
|
992
|
+
if (!this.currentInquiry.trim() || this.isLoading) {
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
var userMessage = {
|
|
996
|
+
messageId: this.generateMessageId(),
|
|
997
|
+
conversationId: this.conversationId,
|
|
998
|
+
isUser: true,
|
|
999
|
+
sender: this.userName || 'User',
|
|
1000
|
+
intent: this.intent,
|
|
1001
|
+
content: this.currentInquiry,
|
|
1002
|
+
timestamp: new Date()
|
|
1003
|
+
};
|
|
1004
|
+
this.messages.push(userMessage);
|
|
1005
|
+
this.messageSent.emit(userMessage);
|
|
1006
|
+
// Add loading message
|
|
1007
|
+
var loadingMessage = {
|
|
1008
|
+
isUser: false,
|
|
1009
|
+
intent: '',
|
|
1010
|
+
content: 'Processing your inquiry...',
|
|
1011
|
+
timestamp: new Date(),
|
|
1012
|
+
isLoading: true
|
|
1013
|
+
};
|
|
1014
|
+
this.messages.push(loadingMessage);
|
|
1015
|
+
var inquiry = this.currentInquiry.trim();
|
|
1016
|
+
this.currentInquiry = '';
|
|
1017
|
+
this.authorName = '';
|
|
1018
|
+
this.intent = '';
|
|
1019
|
+
this.isLoading = true;
|
|
1020
|
+
var request = {
|
|
1021
|
+
query: inquiry,
|
|
1022
|
+
chatHistory: [],
|
|
1023
|
+
userId: this.userId,
|
|
1024
|
+
userName: this.userName,
|
|
1025
|
+
appSource: this.appSource
|
|
1026
|
+
};
|
|
1027
|
+
this.aiAgentService.processInquiry(request)
|
|
1028
|
+
.pipe(operators.takeUntil(this.destroy$))
|
|
1029
|
+
.subscribe({
|
|
1030
|
+
next: function (response) {
|
|
1031
|
+
_this.isLoading = false;
|
|
1032
|
+
// Remove loading message
|
|
1033
|
+
_this.messages = _this.messages.filter(function (msg) { return !msg.isLoading; });
|
|
1034
|
+
if (response.answer || (response.contents && response.contents.length > 0)) {
|
|
1035
|
+
if (response.answer) {
|
|
1036
|
+
var botMessage = {
|
|
1037
|
+
messageId: _this.generateMessageId(),
|
|
1038
|
+
conversationId: _this.conversationId,
|
|
1039
|
+
isUser: false,
|
|
1040
|
+
sender: 'Maestro',
|
|
1041
|
+
intent: response.searchIntent || inquiry,
|
|
1042
|
+
content: _this.formatMessageContent(response.answer),
|
|
1043
|
+
authorName: response.contents && response.contents.length > 0 ? response.contents[0].authorName : undefined,
|
|
1044
|
+
timestamp: new Date()
|
|
1045
|
+
};
|
|
1046
|
+
_this.messages.push(botMessage);
|
|
1047
|
+
_this.messageReceived.emit(botMessage);
|
|
1048
|
+
}
|
|
1049
|
+
else if (response.contents && response.contents.length > 0) {
|
|
1050
|
+
// Push each content as a separate message
|
|
1051
|
+
response.contents.forEach(function (contentItem) {
|
|
1052
|
+
if (contentItem.content) {
|
|
1053
|
+
var botMessage = {
|
|
1054
|
+
messageId: _this.generateMessageId(),
|
|
1055
|
+
conversationId: _this.conversationId,
|
|
1056
|
+
isUser: false,
|
|
1057
|
+
sender: contentItem.authorName || 'Maestro',
|
|
1058
|
+
intent: response.searchIntent || inquiry,
|
|
1059
|
+
content: _this.formatMessageContent(contentItem.content || 'No content available'),
|
|
1060
|
+
authorName: contentItem.authorName,
|
|
1061
|
+
timestamp: new Date()
|
|
1062
|
+
};
|
|
1063
|
+
_this.messages.push(botMessage);
|
|
1064
|
+
_this.messageReceived.emit(botMessage);
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
else {
|
|
1070
|
+
var errorMessage = {
|
|
1071
|
+
messageId: _this.generateMessageId(),
|
|
1072
|
+
conversationId: _this.conversationId,
|
|
1073
|
+
isUser: false,
|
|
1074
|
+
sender: 'Maestro',
|
|
1075
|
+
intent: inquiry,
|
|
1076
|
+
content: "Sorry, I didn't receive a valid response.",
|
|
1077
|
+
authorName: _this.authorName,
|
|
1078
|
+
timestamp: new Date()
|
|
1079
|
+
};
|
|
1080
|
+
_this.messages.push(errorMessage);
|
|
1081
|
+
_this.messageReceived.emit(errorMessage);
|
|
1082
|
+
}
|
|
1083
|
+
},
|
|
1084
|
+
error: function (error) {
|
|
1085
|
+
_this.isLoading = false;
|
|
1086
|
+
// Remove loading message
|
|
1087
|
+
_this.messages = _this.messages.filter(function (msg) { return !msg.isLoading; });
|
|
1088
|
+
var errorMessage = {
|
|
1089
|
+
messageId: _this.generateMessageId(),
|
|
1090
|
+
conversationId: _this.conversationId,
|
|
1091
|
+
isUser: false,
|
|
1092
|
+
sender: 'Maestro',
|
|
1093
|
+
intent: inquiry,
|
|
1094
|
+
content: 'Sorry, I encountered an error processing your request. Please try again.',
|
|
1095
|
+
authorName: _this.authorName,
|
|
1096
|
+
timestamp: new Date()
|
|
1097
|
+
};
|
|
1098
|
+
_this.messages.push(errorMessage);
|
|
1099
|
+
_this.messageReceived.emit(errorMessage);
|
|
1100
|
+
console.error('Error processing inquiry:', error);
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
};
|
|
1104
|
+
AiChatComponent.prototype.clearChat = function () {
|
|
1105
|
+
this.messages = [];
|
|
1106
|
+
this.addWelcomeMessage();
|
|
1107
|
+
};
|
|
1108
|
+
AiChatComponent.prototype.onKeyPress = function (event) {
|
|
1109
|
+
if (event.key === 'Enter' && !event.shiftKey) {
|
|
1110
|
+
event.preventDefault();
|
|
1111
|
+
this.sendInquiry();
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
AiChatComponent.prototype.trackByIndex = function (index) {
|
|
1115
|
+
return index;
|
|
1116
|
+
};
|
|
1117
|
+
AiChatComponent.prototype.getThemeClass = function () {
|
|
1118
|
+
// Default theme if no template design is specified
|
|
1119
|
+
if (!this.templateDesign) {
|
|
1120
|
+
return 'theme-default';
|
|
1121
|
+
}
|
|
1122
|
+
// Validate and return theme class
|
|
1123
|
+
var validThemes = ['default', 'dark', 'blue', 'green', 'purple', 'minimal', 'corporate', 'red', 'yellow', 'orange'];
|
|
1124
|
+
var theme = this.templateDesign.toLowerCase();
|
|
1125
|
+
if (validThemes.includes(theme)) {
|
|
1126
|
+
return "theme-" + theme;
|
|
1127
|
+
}
|
|
1128
|
+
// Fallback to default if invalid theme
|
|
1129
|
+
console.warn("Invalid theme '" + this.templateDesign + "' provided. Using default theme.");
|
|
1130
|
+
return 'theme-default';
|
|
1131
|
+
};
|
|
1132
|
+
AiChatComponent.prototype.formatMessageContent = function (content) {
|
|
1133
|
+
var e_1, _c;
|
|
1134
|
+
if (!content)
|
|
1135
|
+
return '';
|
|
1136
|
+
// If content already contains HTML tags, return as-is
|
|
1137
|
+
if (content.includes('<') && content.includes('>')) {
|
|
1138
|
+
return content;
|
|
1139
|
+
}
|
|
1140
|
+
// Convert newlines to HTML breaks
|
|
1141
|
+
var formatted = content.replace(/\n/g, '<br>');
|
|
1142
|
+
// Convert escaped newlines to HTML breaks
|
|
1143
|
+
formatted = formatted.replace(/\\n/g, '<br>');
|
|
1144
|
+
// Convert markdown-style bold to HTML
|
|
1145
|
+
formatted = formatted.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');
|
|
1146
|
+
// Convert bullet points to HTML lists
|
|
1147
|
+
var lines = formatted.split('<br>');
|
|
1148
|
+
var inList = false;
|
|
1149
|
+
var processedLines = [];
|
|
1150
|
+
try {
|
|
1151
|
+
for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {
|
|
1152
|
+
var line = lines_1_1.value;
|
|
1153
|
+
if (line.trim().startsWith('• ')) {
|
|
1154
|
+
if (!inList) {
|
|
1155
|
+
processedLines.push('<ul>');
|
|
1156
|
+
inList = true;
|
|
1157
|
+
}
|
|
1158
|
+
processedLines.push('<li>' + line.replace(/^• /, '') + '</li>');
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
if (inList) {
|
|
1162
|
+
processedLines.push('</ul>');
|
|
1163
|
+
inList = false;
|
|
1164
|
+
}
|
|
1165
|
+
processedLines.push(line);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1170
|
+
finally {
|
|
1171
|
+
try {
|
|
1172
|
+
if (lines_1_1 && !lines_1_1.done && (_c = lines_1.return)) _c.call(lines_1);
|
|
1173
|
+
}
|
|
1174
|
+
finally { if (e_1) throw e_1.error; }
|
|
1175
|
+
}
|
|
1176
|
+
if (inList) {
|
|
1177
|
+
processedLines.push('</ul>');
|
|
1178
|
+
}
|
|
1179
|
+
return processedLines.join('<br>').replace(/<br><ul>/g, '<ul>').replace(/<\/ul><br>/g, '</ul>');
|
|
1180
|
+
};
|
|
1181
|
+
AiChatComponent.prototype.generateSessionId = function () {
|
|
1182
|
+
return 'session_' + Math.random().toString(36).substr(2, 9) + '_' + Date.now();
|
|
1183
|
+
};
|
|
1184
|
+
AiChatComponent.prototype.generateMessageId = function () {
|
|
1185
|
+
return 'msg_' + Math.random().toString(36).substr(2, 9) + '_' + Date.now();
|
|
1186
|
+
};
|
|
1187
|
+
AiChatComponent.prototype.getFormattedTime = function (timestamp) {
|
|
1188
|
+
return timestamp.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
1189
|
+
};
|
|
1190
|
+
// ============= Resize Methods =============
|
|
1191
|
+
AiChatComponent.prototype.startResize = function (event, direction) {
|
|
1192
|
+
var _this = this;
|
|
1193
|
+
event.preventDefault();
|
|
1194
|
+
this.isResizing = true;
|
|
1195
|
+
this.startX = event.clientX;
|
|
1196
|
+
this.startY = event.clientY;
|
|
1197
|
+
this.startWidth = this.containerWidth;
|
|
1198
|
+
this.startHeight = this.containerHeight;
|
|
1199
|
+
var mouseMoveHandler = function (e) { return _this.onResize(e, direction); };
|
|
1200
|
+
var mouseUpHandler = function () { return _this.stopResize(mouseMoveHandler, mouseUpHandler); };
|
|
1201
|
+
document.addEventListener('mousemove', mouseMoveHandler);
|
|
1202
|
+
document.addEventListener('mouseup', mouseUpHandler);
|
|
1203
|
+
};
|
|
1204
|
+
AiChatComponent.prototype.onResize = function (event, direction) {
|
|
1205
|
+
if (!this.isResizing)
|
|
1206
|
+
return;
|
|
1207
|
+
var deltaX = event.clientX - this.startX;
|
|
1208
|
+
var deltaY = event.clientY - this.startY;
|
|
1209
|
+
if (direction === 'width' || direction === 'both') {
|
|
1210
|
+
var newWidth = Math.min(Math.max(this.startWidth + deltaX, this.minWidth), this.maxWidth);
|
|
1211
|
+
this.containerWidth = newWidth;
|
|
1212
|
+
}
|
|
1213
|
+
if (direction === 'both') {
|
|
1214
|
+
var newHeight = Math.min(Math.max(this.startHeight + deltaY, this.minHeight), this.maxHeight);
|
|
1215
|
+
this.containerHeight = newHeight;
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
AiChatComponent.prototype.stopResize = function (mouseMoveHandler, mouseUpHandler) {
|
|
1219
|
+
this.isResizing = false;
|
|
1220
|
+
document.removeEventListener('mousemove', mouseMoveHandler);
|
|
1221
|
+
document.removeEventListener('mouseup', mouseUpHandler);
|
|
1222
|
+
this.saveSizePreference();
|
|
1223
|
+
this.emitSizeChange();
|
|
1224
|
+
};
|
|
1225
|
+
AiChatComponent.prototype.applySizePreset = function (size) {
|
|
1226
|
+
this.currentSize = size;
|
|
1227
|
+
switch (size) {
|
|
1228
|
+
case 'compact':
|
|
1229
|
+
this.containerWidth = 400;
|
|
1230
|
+
this.containerHeight = 500;
|
|
1231
|
+
this.isFullscreen = false;
|
|
1232
|
+
break;
|
|
1233
|
+
case 'default':
|
|
1234
|
+
this.containerWidth = 800;
|
|
1235
|
+
this.containerHeight = 600;
|
|
1236
|
+
this.isFullscreen = false;
|
|
1237
|
+
break;
|
|
1238
|
+
case 'expanded':
|
|
1239
|
+
this.containerWidth = 1200;
|
|
1240
|
+
this.containerHeight = 800;
|
|
1241
|
+
this.isFullscreen = false;
|
|
1242
|
+
break;
|
|
1243
|
+
case 'fullscreen':
|
|
1244
|
+
this.toggleFullscreen();
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
this.saveSizePreference();
|
|
1248
|
+
this.emitSizeChange();
|
|
1249
|
+
};
|
|
1250
|
+
AiChatComponent.prototype.toggleFullscreen = function () {
|
|
1251
|
+
if (!this.isFullscreen) {
|
|
1252
|
+
// Entering fullscreen - save current state first
|
|
1253
|
+
sessionStorage.setItem('chatbox-previous-size', JSON.stringify({
|
|
1254
|
+
width: this.containerWidth,
|
|
1255
|
+
height: this.containerHeight,
|
|
1256
|
+
size: this.currentSize,
|
|
1257
|
+
wasFullscreen: this.isFullscreen
|
|
1258
|
+
}));
|
|
1259
|
+
this.isFullscreen = true;
|
|
1260
|
+
this.currentSize = 'fullscreen';
|
|
1261
|
+
}
|
|
1262
|
+
else {
|
|
1263
|
+
// Exiting fullscreen - restore previous state
|
|
1264
|
+
try {
|
|
1265
|
+
var previous = sessionStorage.getItem('chatbox-previous-size');
|
|
1266
|
+
if (previous) {
|
|
1267
|
+
var prevData = JSON.parse(previous);
|
|
1268
|
+
this.containerWidth = prevData.width || 800;
|
|
1269
|
+
this.containerHeight = prevData.height || 600;
|
|
1270
|
+
this.currentSize = prevData.size === 'fullscreen' ? 'default' : prevData.size;
|
|
1271
|
+
}
|
|
1272
|
+
else {
|
|
1273
|
+
this.currentSize = 'default';
|
|
1274
|
+
this.containerWidth = 800;
|
|
1275
|
+
this.containerHeight = 600;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
catch (error) {
|
|
1279
|
+
this.currentSize = 'default';
|
|
1280
|
+
this.containerWidth = 800;
|
|
1281
|
+
this.containerHeight = 600;
|
|
1282
|
+
}
|
|
1283
|
+
this.isFullscreen = false;
|
|
1284
|
+
}
|
|
1285
|
+
this.saveSizePreference();
|
|
1286
|
+
this.emitSizeChange();
|
|
1287
|
+
};
|
|
1288
|
+
AiChatComponent.prototype.saveSizePreference = function () {
|
|
1289
|
+
var sizeData = {
|
|
1290
|
+
size: this.currentSize,
|
|
1291
|
+
width: this.containerWidth,
|
|
1292
|
+
height: this.containerHeight,
|
|
1293
|
+
isFullscreen: this.isFullscreen
|
|
1294
|
+
};
|
|
1295
|
+
try {
|
|
1296
|
+
sessionStorage.setItem('chatbox-size-preference', JSON.stringify(sizeData));
|
|
1297
|
+
}
|
|
1298
|
+
catch (error) {
|
|
1299
|
+
console.warn('Failed to save size preference:', error);
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1302
|
+
AiChatComponent.prototype.loadSavedSize = function () {
|
|
1303
|
+
try {
|
|
1304
|
+
var saved = sessionStorage.getItem('chatbox-size-preference');
|
|
1305
|
+
if (saved) {
|
|
1306
|
+
var sizeData = JSON.parse(saved);
|
|
1307
|
+
this.currentSize = sizeData.size || 'default';
|
|
1308
|
+
this.containerWidth = sizeData.width || 800;
|
|
1309
|
+
this.containerHeight = sizeData.height || 600;
|
|
1310
|
+
this.isFullscreen = sizeData.isFullscreen || false;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
catch (error) {
|
|
1314
|
+
console.warn('Failed to load size preference:', error);
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1317
|
+
AiChatComponent.prototype.emitSizeChange = function () {
|
|
1318
|
+
this.sizeChanged.emit({
|
|
1319
|
+
size: this.currentSize,
|
|
1320
|
+
width: this.containerWidth,
|
|
1321
|
+
height: this.containerHeight
|
|
1322
|
+
});
|
|
1323
|
+
};
|
|
1324
|
+
AiChatComponent.prototype.getContainerStyle = function () {
|
|
1325
|
+
if (this.isFullscreen) {
|
|
1326
|
+
return {
|
|
1327
|
+
width: '100vw !important',
|
|
1328
|
+
height: '100vh !important',
|
|
1329
|
+
maxWidth: '100vw !important',
|
|
1330
|
+
maxHeight: '100vh !important',
|
|
1331
|
+
position: 'fixed',
|
|
1332
|
+
top: '0',
|
|
1333
|
+
left: '0',
|
|
1334
|
+
right: '0',
|
|
1335
|
+
bottom: '0',
|
|
1336
|
+
margin: '0',
|
|
1337
|
+
zIndex: 99999
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
return {
|
|
1341
|
+
width: this.containerWidth + "px",
|
|
1342
|
+
height: this.containerHeight + "px",
|
|
1343
|
+
maxWidth: this.maxWidth + "px"
|
|
1344
|
+
};
|
|
1345
|
+
};
|
|
1346
|
+
// ============= File Upload Methods =============
|
|
1347
|
+
AiChatComponent.prototype.onImageUpload = function (event) {
|
|
1348
|
+
var input = event.target;
|
|
1349
|
+
if (input.files && input.files.length > 0) {
|
|
1350
|
+
this.handleFileSelection(Array.from(input.files), 'image');
|
|
1351
|
+
}
|
|
1352
|
+
};
|
|
1353
|
+
AiChatComponent.prototype.onFileUpload = function (event) {
|
|
1354
|
+
var input = event.target;
|
|
1355
|
+
if (input.files && input.files.length > 0) {
|
|
1356
|
+
this.handleFileSelection(Array.from(input.files), 'file');
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
AiChatComponent.prototype.handleFileSelection = function (files, type) {
|
|
1360
|
+
var _this = this;
|
|
1361
|
+
files.forEach(function (file) {
|
|
1362
|
+
// Validate file type
|
|
1363
|
+
var allowedTypes = type === 'image' ? _this.allowedImageTypes : _this.allowedFileTypes;
|
|
1364
|
+
if (!allowedTypes.includes(file.type)) {
|
|
1365
|
+
console.warn("File type " + file.type + " not allowed");
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1368
|
+
// Validate file size
|
|
1369
|
+
if (file.size > _this.maxFileSize) {
|
|
1370
|
+
console.warn("File " + file.name + " exceeds maximum size of " + _this.maxFileSize / 1024 / 1024 + "MB");
|
|
1371
|
+
return;
|
|
1372
|
+
}
|
|
1373
|
+
var reader = new FileReader();
|
|
1374
|
+
reader.onload = function (e) {
|
|
1375
|
+
var _a;
|
|
1376
|
+
var attachment = {
|
|
1377
|
+
id: _this.generateMessageId(),
|
|
1378
|
+
name: file.name,
|
|
1379
|
+
type: file.type,
|
|
1380
|
+
size: file.size,
|
|
1381
|
+
data: ((_a = e.target) === null || _a === void 0 ? void 0 : _a.result) || undefined
|
|
1382
|
+
};
|
|
1383
|
+
_this.selectedFiles.push(attachment);
|
|
1384
|
+
_this.fileUploaded.emit(attachment);
|
|
1385
|
+
};
|
|
1386
|
+
if (type === 'image') {
|
|
1387
|
+
reader.readAsDataURL(file);
|
|
1388
|
+
}
|
|
1389
|
+
else {
|
|
1390
|
+
reader.readAsArrayBuffer(file);
|
|
1391
|
+
}
|
|
1392
|
+
});
|
|
1393
|
+
};
|
|
1394
|
+
AiChatComponent.prototype.removeAttachment = function (attachmentId) {
|
|
1395
|
+
this.selectedFiles = this.selectedFiles.filter(function (f) { return f.id !== attachmentId; });
|
|
1396
|
+
};
|
|
1397
|
+
AiChatComponent.prototype.triggerImageUpload = function () {
|
|
1398
|
+
var input = document.getElementById('image-upload-input');
|
|
1399
|
+
if (input) {
|
|
1400
|
+
input.click();
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
AiChatComponent.prototype.triggerFileUpload = function () {
|
|
1404
|
+
var input = document.getElementById('file-upload-input');
|
|
1405
|
+
if (input) {
|
|
1406
|
+
input.click();
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1409
|
+
AiChatComponent.prototype.getFileIcon = function (fileType) {
|
|
1410
|
+
if (fileType.startsWith('image/'))
|
|
1411
|
+
return '🖼️';
|
|
1412
|
+
if (fileType.includes('pdf'))
|
|
1413
|
+
return '📄';
|
|
1414
|
+
if (fileType.includes('word') || fileType.includes('document'))
|
|
1415
|
+
return '📝';
|
|
1416
|
+
if (fileType.includes('text'))
|
|
1417
|
+
return '📃';
|
|
1418
|
+
return '📎';
|
|
1419
|
+
};
|
|
1420
|
+
AiChatComponent.prototype.getFileSizeFormatted = function (bytes) {
|
|
1421
|
+
if (bytes < 1024)
|
|
1422
|
+
return bytes + ' B';
|
|
1423
|
+
if (bytes < 1024 * 1024)
|
|
1424
|
+
return (bytes / 1024).toFixed(1) + ' KB';
|
|
1425
|
+
return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
|
|
1426
|
+
};
|
|
1427
|
+
return AiChatComponent;
|
|
1428
|
+
}());
|
|
1429
|
+
AiChatComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: AiChatComponent, deps: [{ token: AiAgentService }, { token: i2__namespace.DomSanitizer }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1430
|
+
AiChatComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: AiChatComponent, selector: "emanate-ai-chat", inputs: { title: "title", placeholder: "placeholder", showDebugInfo: "showDebugInfo", apiUrl: "apiUrl", appKey: "appKey", appSource: "appSource", userId: "userId", firstName: "firstName", userName: "userName", templateDesign: "templateDesign", welcomeMessage: "welcomeMessage", historicalMessages: "historicalMessages", conversationId: "conversationId", enableImageUpload: "enableImageUpload", enableFileUpload: "enableFileUpload", iconSet: "iconSet", customIcons: "customIcons" }, outputs: { messageReceived: "messageReceived", messageSent: "messageSent", fileUploaded: "fileUploaded", sizeChanged: "sizeChanged" }, usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"ai-chat-container\" \r\n [ngClass]=\"getThemeClass()\" \r\n [ngStyle]=\"getContainerStyle()\"\r\n [class.fullscreen]=\"isFullscreen\"\r\n [class.resizing]=\"isResizing\">\r\n \r\n <!-- Resize Handles -->\r\n <div class=\"resize-handle resize-handle-right\" \r\n (mousedown)=\"startResize($event, 'width')\"\r\n *ngIf=\"!isFullscreen\"\r\n title=\"Drag to resize width\">\r\n </div>\r\n \r\n <div class=\"resize-handle resize-handle-corner\" \r\n (mousedown)=\"startResize($event, 'both')\"\r\n *ngIf=\"!isFullscreen\"\r\n title=\"Drag to resize\">\r\n </div>\r\n \r\n <!-- Debug Information (only shown when showDebugInfo is true) -->\r\n <div *ngIf=\"showDebugInfo\" class=\"debug-info\">\r\n <h3>DEBUG: AI Chat Component Loaded</h3>\r\n <p>Status: {{ configurationStatus || 'Loading...' }}</p>\r\n <p>Messages count: {{ messages.length || 0 }}</p>\r\n <p>Theme: {{ templateDesign || 'default' }}</p>\r\n <p>Size: {{ currentSize }} ({{ containerWidth }}x{{ containerHeight }})</p>\r\n </div>\r\n\r\n <div class=\"chat-header\">\r\n <div class=\"header-left\">\r\n <h2>{{ title }}</h2>\r\n <!-- Icon-only status indicator -->\r\n <div class=\"status-indicator-icon\" \r\n [ngClass]=\"{'status-ready': configurationStatus === 'AI Agent is ready', \r\n 'status-error': configurationStatus !== 'AI Agent is ready',\r\n 'status-loading': configurationStatus === 'Initializing...' || configurationStatus === 'Testing connection...'}\"\r\n [title]=\"configurationStatus\">\r\n </div>\r\n </div>\r\n \r\n <div class=\"header-controls\">\r\n <!-- Size Preset Buttons -->\r\n <div class=\"size-controls\" *ngIf=\"!isFullscreen\">\r\n <button class=\"control-button size-button\" \r\n (click)=\"applySizePreset('compact')\"\r\n [class.active]=\"currentSize === 'compact'\"\r\n title=\"Compact View\"\r\n attr.aria-label=\"Compact View\">\r\n <span class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.compactView\"></span>\r\n </button>\r\n <button class=\"control-button size-button\" \r\n (click)=\"applySizePreset('default')\"\r\n [class.active]=\"currentSize === 'default'\"\r\n title=\"Default View\"\r\n attr.aria-label=\"Default View\">\r\n <span class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.defaultView\"></span>\r\n </button>\r\n <button class=\"control-button size-button\" \r\n (click)=\"applySizePreset('expanded')\"\r\n [class.active]=\"currentSize === 'expanded'\"\r\n title=\"Expanded View\"\r\n attr.aria-label=\"Expanded View\">\r\n <span class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.expandedView\"></span>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"chat-messages\" #messagesContainer>\r\n <div *ngFor=\"let message of messages; let i = index; trackBy: trackByIndex\" class=\"message-wrapper\">\r\n <!-- Message -->\r\n <div class=\"message\" \r\n [ngClass]=\"{'user-message': message.isUser, 'ai-message': !message.isUser, 'loading-message': message.isLoading}\">\r\n \r\n <div class=\"message-content\">\r\n <div [innerHTML]=\"message.content\"></div>\r\n <div class=\"message-timestamp\">{{ getFormattedTime(message.timestamp) }}</div>\r\n </div>\r\n \r\n <div class=\"message-avatar\">\r\n <span *ngIf=\"message.isUser\" class=\"avatar-icon\" [innerHTML]=\"sanitizedIcons.userAvatar\"></span>\r\n <span *ngIf=\"!message.isUser && !message.isLoading\" class=\"avatar-icon\" [innerHTML]=\"sanitizedIcons.aiAvatar\"></span>\r\n <span *ngIf=\"message.isLoading\" class=\"avatar-icon loading-spinner\" [innerHTML]=\"sanitizedIcons.loadingAvatar\"></span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class=\"chat-input\">\r\n <!-- Attachments Preview -->\r\n <div class=\"attachments-preview\" *ngIf=\"selectedFiles.length > 0\">\r\n <div class=\"attachment-item\" *ngFor=\"let file of selectedFiles\">\r\n <svg class=\"attachment-icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\r\n <path d=\"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48\"></path>\r\n </svg>\r\n <span class=\"attachment-name\">{{ file.name }}</span>\r\n <span class=\"attachment-size\">{{ getFileSizeFormatted(file.size) }}</span>\r\n <button class=\"remove-attachment\" (click)=\"removeAttachment(file.id)\" title=\"Remove\" attr.aria-label=\"Remove attachment\">\r\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\r\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\r\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n \r\n <div class=\"input-container\">\r\n <!-- File Upload Inputs (Hidden) -->\r\n <input type=\"file\" \r\n id=\"image-upload-input\" \r\n accept=\"image/*\" \r\n multiple \r\n (change)=\"onImageUpload($event)\"\r\n style=\"display: none;\"\r\n [disabled]=\"!enableImageUpload\">\r\n \r\n <input type=\"file\" \r\n id=\"file-upload-input\" \r\n accept=\".pdf,.doc,.docx,.txt,.csv\" \r\n multiple \r\n (change)=\"onFileUpload($event)\"\r\n style=\"display: none;\"\r\n [disabled]=\"!enableFileUpload\">\r\n \r\n <!-- Upload Buttons (Conditionally rendered) -->\r\n <div class=\"upload-buttons\" *ngIf=\"enableImageUpload || enableFileUpload\">\r\n <button *ngIf=\"enableImageUpload\" \r\n class=\"upload-button image-upload\" \r\n (click)=\"triggerImageUpload()\"\r\n [disabled]=\"isLoading\"\r\n title=\"Upload Image\"\r\n attr.aria-label=\"Upload Image\">\r\n <span class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.imageUpload\"></span>\r\n </button>\r\n \r\n <button *ngIf=\"enableFileUpload\" \r\n class=\"upload-button file-upload\" \r\n (click)=\"triggerFileUpload()\"\r\n [disabled]=\"isLoading\"\r\n title=\"Attach File\"\r\n attr.aria-label=\"Attach File\">\r\n <span class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.fileUpload\"></span>\r\n </button>\r\n </div>\r\n \r\n <textarea \r\n [(ngModel)]=\"currentInquiry\" \r\n (keypress)=\"onKeyPress($event)\"\r\n [placeholder]=\"placeholder\"\r\n rows=\"2\"\r\n [disabled]=\"isLoading\"\r\n class=\"inquiry-textarea\"\r\n attr.aria-label=\"Type your message\"></textarea>\r\n \r\n <button \r\n (click)=\"sendInquiry()\" \r\n [disabled]=\"!currentInquiry.trim() || isLoading\"\r\n class=\"send-button\"\r\n title=\"Send Message\"\r\n attr.aria-label=\"Send Message\">\r\n <span *ngIf=\"!isLoading\" class=\"icon-svg\" [innerHTML]=\"sanitizedIcons.send\"></span>\r\n <span *ngIf=\"isLoading\" class=\"icon-svg loading-icon\" [innerHTML]=\"sanitizedIcons.sendLoading\"></span>\r\n <span class=\"text\">{{ isLoading ? 'Sending...' : 'Send' }}</span>\r\n </button>\r\n </div>\r\n </div>\r\n</div>", styles: ["@charset \"UTF-8\";.ai-chat-container{display:flex;flex-direction:column;height:100vh;max-width:800px;margin:0 auto;background:#ffffff;border-radius:12px;overflow:hidden;position:relative;transition:all .25s cubic-bezier(.4,0,.2,1);box-shadow:0 2px 8px #00000014,0 4px 16px #0000000a;--icon-primary: #667eea;--icon-secondary: #6b7280;--icon-avatar-user: #667eea;--icon-avatar-ai: #764ba2;--icon-header: #ffffff;--icon-upload: #667eea;--icon-send: #ffffff;--icon-active: #667eea;--icon-disabled: #d1d5db;--icon-hover: #5568d3}.ai-chat-container.fullscreen{position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:0!important;width:100vw!important;height:100vh!important;max-width:100vw!important;max-height:100vh!important;border-radius:0;z-index:99999;margin:0}.ai-chat-container.resizing{-webkit-user-select:none;user-select:none;cursor:nwse-resize;transition:none}.resize-handle{position:absolute;background:rgba(102,126,234,.3);transition:background .2s ease;z-index:10}.resize-handle:hover{background:rgba(102,126,234,.6)}.resize-handle.resize-handle-right{top:0;right:-4px;width:8px;height:100%;cursor:ew-resize}.resize-handle.resize-handle-corner{bottom:-4px;right:-4px;width:20px;height:20px;cursor:nwse-resize;border-radius:0 0 8px}.resize-handle.resize-handle-corner:after{content:\"\\22f0\";position:absolute;bottom:2px;right:2px;font-size:12px;color:#fffc}.debug-info{background:yellow;padding:10px;border:1px solid orange}.debug-info h3{margin:0;font-size:1.2rem}.debug-info p{margin:5px 0}.icon-svg{display:inline-block;width:20px;height:20px;color:var(--icon-secondary)}.icon-svg svg{width:100%;height:100%;stroke-width:2;transition:all .2s ease}.avatar-icon{display:inline-block;width:28px;height:28px}.avatar-icon svg{width:100%;height:100%}.chat-header{background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:#fff;padding:1rem 1.25rem;display:flex;justify-content:space-between;align-items:center;grid-gap:1rem;gap:1rem;flex-wrap:wrap;box-shadow:0 2px 4px #0000001a}.chat-header .header-left{display:flex;align-items:center;grid-gap:.75rem;gap:.75rem;flex:1;min-width:200px}.chat-header .header-left h2{margin:0;font-size:1.25rem;font-weight:600;letter-spacing:-.01em}.chat-header .header-controls{display:flex;align-items:center;grid-gap:.5rem;gap:.5rem}.chat-header .header-controls .icon-svg{color:var(--icon-header)}.chat-header .status-indicator-icon{width:10px;height:10px;border-radius:50%;background:rgba(255,255,255,.4);transition:all .3s ease;box-shadow:0 0 0 2px #fff3;cursor:help}.chat-header .status-indicator-icon.status-ready{background:#2ecc71;box-shadow:0 0 0 2px #2ecc714d,0 0 8px #2ecc7166}.chat-header .status-indicator-icon.status-error{background:#e74c3c;box-shadow:0 0 0 2px #e74c3c4d,0 0 8px #e74c3c66}.chat-header .status-indicator-icon.status-loading{background:#f39c12;box-shadow:0 0 0 2px #f39c124d;animation:pulse 1.5s ease-in-out infinite}@keyframes pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.6;transform:scale(1.1)}}.size-controls{display:flex;grid-gap:.5rem;gap:.5rem;background:transparent;padding:0;border-radius:0;backdrop-filter:none}.control-button{background:transparent;border:none;border-radius:0;width:28px;height:28px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s cubic-bezier(.4,0,.2,1);color:#fff;padding:0}.control-button .icon-svg{width:18px;height:18px;color:var(--icon-header)}.control-button:hover:not(:disabled){opacity:.8;transform:scale(1.1)}.control-button:active:not(:disabled){transform:scale(.95)}.control-button.active{opacity:1;transform:scale(1.15)}.control-button:disabled{opacity:.4;cursor:not-allowed}.fullscreen-button{background:transparent}.fullscreen-button:hover:not(:disabled){opacity:.8;transform:scale(1.1)}.clear-button{background:transparent}.clear-button:hover:not(:disabled){opacity:.8;transform:scale(1.1);color:#fcc}.chat-messages{flex:1;overflow-y:auto;overflow-x:hidden;padding:1.25rem;display:flex;flex-direction:column;grid-gap:.875rem;gap:.875rem;scroll-behavior:smooth;background:#f8f9fa}.chat-messages::-webkit-scrollbar{width:6px}.chat-messages::-webkit-scrollbar-track{background:transparent}.chat-messages::-webkit-scrollbar-thumb{background:rgba(0,0,0,.15);border-radius:3px}.chat-messages::-webkit-scrollbar-thumb:hover{background:rgba(0,0,0,.25)}.message-wrapper{display:flex;flex-direction:column}.message{display:flex;max-width:75%;animation:fadeInSlide .25s cubic-bezier(.4,0,.2,1)}.message.user-message{align-self:flex-end;flex-direction:row-reverse}.message.user-message .message-content{background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;border-radius:18px 18px 4px;box-shadow:0 1px 2px #0000001a}.message.user-message .avatar-icon{color:var(--icon-avatar-user)}.message.ai-message{align-self:flex-start}.message.ai-message .message-content{background:white;color:#1a1a1a;border-radius:18px 18px 18px 4px;border:1px solid #e8e8e8;box-shadow:0 1px 2px #0000000d}.message.ai-message .avatar-icon{color:var(--icon-avatar-ai)}.message.loading-message{opacity:.7}.message.loading-message .message-content{font-style:italic}@keyframes fadeInSlide{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.message-content{padding:.75rem 1rem;margin:0 .5rem;word-wrap:break-word;max-width:100%;line-height:1.5;font-size:.9375rem}.message-timestamp{font-size:.6875rem;opacity:.65;margin-top:.375rem;text-align:right;font-weight:500}.message-avatar{width:36px;height:36px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.message-avatar .avatar-icon{opacity:.9}.loading-spinner{animation:spin 1.2s linear infinite;opacity:.7}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.chat-input{background:white;padding:1rem 1.25rem;border-top:1px solid #e8e8e8;display:flex;flex-direction:column;grid-gap:.75rem;gap:.75rem;box-shadow:0 -2px 8px #0000000a}.input-container{display:flex;grid-gap:.5rem;gap:.5rem;align-items:flex-end}.upload-buttons{display:flex;grid-gap:.5rem;gap:.5rem;flex-direction:column}.upload-button{background:#f5f5f5;border:1px solid #e0e0e0;border-radius:10px;width:42px;height:42px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s cubic-bezier(.4,0,.2,1)}.upload-button .icon-svg{width:20px;height:20px;color:var(--icon-upload)}.upload-button:hover:not(:disabled){background:var(--icon-upload);border-color:var(--icon-upload);transform:translateY(-1px);box-shadow:0 2px 8px #667eea40}.upload-button:hover:not(:disabled) .icon-svg{color:#fff}.upload-button:active:not(:disabled){transform:translateY(0)}.upload-button:disabled{opacity:.4;cursor:not-allowed;background:#fafafa}.attachments-preview{display:flex;flex-wrap:wrap;grid-gap:.5rem;gap:.5rem;padding:.75rem;background:#f8f9fa;border-radius:10px;border:1px solid #e8e8e8}.attachment-item{display:flex;align-items:center;grid-gap:.625rem;gap:.625rem;background:white;border:1px solid #e0e0e0;border-radius:8px;padding:.625rem .875rem;font-size:.875rem;transition:all .2s ease}.attachment-item:hover{border-color:#667eea;box-shadow:0 2px 4px #667eea1a}.attachment-item .attachment-icon{width:20px;height:20px;color:#667eea;flex-shrink:0}.attachment-item .attachment-name{font-weight:500;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#1a1a1a}.attachment-item .attachment-size{color:#666;font-size:.75rem;font-weight:500}.attachment-item .remove-attachment{background:transparent;border:none;color:#999;cursor:pointer;padding:.25rem;margin-left:.25rem;transition:all .2s ease;display:flex;align-items:center;justify-content:center;border-radius:4px}.attachment-item .remove-attachment svg{width:16px;height:16px}.attachment-item .remove-attachment:hover{color:#e74c3c;background:rgba(231,76,60,.1)}.inquiry-textarea{flex:1;border:1.5px solid #e0e0e0;border-radius:22px;padding:.875rem 1.125rem;font-family:inherit;font-size:.9375rem;line-height:1.5;resize:none;outline:none;transition:all .2s cubic-bezier(.4,0,.2,1);background:#fafafa}.inquiry-textarea:focus{border-color:#667eea;background:white;box-shadow:0 0 0 3px #667eea14}.inquiry-textarea:disabled{background:#f5f5f5;cursor:not-allowed;opacity:.6}.inquiry-textarea::placeholder{color:#999}.send-button{background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;border:none;border-radius:50px;padding:.875rem 1.75rem;font-size:.9375rem;font-weight:600;cursor:pointer;display:flex;align-items:center;grid-gap:.5rem;gap:.5rem;transition:all .2s cubic-bezier(.4,0,.2,1);min-width:110px;justify-content:center;box-shadow:0 2px 8px #667eea40}.send-button .icon-svg{width:18px;height:18px;color:var(--icon-send)}.send-button .loading-icon{animation:spin 1.2s linear infinite}.send-button:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 4px 16px #667eea66}.send-button:active:not(:disabled){transform:translateY(0)}.send-button:disabled{background:#d0d0d0;cursor:not-allowed;box-shadow:none;opacity:.6}@media (max-width: 768px){.ai-chat-container{max-width:100%;border-radius:0;height:100vh}.ai-chat-container:not(.fullscreen){width:100%!important}.resize-handle{display:none}.size-controls{display:none}.chat-header{padding:.875rem 1rem}.chat-header .header-left h2{font-size:1.125rem}.chat-header .status-indicator-icon{width:8px;height:8px}.control-button{width:36px;height:36px}.control-button .icon-svg{width:18px;height:18px}.message{max-width:85%}.message-content{font-size:.875rem}.upload-buttons{flex-direction:row}.input-container{flex-wrap:wrap}.send-button{min-width:90px;padding:.75rem 1.25rem}.send-button .text{display:none}.chat-input{padding:.875rem 1rem}}@media (max-width: 480px){.chat-header{flex-direction:column;align-items:flex-start;grid-gap:.625rem;gap:.625rem}.chat-header .header-controls{width:100%;justify-content:space-between}.control-button{width:34px;height:34px}.control-button .icon-svg{width:16px;height:16px}.message-content{padding:.625rem .875rem;font-size:.875rem}.attachments-preview{flex-direction:column}.attachment-item{width:100%}.attachment-item .attachment-name{max-width:120px}.send-button{padding:.75rem 1rem;min-width:80px}}.control-button:focus,.upload-button:focus,.send-button:focus,.clear-button:focus{outline:3px solid #667eea;outline-offset:2px}@media (prefers-contrast: high){.control-button,.upload-button,.send-button{border:2px solid currentColor}.message-content{border:2px solid currentColor}}@media (prefers-reduced-motion: reduce){*{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}.theme-dark{background:#2c2c2c;--icon-primary: #818cf8;--icon-secondary: #9ca3af;--icon-avatar-user: #818cf8;--icon-avatar-ai: #a78bfa;--icon-header: #e5e7eb;--icon-upload: #818cf8;--icon-send: #ffffff;--icon-active: #818cf8;--icon-disabled: #4b5563;--icon-hover: #6366f1}.theme-dark .chat-header{background:linear-gradient(135deg,#1a1a1a,#333)}.theme-dark .chat-messages{background:#2c2c2c}.theme-dark .ai-message .message-content{background:#3a3a3a;color:#fff;border-color:#555}.theme-dark .chat-input{background:#3a3a3a;border-color:#555}.theme-dark .inquiry-textarea{background:#2c2c2c;color:#fff;border-color:#555}.theme-dark .inquiry-textarea:focus{border-color:#667eea}.theme-dark .attachments-preview{background:#3a3a3a;border-color:#555}.theme-dark .attachment-item{background:#2c2c2c;border-color:#555;color:#fff}.theme-dark .upload-button{background:rgba(255,255,255,.1);border-color:#fff3}.theme-dark .upload-button:hover:not(:disabled){background:rgba(255,255,255,.2)}.theme-blue{background:#e3f2fd;--icon-primary: #1976d2;--icon-secondary: #546e7a;--icon-avatar-user: #1976d2;--icon-avatar-ai: #0288d1;--icon-header: #ffffff;--icon-upload: #1976d2;--icon-send: #ffffff;--icon-active: #1976d2;--icon-disabled: #b0bec5;--icon-hover: #1565c0}.theme-blue .chat-header{background:linear-gradient(135deg,#1976d2,#42a5f5)}.theme-blue .user-message .message-content{background:linear-gradient(135deg,#1976d2,#42a5f5)}.theme-blue .ai-message .message-content{border-color:#bbdefb}.theme-blue .inquiry-textarea:focus{border-color:#1976d2}.theme-blue .send-button{background:linear-gradient(135deg,#1976d2,#42a5f5)}.theme-blue .upload-button{background:rgba(25,118,210,.1);border-color:#1976d24d}.theme-blue .upload-button:hover:not(:disabled){background:rgba(25,118,210,.2)}.theme-green{background:#e8f5e8;--icon-primary: #388e3c;--icon-secondary: #546e7a;--icon-avatar-user: #388e3c;--icon-avatar-ai: #2e7d32;--icon-header: #ffffff;--icon-upload: #388e3c;--icon-send: #ffffff;--icon-active: #388e3c;--icon-disabled: #b0bec5;--icon-hover: #2e7d32}.theme-green .chat-header{background:linear-gradient(135deg,#388e3c,#66bb6a)}.theme-green .user-message .message-content{background:linear-gradient(135deg,#388e3c,#66bb6a)}.theme-green .ai-message .message-content{border-color:#c8e6c9}.theme-green .inquiry-textarea:focus{border-color:#388e3c}.theme-green .send-button{background:linear-gradient(135deg,#388e3c,#66bb6a)}.theme-green .upload-button{background:rgba(56,142,60,.1);border-color:#388e3c4d}.theme-green .upload-button:hover:not(:disabled){background:rgba(56,142,60,.2)}.theme-purple{background:#f3e5f5;--icon-primary: #7b1fa2;--icon-secondary: #6a1b9a;--icon-avatar-user: #7b1fa2;--icon-avatar-ai: #8e24aa;--icon-header: #ffffff;--icon-upload: #7b1fa2;--icon-send: #ffffff;--icon-active: #7b1fa2;--icon-disabled: #ce93d8;--icon-hover: #6a1b9a}.theme-purple .chat-header{background:linear-gradient(135deg,#7b1fa2,#ab47bc)}.theme-purple .user-message .message-content{background:linear-gradient(135deg,#7b1fa2,#ab47bc)}.theme-purple .ai-message .message-content{border-color:#e1bee7}.theme-purple .inquiry-textarea:focus{border-color:#7b1fa2}.theme-purple .send-button{background:linear-gradient(135deg,#7b1fa2,#ab47bc)}.theme-purple .upload-button{background:rgba(123,31,162,.1);border-color:#7b1fa24d}.theme-purple .upload-button:hover:not(:disabled){background:rgba(123,31,162,.2)}.theme-minimal{background:#fafafa;--icon-primary: #333333;--icon-secondary: #757575;--icon-avatar-user: #424242;--icon-avatar-ai: #616161;--icon-header: #333333;--icon-upload: #424242;--icon-send: #ffffff;--icon-active: #333333;--icon-disabled: #bdbdbd;--icon-hover: #212121}.theme-minimal .chat-header{background:#fff;color:#333;border-bottom:1px solid #e0e0e0}.theme-minimal .user-message .message-content{background:#007bff;color:#fff;border-radius:18px}.theme-minimal .ai-message .message-content{background:#f8f9fa;color:#333;border:1px solid #dee2e6}.theme-minimal .send-button{background:#007bff;border-radius:4px}.theme-minimal .upload-button{background:rgba(0,123,255,.1);border-color:#007bff4d}.theme-minimal .upload-button:hover:not(:disabled){background:rgba(0,123,255,.2)}.theme-corporate{background:#f8f9fa}.theme-corporate .chat-header{background:linear-gradient(135deg,#495057,#6c757d)}.theme-corporate .user-message .message-content{background:#495057}.theme-corporate .ai-message .message-content{background:#fff;border-color:#dee2e6}.theme-corporate .inquiry-textarea:focus{border-color:#495057}.theme-corporate .send-button{background:#495057}.theme-corporate .upload-button{background:rgba(73,80,87,.1);border-color:#4950574d}.theme-corporate .upload-button:hover:not(:disabled){background:rgba(73,80,87,.2)}.theme-red{background:#ffebee}.theme-red .chat-header{background:linear-gradient(135deg,#d32f2f,#f44336)}.theme-red .user-message .message-content{background:linear-gradient(135deg,#d32f2f,#f44336)}.theme-red .ai-message .message-content{border-color:#ffcdd2}.theme-red .inquiry-textarea:focus{border-color:#d32f2f}.theme-red .send-button{background:linear-gradient(135deg,#d32f2f,#f44336)}.theme-red .upload-button{background:rgba(211,47,47,.1);border-color:#d32f2f4d}.theme-red .upload-button:hover:not(:disabled){background:rgba(211,47,47,.2)}.theme-yellow{background:#fffde7}.theme-yellow .chat-header{background:linear-gradient(135deg,#f57f17,#ffb300)}.theme-yellow .user-message .message-content{background:linear-gradient(135deg,#f57f17,#ffb300)}.theme-yellow .ai-message .message-content{border-color:#fff9c4}.theme-yellow .inquiry-textarea:focus{border-color:#f57f17}.theme-yellow .send-button{background:linear-gradient(135deg,#f57f17,#ffb300)}.theme-yellow .upload-button{background:rgba(245,127,23,.1);border-color:#f57f174d}.theme-yellow .upload-button:hover:not(:disabled){background:rgba(245,127,23,.2)}.theme-orange{background:#fff3e0}.theme-orange .chat-header{background:linear-gradient(135deg,#e65100,#ff9800)}.theme-orange .user-message .message-content{background:linear-gradient(135deg,#e65100,#ff9800)}.theme-orange .ai-message .message-content{border-color:#ffe0b2}.theme-orange .inquiry-textarea:focus{border-color:#e65100}.theme-orange .send-button{background:linear-gradient(135deg,#e65100,#ff9800)}.theme-orange .upload-button{background:rgba(230,81,0,.1);border-color:#e651004d}.theme-orange .upload-button:hover:not(:disabled){background:rgba(230,81,0,.2)}\n"], directives: [{ type: i3__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
1431
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: AiChatComponent, decorators: [{
|
|
1432
|
+
type: i0.Component,
|
|
1433
|
+
args: [{
|
|
1434
|
+
selector: 'emanate-ai-chat',
|
|
1435
|
+
templateUrl: './ai-chat.component.html',
|
|
1436
|
+
styleUrls: ['./ai-chat.component.scss']
|
|
1437
|
+
}]
|
|
1438
|
+
}], ctorParameters: function () { return [{ type: AiAgentService }, { type: i2__namespace.DomSanitizer }]; }, propDecorators: { title: [{
|
|
1439
|
+
type: i0.Input
|
|
1440
|
+
}], placeholder: [{
|
|
1441
|
+
type: i0.Input
|
|
1442
|
+
}], showDebugInfo: [{
|
|
1443
|
+
type: i0.Input
|
|
1444
|
+
}], apiUrl: [{
|
|
1445
|
+
type: i0.Input
|
|
1446
|
+
}], appKey: [{
|
|
1447
|
+
type: i0.Input
|
|
1448
|
+
}], appSource: [{
|
|
1449
|
+
type: i0.Input
|
|
1450
|
+
}], userId: [{
|
|
1451
|
+
type: i0.Input
|
|
1452
|
+
}], firstName: [{
|
|
1453
|
+
type: i0.Input
|
|
1454
|
+
}], userName: [{
|
|
1455
|
+
type: i0.Input
|
|
1456
|
+
}], templateDesign: [{
|
|
1457
|
+
type: i0.Input
|
|
1458
|
+
}], welcomeMessage: [{
|
|
1459
|
+
type: i0.Input
|
|
1460
|
+
}], historicalMessages: [{
|
|
1461
|
+
type: i0.Input
|
|
1462
|
+
}], conversationId: [{
|
|
1463
|
+
type: i0.Input
|
|
1464
|
+
}], enableImageUpload: [{
|
|
1465
|
+
type: i0.Input
|
|
1466
|
+
}], enableFileUpload: [{
|
|
1467
|
+
type: i0.Input
|
|
1468
|
+
}], iconSet: [{
|
|
1469
|
+
type: i0.Input
|
|
1470
|
+
}], customIcons: [{
|
|
1471
|
+
type: i0.Input
|
|
1472
|
+
}], messageReceived: [{
|
|
1473
|
+
type: i0.Output
|
|
1474
|
+
}], messageSent: [{
|
|
1475
|
+
type: i0.Output
|
|
1476
|
+
}], fileUploaded: [{
|
|
1477
|
+
type: i0.Output
|
|
1478
|
+
}], sizeChanged: [{
|
|
1479
|
+
type: i0.Output
|
|
1480
|
+
}] } });
|
|
1481
|
+
|
|
1482
|
+
var EmanateAiChatLibModule = /** @class */ (function () {
|
|
1483
|
+
function EmanateAiChatLibModule() {
|
|
1484
|
+
}
|
|
1485
|
+
return EmanateAiChatLibModule;
|
|
1486
|
+
}());
|
|
1487
|
+
EmanateAiChatLibModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EmanateAiChatLibModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1488
|
+
EmanateAiChatLibModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EmanateAiChatLibModule, declarations: [EmanateAiChatLibComponent,
|
|
1489
|
+
AiChatComponent], imports: [i3.CommonModule,
|
|
1490
|
+
i4.FormsModule,
|
|
1491
|
+
i1.HttpClientModule], exports: [EmanateAiChatLibComponent,
|
|
1492
|
+
AiChatComponent] });
|
|
1493
|
+
EmanateAiChatLibModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EmanateAiChatLibModule, providers: [
|
|
1494
|
+
AiAgentService
|
|
1495
|
+
], imports: [[
|
|
1496
|
+
i3.CommonModule,
|
|
1497
|
+
i4.FormsModule,
|
|
1498
|
+
i1.HttpClientModule
|
|
1499
|
+
]] });
|
|
1500
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EmanateAiChatLibModule, decorators: [{
|
|
1501
|
+
type: i0.NgModule,
|
|
1502
|
+
args: [{
|
|
1503
|
+
declarations: [
|
|
1504
|
+
EmanateAiChatLibComponent,
|
|
1505
|
+
AiChatComponent
|
|
1506
|
+
],
|
|
1507
|
+
imports: [
|
|
1508
|
+
i3.CommonModule,
|
|
1509
|
+
i4.FormsModule,
|
|
1510
|
+
i1.HttpClientModule
|
|
1511
|
+
],
|
|
1512
|
+
providers: [
|
|
1513
|
+
AiAgentService
|
|
1514
|
+
],
|
|
1515
|
+
exports: [
|
|
1516
|
+
EmanateAiChatLibComponent,
|
|
1517
|
+
AiChatComponent
|
|
1518
|
+
]
|
|
1519
|
+
}]
|
|
1520
|
+
}] });
|
|
1521
|
+
|
|
1522
|
+
/*
|
|
1523
|
+
* Public API Surface of emanate-ai-chat-lib
|
|
1524
|
+
*/
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* Generated bundle index. Do not edit.
|
|
1528
|
+
*/
|
|
1529
|
+
|
|
1530
|
+
exports.AiAgentService = AiAgentService;
|
|
1531
|
+
exports.AiChatComponent = AiChatComponent;
|
|
1532
|
+
exports.BOOTSTRAP_ICONS = BOOTSTRAP_ICONS;
|
|
1533
|
+
exports.EmanateAiChatLibComponent = EmanateAiChatLibComponent;
|
|
1534
|
+
exports.EmanateAiChatLibModule = EmanateAiChatLibModule;
|
|
1535
|
+
exports.EmanateAiChatLibService = EmanateAiChatLibService;
|
|
1536
|
+
exports.FEATHER_ICONS = FEATHER_ICONS;
|
|
1537
|
+
exports.HEROICONS = HEROICONS;
|
|
1538
|
+
exports.LUCIDE_ICONS = LUCIDE_ICONS;
|
|
1539
|
+
exports.MATERIAL_ICONS = MATERIAL_ICONS;
|
|
1540
|
+
exports.getIconSet = getIconSet;
|
|
1541
|
+
|
|
1542
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1543
|
+
|
|
1544
|
+
}));
|
|
1545
|
+
//# sourceMappingURL=emanate-ai-chat-lib.umd.js.map
|