@digipair/skill-web-chatbot 0.114.1 → 0.114.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/index.cjs.js +2118 -8
  2. package/dist/index.esm2.js +5 -5
  3. package/package.json +6 -2
  4. package/dist/SAP-icons.cjs.js +0 -2489
  5. package/dist/SAP-icons.cjs2.js +0 -2489
  6. package/dist/Tableau10-558cc280.cjs.js +0 -9
  7. package/dist/arc-d1f6357e.cjs.js +0 -88
  8. package/dist/array-2ff2c7a6.cjs.js +0 -11
  9. package/dist/blockDiagram-5dc23a45.cjs.js +0 -2916
  10. package/dist/c4Diagram-1e775db3.cjs.js +0 -4386
  11. package/dist/channel-ebbc4130.cjs.js +0 -9
  12. package/dist/classDiagram-f52caa06.cjs.js +0 -209
  13. package/dist/classDiagram-v2-640c694e.cjs.js +0 -401
  14. package/dist/clone-afc2f047.cjs.js +0 -10
  15. package/dist/createText-03b82060.cjs.js +0 -2940
  16. package/dist/edges-16357fde.cjs.js +0 -2002
  17. package/dist/erDiagram-c7ff1bec.cjs.js +0 -1807
  18. package/dist/flowDb-9a89ea33.cjs.js +0 -5542
  19. package/dist/flowDiagram-aadb13b0.cjs.js +0 -1351
  20. package/dist/flowDiagram-v2-f2119625.cjs.js +0 -31
  21. package/dist/flowchart-elk-definition-cf813a97.cjs.js +0 -50248
  22. package/dist/ganttDiagram-3c2fde2b.cjs.js +0 -3710
  23. package/dist/gitGraphDiagram-c3a0619c.cjs.js +0 -3815
  24. package/dist/graph-0ee63739.cjs.js +0 -954
  25. package/dist/index-bb6d8841.cjs.js +0 -648
  26. package/dist/index.cjs2.js +0 -76743
  27. package/dist/infoDiagram-2f5c50c0.cjs.js +0 -460
  28. package/dist/init-f9637058.cjs.js +0 -17
  29. package/dist/journeyDiagram-14fe341a.cjs.js +0 -1061
  30. package/dist/katex-d90b6d29.cjs.js +0 -25690
  31. package/dist/layout-fd473db2.cjs.js +0 -1613
  32. package/dist/line-24d93f1b.cjs.js +0 -34
  33. package/dist/linear-9bcf74c4.cjs.js +0 -537
  34. package/dist/mindmap-definition-9399c7e6.cjs.js +0 -20488
  35. package/dist/ordinal-5695958c.cjs.js +0 -330
  36. package/dist/path-428ebac9.cjs.js +0 -316
  37. package/dist/pieDiagram-828dae43.cjs.js +0 -949
  38. package/dist/quadrantDiagram-5fa00455.cjs.js +0 -2409
  39. package/dist/requirementDiagram-03163dc4.cjs.js +0 -2267
  40. package/dist/sankeyDiagram-52ec8976.cjs.js +0 -1848
  41. package/dist/sequenceDiagram-b517d154.cjs.js +0 -5948
  42. package/dist/stateDiagram-fca82b5b.cjs.js +0 -283
  43. package/dist/stateDiagram-v2-ed04200a.cjs.js +0 -373
  44. package/dist/styles-11e81fdd.cjs.js +0 -3943
  45. package/dist/styles-cacbff60.cjs.js +0 -2120
  46. package/dist/styles-e75131e4.cjs.js +0 -671
  47. package/dist/svgDrawCommon-ecc5f780.cjs.js +0 -68
  48. package/dist/timeline-definition-4ee9bff4.cjs.js +0 -1161
  49. package/dist/xychartDiagram-e5e6b652.cjs.js +0 -3150
package/dist/index.cjs.js CHANGED
@@ -1,15 +1,2125 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index.cjs2.js');
3
+ require('@ui5/webcomponents-icons/dist/AllIcons.js');
4
+ require('@ui5/webcomponents/dist/BusyIndicator.js');
5
+ require('@ui5/webcomponents/dist/Icon.js');
6
+ var lit = require('lit');
7
+ var decorators_js = require('lit/decorators.js');
8
+ var engine = require('@digipair/engine');
9
+ var mermaid = require('mermaid/dist/mermaid.esm.min.mjs');
10
+ var unsafeHtml_js = require('lit/directives/unsafe-html.js');
11
+ var showdown = require('showdown');
12
+ var until_js = require('lit/directives/until.js');
13
+ var getCssSelectorOrigin = require('css-selector-generator');
4
14
 
15
+ function _interopNamespaceDefault(e) {
16
+ var n = Object.create(null);
17
+ if (e) {
18
+ Object.keys(e).forEach(function (k) {
19
+ if (k !== 'default') {
20
+ var d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: function () { return e[k]; }
24
+ });
25
+ }
26
+ });
27
+ }
28
+ n.default = e;
29
+ return Object.freeze(n);
30
+ }
5
31
 
32
+ var showdown__namespace = /*#__PURE__*/_interopNamespaceDefault(showdown);
6
33
 
7
- Object.defineProperty(exports, "ChatbotElement", {
8
- enumerable: true,
9
- get: function () { return index.ChatbotElement; }
34
+ function __decorate(decorators, target, key, desc) {
35
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
37
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
38
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
39
+ }
40
+ function __metadata(metadataKey, metadataValue) {
41
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
42
+ }
43
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
44
+ var e = new Error(message);
45
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
46
+ };
47
+
48
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
49
+ try {
50
+ var info = gen[key](arg);
51
+ var value = info.value;
52
+ } catch (error) {
53
+ reject(error);
54
+ return;
55
+ }
56
+ if (info.done) {
57
+ resolve(value);
58
+ } else {
59
+ Promise.resolve(value).then(_next, _throw);
60
+ }
61
+ }
62
+ function _async_to_generator$1(fn) {
63
+ return function() {
64
+ var self = this, args = arguments;
65
+ return new Promise(function(resolve, reject) {
66
+ var gen = fn.apply(self, args);
67
+ function _next(value) {
68
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
69
+ }
70
+ function _throw(err) {
71
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
72
+ }
73
+ _next(undefined);
74
+ });
75
+ };
76
+ }
77
+ function _ts_generator$1(thisArg, body) {
78
+ var f, y, t, g, _ = {
79
+ label: 0,
80
+ sent: function() {
81
+ if (t[0] & 1) throw t[1];
82
+ return t[1];
83
+ },
84
+ trys: [],
85
+ ops: []
86
+ };
87
+ return g = {
88
+ next: verb(0),
89
+ "throw": verb(1),
90
+ "return": verb(2)
91
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
92
+ return this;
93
+ }), g;
94
+ function verb(n) {
95
+ return function(v) {
96
+ return step([
97
+ n,
98
+ v
99
+ ]);
100
+ };
101
+ }
102
+ function step(op) {
103
+ if (f) throw new TypeError("Generator is already executing.");
104
+ while(_)try {
105
+ 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) return t;
106
+ if (y = 0, t) op = [
107
+ op[0] & 2,
108
+ t.value
109
+ ];
110
+ switch(op[0]){
111
+ case 0:
112
+ case 1:
113
+ t = op;
114
+ break;
115
+ case 4:
116
+ _.label++;
117
+ return {
118
+ value: op[1],
119
+ done: false
120
+ };
121
+ case 5:
122
+ _.label++;
123
+ y = op[1];
124
+ op = [
125
+ 0
126
+ ];
127
+ continue;
128
+ case 7:
129
+ op = _.ops.pop();
130
+ _.trys.pop();
131
+ continue;
132
+ default:
133
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
134
+ _ = 0;
135
+ continue;
136
+ }
137
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
138
+ _.label = op[1];
139
+ break;
140
+ }
141
+ if (op[0] === 6 && _.label < t[1]) {
142
+ _.label = t[1];
143
+ t = op;
144
+ break;
145
+ }
146
+ if (t && _.label < t[2]) {
147
+ _.label = t[2];
148
+ _.ops.push(op);
149
+ break;
150
+ }
151
+ if (t[2]) _.ops.pop();
152
+ _.trys.pop();
153
+ continue;
154
+ }
155
+ op = body.call(thisArg, _);
156
+ } catch (e) {
157
+ op = [
158
+ 6,
159
+ e
160
+ ];
161
+ y = 0;
162
+ } finally{
163
+ f = t = 0;
164
+ }
165
+ if (op[0] & 5) throw op[1];
166
+ return {
167
+ value: op[0] ? op[1] : void 0,
168
+ done: true
169
+ };
170
+ }
171
+ }
172
+ function getBytes(stream, onChunk) {
173
+ return _getBytes.apply(this, arguments);
174
+ }
175
+ function _getBytes() {
176
+ _getBytes = _async_to_generator$1(function(stream, onChunk) {
177
+ var reader, result;
178
+ return _ts_generator$1(this, function(_state) {
179
+ switch(_state.label){
180
+ case 0:
181
+ reader = stream.getReader();
182
+ _state.label = 1;
183
+ case 1:
184
+ return [
185
+ 4,
186
+ reader.read()
187
+ ];
188
+ case 2:
189
+ if (!!(result = _state.sent()).done) return [
190
+ 3,
191
+ 3
192
+ ];
193
+ onChunk(result.value);
194
+ return [
195
+ 3,
196
+ 1
197
+ ];
198
+ case 3:
199
+ return [
200
+ 2
201
+ ];
202
+ }
203
+ });
204
+ });
205
+ return _getBytes.apply(this, arguments);
206
+ }
207
+ function getLines(onLine) {
208
+ var buffer;
209
+ var position;
210
+ var fieldLength;
211
+ var discardTrailingNewline = false;
212
+ return function onChunk(arr) {
213
+ if (buffer === undefined) {
214
+ buffer = arr;
215
+ position = 0;
216
+ fieldLength = -1;
217
+ } else {
218
+ buffer = concat(buffer, arr);
219
+ }
220
+ var bufLength = buffer.length;
221
+ var lineStart = 0;
222
+ while(position < bufLength){
223
+ if (discardTrailingNewline) {
224
+ if (buffer[position] === 10) {
225
+ lineStart = ++position;
226
+ }
227
+ discardTrailingNewline = false;
228
+ }
229
+ var lineEnd = -1;
230
+ for(; position < bufLength && lineEnd === -1; ++position){
231
+ switch(buffer[position]){
232
+ case 58:
233
+ if (fieldLength === -1) {
234
+ fieldLength = position - lineStart;
235
+ }
236
+ break;
237
+ case 13:
238
+ discardTrailingNewline = true;
239
+ case 10:
240
+ lineEnd = position;
241
+ break;
242
+ }
243
+ }
244
+ if (lineEnd === -1) {
245
+ break;
246
+ }
247
+ onLine(buffer.subarray(lineStart, lineEnd), fieldLength);
248
+ lineStart = position;
249
+ fieldLength = -1;
250
+ }
251
+ if (lineStart === bufLength) {
252
+ buffer = undefined;
253
+ } else if (lineStart !== 0) {
254
+ buffer = buffer.subarray(lineStart);
255
+ position -= lineStart;
256
+ }
257
+ };
258
+ }
259
+ function getMessages(onId, onRetry, onMessage) {
260
+ var message = newMessage();
261
+ var decoder = new TextDecoder();
262
+ return function onLine(line, fieldLength) {
263
+ if (line.length === 0) {
264
+ onMessage === null || onMessage === void 0 ? void 0 : onMessage(message);
265
+ message = newMessage();
266
+ } else if (fieldLength > 0) {
267
+ var field = decoder.decode(line.subarray(0, fieldLength));
268
+ var valueOffset = fieldLength + (line[fieldLength + 1] === 32 ? 2 : 1);
269
+ var value = decoder.decode(line.subarray(valueOffset));
270
+ switch(field){
271
+ case 'data':
272
+ message.data = message.data ? message.data + '\n' + value : value;
273
+ break;
274
+ case 'event':
275
+ message.event = value;
276
+ break;
277
+ case 'id':
278
+ onId(message.id = value);
279
+ break;
280
+ case 'retry':
281
+ var retry = parseInt(value, 10);
282
+ if (!isNaN(retry)) {
283
+ onRetry(message.retry = retry);
284
+ }
285
+ break;
286
+ }
287
+ }
288
+ };
289
+ }
290
+ function concat(a, b) {
291
+ var res = new Uint8Array(a.length + b.length);
292
+ res.set(a);
293
+ res.set(b, a.length);
294
+ return res;
295
+ }
296
+ function newMessage() {
297
+ return {
298
+ data: '',
299
+ event: '',
300
+ id: '',
301
+ retry: undefined
302
+ };
303
+ }
304
+
305
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
306
+ try {
307
+ var info = gen[key](arg);
308
+ var value = info.value;
309
+ } catch (error) {
310
+ reject(error);
311
+ return;
312
+ }
313
+ if (info.done) {
314
+ resolve(value);
315
+ } else {
316
+ Promise.resolve(value).then(_next, _throw);
317
+ }
318
+ }
319
+ function _async_to_generator(fn) {
320
+ return function() {
321
+ var self = this, args = arguments;
322
+ return new Promise(function(resolve, reject) {
323
+ var gen = fn.apply(self, args);
324
+ function _next(value) {
325
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
326
+ }
327
+ function _throw(err) {
328
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
329
+ }
330
+ _next(undefined);
331
+ });
332
+ };
333
+ }
334
+ function _ts_generator(thisArg, body) {
335
+ var f, y, t, g, _ = {
336
+ label: 0,
337
+ sent: function() {
338
+ if (t[0] & 1) throw t[1];
339
+ return t[1];
340
+ },
341
+ trys: [],
342
+ ops: []
343
+ };
344
+ return g = {
345
+ next: verb(0),
346
+ "throw": verb(1),
347
+ "return": verb(2)
348
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
349
+ return this;
350
+ }), g;
351
+ function verb(n) {
352
+ return function(v) {
353
+ return step([
354
+ n,
355
+ v
356
+ ]);
357
+ };
358
+ }
359
+ function step(op) {
360
+ if (f) throw new TypeError("Generator is already executing.");
361
+ while(_)try {
362
+ 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) return t;
363
+ if (y = 0, t) op = [
364
+ op[0] & 2,
365
+ t.value
366
+ ];
367
+ switch(op[0]){
368
+ case 0:
369
+ case 1:
370
+ t = op;
371
+ break;
372
+ case 4:
373
+ _.label++;
374
+ return {
375
+ value: op[1],
376
+ done: false
377
+ };
378
+ case 5:
379
+ _.label++;
380
+ y = op[1];
381
+ op = [
382
+ 0
383
+ ];
384
+ continue;
385
+ case 7:
386
+ op = _.ops.pop();
387
+ _.trys.pop();
388
+ continue;
389
+ default:
390
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
391
+ _ = 0;
392
+ continue;
393
+ }
394
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
395
+ _.label = op[1];
396
+ break;
397
+ }
398
+ if (op[0] === 6 && _.label < t[1]) {
399
+ _.label = t[1];
400
+ t = op;
401
+ break;
402
+ }
403
+ if (t && _.label < t[2]) {
404
+ _.label = t[2];
405
+ _.ops.push(op);
406
+ break;
407
+ }
408
+ if (t[2]) _.ops.pop();
409
+ _.trys.pop();
410
+ continue;
411
+ }
412
+ op = body.call(thisArg, _);
413
+ } catch (e) {
414
+ op = [
415
+ 6,
416
+ e
417
+ ];
418
+ y = 0;
419
+ } finally{
420
+ f = t = 0;
421
+ }
422
+ if (op[0] & 5) throw op[1];
423
+ return {
424
+ value: op[0] ? op[1] : void 0,
425
+ done: true
426
+ };
427
+ }
428
+ }
429
+ var __rest = undefined && undefined.__rest || function(s, e) {
430
+ var t = {};
431
+ for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
432
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++){
433
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
434
+ }
435
+ return t;
436
+ };
437
+ var EventStreamContentType = 'text/event-stream';
438
+ var DefaultRetryInterval = 1000;
439
+ var LastEventId = 'last-event-id';
440
+ function fetchEventSource(input, _a) {
441
+ var inputSignal = _a.signal, inputHeaders = _a.headers, inputOnOpen = _a.onopen, onmessage = _a.onmessage, onclose = _a.onclose, onerror = _a.onerror, openWhenHidden = _a.openWhenHidden, inputFetch = _a.fetch, rest = __rest(_a, [
442
+ "signal",
443
+ "headers",
444
+ "onopen",
445
+ "onmessage",
446
+ "onclose",
447
+ "onerror",
448
+ "openWhenHidden",
449
+ "fetch"
450
+ ]);
451
+ return new Promise(function(resolve, reject) {
452
+ var onVisibilityChange = function onVisibilityChange() {
453
+ curRequestController.abort();
454
+ if (!document.hidden) {
455
+ create();
456
+ }
457
+ };
458
+ var dispose = function dispose() {
459
+ document.removeEventListener('visibilitychange', onVisibilityChange);
460
+ window.clearTimeout(retryTimer);
461
+ curRequestController.abort();
462
+ };
463
+ var create = function create() {
464
+ return _create.apply(this, arguments);
465
+ };
466
+ var headers = Object.assign({}, inputHeaders);
467
+ if (!headers.accept) {
468
+ headers.accept = EventStreamContentType;
469
+ }
470
+ var curRequestController;
471
+ if (!openWhenHidden) {
472
+ document.addEventListener('visibilitychange', onVisibilityChange);
473
+ }
474
+ var retryInterval = DefaultRetryInterval;
475
+ var retryTimer = 0;
476
+ inputSignal === null || inputSignal === void 0 ? void 0 : inputSignal.addEventListener('abort', function() {
477
+ dispose();
478
+ resolve();
479
+ });
480
+ var fetch = inputFetch !== null && inputFetch !== void 0 ? inputFetch : window.fetch;
481
+ var onopen = inputOnOpen !== null && inputOnOpen !== void 0 ? inputOnOpen : defaultOnOpen;
482
+ function _create() {
483
+ _create = _async_to_generator(function() {
484
+ var _$_a, response, err, interval;
485
+ return _ts_generator(this, function(_state) {
486
+ switch(_state.label){
487
+ case 0:
488
+ curRequestController = new AbortController();
489
+ _state.label = 1;
490
+ case 1:
491
+ _state.trys.push([
492
+ 1,
493
+ 5,
494
+ ,
495
+ 6
496
+ ]);
497
+ return [
498
+ 4,
499
+ fetch(input, Object.assign(Object.assign({}, rest), {
500
+ headers: headers,
501
+ signal: curRequestController.signal
502
+ }))
503
+ ];
504
+ case 2:
505
+ response = _state.sent();
506
+ return [
507
+ 4,
508
+ onopen(response)
509
+ ];
510
+ case 3:
511
+ _state.sent();
512
+ return [
513
+ 4,
514
+ getBytes(response.body, getLines(getMessages(function(id) {
515
+ if (id) {
516
+ headers[LastEventId] = id;
517
+ } else {
518
+ delete headers[LastEventId];
519
+ }
520
+ }, function(retry) {
521
+ retryInterval = retry;
522
+ }, onmessage)))
523
+ ];
524
+ case 4:
525
+ _state.sent();
526
+ onclose === null || onclose === void 0 ? void 0 : onclose();
527
+ dispose();
528
+ resolve();
529
+ return [
530
+ 3,
531
+ 6
532
+ ];
533
+ case 5:
534
+ err = _state.sent();
535
+ if (!curRequestController.signal.aborted) {
536
+ try {
537
+ interval = (_$_a = onerror === null || onerror === void 0 ? void 0 : onerror(err)) !== null && _$_a !== void 0 ? _$_a : retryInterval;
538
+ window.clearTimeout(retryTimer);
539
+ retryTimer = window.setTimeout(create, interval);
540
+ } catch (innerErr) {
541
+ dispose();
542
+ reject(innerErr);
543
+ }
544
+ }
545
+ return [
546
+ 3,
547
+ 6
548
+ ];
549
+ case 6:
550
+ return [
551
+ 2
552
+ ];
553
+ }
554
+ });
555
+ });
556
+ return _create.apply(this, arguments);
557
+ }
558
+ create();
559
+ });
560
+ }
561
+ function defaultOnOpen(response) {
562
+ var contentType = response.headers.get('content-type');
563
+ if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith(EventStreamContentType))) {
564
+ throw new Error("Expected content-type to be ".concat(EventStreamContentType, ", Actual: ").concat(contentType));
565
+ }
566
+ }
567
+
568
+ class InputsElement extends lit.LitElement {
569
+ get values() {
570
+ return Array.from(this.shadowRoot.children).map((el)=>({
571
+ value: el.value,
572
+ content: el.content,
573
+ required: el.required
574
+ }));
575
+ }
576
+ render() {
577
+ const cache = JSON.stringify(this.inputs);
578
+ if (this.cache === cache) {
579
+ return lit.noChange;
580
+ }
581
+ this.cache = cache;
582
+ return lit.html`
583
+ ${(this.inputs || []).map((pins)=>lit.html`${until_js.until(engine.generateElementFromPins(pins, null, this.context).then((el)=>{
584
+ setTimeout(()=>this.dispatchEvent(new CustomEvent('change')), 1);
585
+ el.addEventListener('change', ()=>this.dispatchEvent(new CustomEvent('change')));
586
+ return el;
587
+ }), lit.nothing)}`)}
588
+ `;
589
+ }
590
+ constructor(...args){
591
+ super(...args);
592
+ this.inputs = [];
593
+ this.context = {};
594
+ this.cache = '';
595
+ }
596
+ }
597
+ __decorate([
598
+ decorators_js.property({
599
+ type: Array
600
+ }),
601
+ __metadata("design:type", Array)
602
+ ], InputsElement.prototype, "inputs", void 0);
603
+ __decorate([
604
+ decorators_js.property({
605
+ type: Object
606
+ }),
607
+ __metadata("design:type", Object)
608
+ ], InputsElement.prototype, "context", void 0);
609
+ InputsElement = __decorate([
610
+ decorators_js.customElement('digipair-chatbot-inputs')
611
+ ], InputsElement);
612
+
613
+ const WRITTING_IMAGE = 'data:image/gif;base64,R0lGODlhKAAoAPD/AHp6ent7eyH/C05FVFNDQVBFMi4wAwEAAAAh+QQFAgACACwAAAAAKAAoAAACSJSPqcvtD6OctNqLs968+w+G4kiW5omm6sqOAPMqAQYEdlLfiB3EFN/bAQ853W94APqAswoyyUs8Kz7potrKarfcrvcLDoszBQAh+QQJAgAAACwAAAAAHQAbAAACGoSPqcvtD6OctNqLs968+w+G4kiW5omm6noUACH5BAkCAAIALAkAFQAWAAYAAAIblGCZqMYQYoNSxXuZwSFxbmXLV3lXgzmNtyoFACH5BAUCAAIALAkAFQAWAAYAAAIdlGCZqAcIgmxxJilrVtieDnIY84Ge0VEe2QRNUwAAIfkECQIAAgAsGgAVAAUABQAAAgiUEgLG3RvAKgAh+QQJAgACACwaABQABQAFAAACCVQQgsHNy8wRBQAh+QQJAgACACwaABQABQAFAAACCFQegHt2IEwsACH5BAkCAAIALBoAEwAFAAUAAAIIVAJ2uAebnCgAIfkECQIAAgAsGgASAAUABQAAAghUbhegx5qCKAAh+QQJAgACACwaABEABQAFAAACCBRuoafdIJooACH5BAkCAAIALBoAEAAFAAUAAAIHlBAXy93SCgAh+QQJAgACACwUAA8ACwAMAAACE5RvAYjhwQR4kNFq3Yq8+w+GYgEAIfkECQIAAgAsEgAOAA0ADAAAAhqUj4Fr4cCac1GAqeqE1fYIcNrUYeJijsG5FAAh+QQJAgACACwSAA4ADQAMAAACF5R/oYG42tKLElIDrt7G3vmBkTgq2VUAACH5BAkCAAIALBIADQANAA0AAAIalH+hgKjfDnghGlrtZbr7L0xKh2mlRXmTVwAAIfkECQIAAgAsEg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JscSoZqmQOP+iFF8aFXnOOFoc2kFEAADs=';
614
+
615
+ class ChatElement extends lit.LitElement {
616
+ get inputs() {
617
+ return this.inputsElement?.values || [];
618
+ }
619
+ static{
620
+ this.styles = [
621
+ lit.css`
622
+ /* Pour Chrome et Edge */
623
+ .container::-webkit-scrollbar {
624
+ width: 8px; /* Largeur de la barre de défilement */
625
+ background-color: transparent; /* Couleur de fond du rail de la barre de défilement */
626
+ }
627
+
628
+ .container::-webkit-scrollbar-thumb {
629
+ background-color: #bfc1c3;
630
+ border-radius: 10px; /* Pour rendre la barre de défilement arrondie */
631
+ background-clip: padding-box;
632
+ border: 2px solid transparent; /* Espace entre la barre de défilement et son rail */
633
+ }
634
+
635
+ .container::-webkit-scrollbar-track {
636
+ background-color: transparent; /* Couleur de fond de la zone de défilement */
637
+ }
638
+ .container {
639
+ position: absolute;
640
+ top: 0;
641
+ bottom: 70px;
642
+ left: 0;
643
+ right: 0;
644
+ padding: 20px;
645
+ overflow-y: scroll;
646
+ margin-top: 1px;
647
+ margin-bottom: 2px;
648
+ margin-right: 3px;
649
+ }
650
+
651
+ .container > section {
652
+ overflow: auto;
653
+ }
654
+ .container > section::-webkit-scrollbar {
655
+ height: 8px; /* Largeur de la barre de défilement */
656
+ background-color: transparent; /* Couleur de fond du rail de la barre de défilement */
657
+ }
658
+ .container > section::-webkit-scrollbar-thumb {
659
+ background-color: #bfc1c3;
660
+ border-radius: 10px; /* Pour rendre la barre de défilement arrondie */
661
+ background-clip: padding-box;
662
+ border: 2px solid transparent; /* Espace entre la barre de défilement et son rail */
663
+ }
664
+ .container > section::-webkit-scrollbar-track {
665
+ background-color: transparent; /* Couleur de fond de la zone de défilement */
666
+ }
667
+
668
+ .assistant,
669
+ .user {
670
+ max-width: 70%; /* Largeur maximale des bulles de chat */
671
+ padding: 10px 15px;
672
+ margin-bottom: 10px;
673
+ border-radius: 20px;
674
+ line-height: 1.4;
675
+ }
676
+
677
+ .assistant {
678
+ background-color: var(
679
+ --digipair-color-primary,
680
+ #52dfdb
681
+ ); /* Couleur de fond des messages de l'assistant */
682
+ color: var(
683
+ --digipair-color-text-primary,
684
+ #242e3b
685
+ ); /* Couleur du texte des messages de l'assistant */
686
+ align-self: flex-start;
687
+ margin-right: auto;
688
+ }
689
+
690
+ .user {
691
+ background-color: var(--digipair-color-secondary, #242e3b);
692
+ color: var(
693
+ --digipair-color-text-secondary,
694
+ #ffffff
695
+ ); /* Couleur du texte des messages de l'utilisateur */
696
+ align-self: flex-end;
697
+ margin-left: auto;
698
+ }
699
+
700
+ .assistant a {
701
+ color: var(--digipair-color-text-primary, #242e3b);
702
+ }
703
+
704
+ .user a {
705
+ color: var(--digipair-color-text-secondary, #ffffff);
706
+ }
707
+
708
+ .input-container {
709
+ position: absolute;
710
+ bottom: 0px;
711
+ right: 0;
712
+ left: 0;
713
+ height: 50px;
714
+ margin-top: 0px;
715
+ padding-top: 10px;
716
+ padding-left: 10px;
717
+ padding-bottom: 10px;
718
+ border-radius: 20px 5px 0px 20px;
719
+ border: 1px solid rgba(112, 183, 253, 0.3);
720
+ }
721
+
722
+ .input-container input {
723
+ outline: none;
724
+ width: 250px;
725
+ border-top: none;
726
+ border-left: none;
727
+ border-right: none;
728
+ border-bottom: 1px solid #bababa;
729
+ background-color: transparent;
730
+ margin-right: 6px;
731
+ padding-bottom: 0px;
732
+ }
733
+
734
+ .button {
735
+ margin-left: 5px;
736
+ }
737
+ .button:not(.disabled) {
738
+ cursor: pointer;
739
+ }
740
+ .button:hover:not(.disabled) {
741
+ color: rgb(112, 183, 253);
742
+ }
743
+ .button.disabled {
744
+ color: rgb(220 220 220);
745
+ }
746
+
747
+ .input {
748
+ position: absolute;
749
+ top: 0;
750
+ bottom: 5px;
751
+ left: 8px;
752
+ right: 40px;
753
+ margin-top: 5px;
754
+ margin-left: 4px;
755
+ margin-bottom: 5px;
756
+ }
757
+
758
+ #messageInput {
759
+ width: 100%;
760
+ height: 45px;
761
+ border: none;
762
+ outline: none;
763
+ resize: none;
764
+ background-color: white;
765
+ color: black;
766
+ }
767
+ #messageInput::-webkit-scrollbar {
768
+ width: 8px; /* Largeur de la barre de défilement */
769
+ background-color: transparent; /* Couleur de fond du rail de la barre de défilement */
770
+ }
771
+ #messageInput::-webkit-scrollbar-thumb {
772
+ background-color: #bfc1c3;
773
+ border-radius: 10px; /* Pour rendre la barre de défilement arrondie */
774
+ background-clip: padding-box;
775
+ border: 2px solid transparent; /* Espace entre la barre de défilement et son rail */
776
+ }
777
+ #messageInput::-webkit-scrollbar-track {
778
+ background-color: transparent; /* Couleur de fond de la zone de défilement */
779
+ }
780
+
781
+ p {
782
+ margin: 0;
783
+ }
784
+
785
+ [name='microphone'] {
786
+ position: absolute;
787
+ right: 10px;
788
+ top: 12px;
789
+ }
790
+
791
+ [name='begin'] {
792
+ position: absolute;
793
+ right: 10px;
794
+ top: 40px;
795
+ }
796
+
797
+ .container.with-boost {
798
+ bottom: 105px;
799
+ }
800
+
801
+ .input-container.with-boost {
802
+ height: 85px;
803
+ }
804
+
805
+ .input .assistant {
806
+ height: 18px;
807
+ max-width: 100%;
808
+ width: 235px;
809
+ overflow: hidden;
810
+ opacity: 0.3;
811
+ }
812
+
813
+ .input .assistant p {
814
+ text-overflow: ellipsis;
815
+ white-space: nowrap;
816
+ overflow: hidden;
817
+ }
818
+
819
+ .button.action {
820
+ float: right;
821
+ }
822
+
823
+ .loading {
824
+ overflow: visible !important;
825
+ }
826
+
827
+ .loading .step {
828
+ color: #bfc1c3;
829
+ margin-left: 45px;
830
+ padding-top: 15px;
831
+ display: block;
832
+ }
833
+
834
+ .loading img {
835
+ float: left;
836
+ }
837
+
838
+ .sources {
839
+ margin-top: 10px;
840
+ }
841
+
842
+ .sources > .source {
843
+ background-color: rgba(255, 255, 255, 0.5);
844
+ font-size: 12px;
845
+ color: rgb(60, 60, 60);
846
+ padding: 0px 8px;
847
+ display: inline-block;
848
+ transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0s;
849
+ transform: scale(0.95);
850
+ margin-bottom: 4px;
851
+ border-radius: 5px;
852
+ text-decoration: none;
853
+ cursor: default;
854
+ }
855
+
856
+ .sources > .source.has-link {
857
+ background-color: rgba(255, 255, 255, 0.9);
858
+ cursor: pointer;
859
+ }
860
+
861
+ .sources > .source.has-link:hover {
862
+ transform: scale(1);
863
+ }
864
+
865
+ .trust-bar {
866
+ position: relative;
867
+ width: 100%;
868
+ height: 3px;
869
+ background-color: rgba(82, 223, 219, 0.2);
870
+ border-radius: 5px;
871
+ overflow: hidden;
872
+ margin-bottom: 5px;
873
+ }
874
+
875
+ .trust-bar-fill {
876
+ height: 100%;
877
+ background-color: green;
878
+ transition: width 0.3s ease;
879
+ border-radius: 5px;
880
+ }
881
+
882
+ .boosts {
883
+ margin-top: 10px;
884
+ margin-bottom: 5px;
885
+ }
886
+
887
+ .boosts.loading {
888
+ display: none;
889
+ }
890
+
891
+ .boosts > .boost {
892
+ background-color: rgba(255, 255, 255, 0.7);
893
+ border-radius: 20px;
894
+ font-size: 10px;
895
+ color: rgb(60, 60, 60);
896
+ padding: 4px 14px;
897
+ cursor: pointer;
898
+ display: inline-block;
899
+ transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0s;
900
+ transform: scale(0.95);
901
+ margin-bottom: 1px;
902
+ }
903
+
904
+ .boosts > .boost:hover {
905
+ transform: scale(1);
906
+ }
907
+ `
908
+ ];
909
+ }
910
+ connectedCallback() {
911
+ super.connectedCallback();
912
+ mermaid.initialize({
913
+ startOnLoad: false
914
+ });
915
+ showdown__namespace.extension('mermaid', function() {
916
+ return [
917
+ {
918
+ type: 'lang',
919
+ filter: function(text) {
920
+ return text.replace(/```mermaid([^`]+)```/g, (_match, diagramCode)=>{
921
+ return '<div class="mermaid">' + diagramCode + '</div>';
922
+ });
923
+ }
924
+ }
925
+ ];
926
+ });
927
+ this.converter = new showdown__namespace.Converter({
928
+ simplifiedAutoLink: true,
929
+ strikethrough: true,
930
+ tables: true,
931
+ tasklists: true,
932
+ smoothLivePreview: true
933
+ });
934
+ this.converter.addExtension('mermaid', {});
935
+ }
936
+ async addMessage(content) {
937
+ if (this.currentBoost && !this.currentBoost.prompt) {
938
+ this.dispatchEvent(new CustomEvent('prompt', {
939
+ detail: {
940
+ prompt: ''
941
+ }
942
+ }));
943
+ return;
944
+ }
945
+ this.messageInput.value = '';
946
+ this.dispatchEvent(new CustomEvent('prompt', {
947
+ detail: {
948
+ prompt: content
949
+ }
950
+ }));
951
+ }
952
+ scrollDown() {
953
+ const container = this.renderRoot.querySelector('.container');
954
+ container.scrollTop = container.scrollHeight;
955
+ }
956
+ keypressManagement(event) {
957
+ if (event.key !== 'Enter' || event.shiftKey) {
958
+ this.requestUpdate();
959
+ return;
960
+ }
961
+ if (this.currentBoost && !this.canAnswerToMessageBoost(this.currentBoost) || this.loading || (!this.messageInput || this.messageInput.value === '') && (!this.currentBoost || this.currentBoost.required) || !this.hasInputsValues()) {
962
+ this.requestUpdate();
963
+ return;
964
+ }
965
+ event.preventDefault();
966
+ this.addMessage(this.messageInput.value.trim());
967
+ }
968
+ hasInputsValues() {
969
+ return this.inputsElement.values.reduce((acc, { value, required })=>required && value === '' ? false : acc, true);
970
+ }
971
+ answer(message) {
972
+ const boost = message.boost;
973
+ this.dispatchEvent(new CustomEvent('boost', {
974
+ detail: {
975
+ parent_history: message.uuid,
976
+ parent_conversation: message.parent_conversation || message.uuid,
977
+ ...boost
978
+ }
979
+ }));
980
+ }
981
+ canAnswerToMessageBoost(boost) {
982
+ if (!boost) {
983
+ return false;
984
+ }
985
+ if (boost.checkUrl && !boost.checkUrl.test(window.location.href)) {
986
+ return false;
987
+ }
988
+ if (boost.selector && !document.querySelector(boost.selector)) {
989
+ return false;
990
+ }
991
+ return true;
992
+ }
993
+ executeBoost(boost) {
994
+ this.dispatchEvent(new CustomEvent('executeboost', {
995
+ detail: boost
996
+ }));
997
+ }
998
+ getAvailableBoosts(boosts) {
999
+ return boosts.filter((boost)=>boost && (boost.standalone || boost.selector) && (boost.standalone || document.querySelectorAll(boost.selector).length === 1)).map((boost)=>({
1000
+ ...boost,
1001
+ context: {
1002
+ element: boost.standalone ? null : boost.selector
1003
+ },
1004
+ checkUrl: new RegExp(boost.url)
1005
+ })).filter((boost)=>boost.checkUrl.test(window.location.href));
1006
+ }
1007
+ pushMessage(message) {
1008
+ this.messages.push(message);
1009
+ this.requestUpdate();
1010
+ }
1011
+ render() {
1012
+ if (this.previousMessages !== JSON.stringify(this.messages)) {
1013
+ this.previousMessages = JSON.stringify(this.messages);
1014
+ setTimeout(()=>this.scrollDown(), 1);
1015
+ }
1016
+ setTimeout(()=>{
1017
+ this.renderRoot.querySelectorAll('.mermaid:not([data-processed=true]').forEach(async (el)=>{
1018
+ const { svg } = await mermaid.render('graphDiv', el.textContent);
1019
+ el.innerHTML = svg;
1020
+ el.setAttribute('data-processed', 'true');
1021
+ });
1022
+ }, 1);
1023
+ return lit.html`
1024
+ <section class="container ${this.currentBoost ? 'with-boost' : ''}">
1025
+ ${this.messages.map((message)=>lit.html`<section class="${message.role}">
1026
+ ${this.canAnswerToMessageBoost(message.boost) ? lit.html`<ui5-icon
1027
+ name="response"
1028
+ class="button action"
1029
+ @click=${()=>this.answer(message)}
1030
+ ></ui5-icon>` : lit.nothing}
1031
+ ${unsafeHtml_js.unsafeHTML(this.converter.makeHtml(message.role === 'user' ? message.content.replace(/\n/g, ' \n') : message.content.replace(/```markdown([\s\S]*?)```/g, (_, group)=>group)))}
1032
+ </section>`)}
1033
+ <digipair-chatbot-inputs
1034
+ @change=${()=>this.requestUpdate()}
1035
+ .inputs=${this.currentBoost?.inputs || []}
1036
+ .context=${{
1037
+ ...this.context,
1038
+ ...this.currentBoost?.context || {}
1039
+ }}
1040
+ ></digipair-chatbot-inputs>
1041
+
1042
+ ${!this.loading ? lit.nothing : lit.html`<section class="loading">
1043
+ <img src=${WRITTING_IMAGE} /><span class="step">${this.loadingStep}</span>
1044
+ </section>`}
1045
+ </section>
1046
+
1047
+ <section class="input-container ${this.currentBoost ? 'with-boost' : ''}">
1048
+ <section class="input">
1049
+ ${this.currentBoost?.parent_history ? lit.html`
1050
+ <section class="assistant">
1051
+ ${this.messages.filter((message)=>message.uuid === this.currentBoost?.parent_history).map((message)=>lit.html`
1052
+ <ui5-icon
1053
+ name="decline"
1054
+ class="button action"
1055
+ @click=${()=>this.dispatchEvent(new CustomEvent('boost', {
1056
+ detail: null
1057
+ }))}
1058
+ ></ui5-icon>
1059
+ ${unsafeHtml_js.unsafeHTML(this.converter.makeHtml(message.content.replace(/```markdown([\s\S]*?)```/g, (_, group)=>group)))}
1060
+
1061
+ <section class="sources">
1062
+ ${message.sources?.map((source)=>lit.html`
1063
+ <a
1064
+ class="source ${source.document_url ? 'has-link' : ''}"
1065
+ href=${source.document_url ?? 'javascript:'}
1066
+ target="_blank"
1067
+ >
1068
+ ${source.document_name}
1069
+ <div class="trust-bar">
1070
+ <div
1071
+ class="trust-bar-fill"
1072
+ style="width: ${source.rank * 100}%;"
1073
+ ></div>
1074
+ </div>
1075
+ </a>
1076
+ `)}
1077
+ </section>
1078
+
1079
+ <section class="actions ${this.loading ? 'loading' : ''}">
1080
+ ${this.getAvailableBoosts(message.boosts || []).map((boost)=>lit.html`
1081
+ <span class="action" @click=${()=>this.executeBoost(boost)}
1082
+ >${boost.summary}</span
1083
+ >
1084
+ `)}
1085
+ </section>
1086
+ `)}
1087
+ </section>
1088
+ ` : lit.nothing}
1089
+ <textarea
1090
+ id="messageInput"
1091
+ value=""
1092
+ placeholder=${this.currentBoost && !this.currentBoost.prompt ? '' : 'Saisir votre message'}
1093
+ @keydown=${()=>this.requestUpdate()}
1094
+ @keyup=${(event)=>this.keypressManagement(event)}
1095
+ ?disabled=${this.loading || this.currentBoost && !this.currentBoost.prompt}
1096
+ ></textarea>
1097
+ </section>
1098
+
1099
+ <ui5-icon
1100
+ name="begin"
1101
+ class="button ${this.currentBoost && !this.canAnswerToMessageBoost(this.currentBoost) || this.loading || (!this.messageInput || this.messageInput.value === '') && (!this.currentBoost || this.currentBoost.required) || !this.hasInputsValues() ? 'disabled' : ''}"
1102
+ @click=${()=>this.currentBoost && !this.canAnswerToMessageBoost(this.currentBoost) || this.loading || (!this.messageInput || this.messageInput.value === '') && (!this.currentBoost || this.currentBoost.required) || !this.hasInputsValues() ? void 0 : this.addMessage(this.messageInput.value.trim())}
1103
+ ></ui5-icon>
1104
+ </section>
1105
+ `;
1106
+ }
1107
+ constructor(...args){
1108
+ super(...args);
1109
+ this.previousMessages = '';
1110
+ }
1111
+ }
1112
+ __decorate([
1113
+ decorators_js.property({
1114
+ type: Boolean
1115
+ }),
1116
+ __metadata("design:type", Boolean)
1117
+ ], ChatElement.prototype, "loading", void 0);
1118
+ __decorate([
1119
+ decorators_js.property({
1120
+ type: Array
1121
+ }),
1122
+ __metadata("design:type", Array)
1123
+ ], ChatElement.prototype, "messages", void 0);
1124
+ __decorate([
1125
+ decorators_js.property({
1126
+ type: Object
1127
+ }),
1128
+ __metadata("design:type", Object)
1129
+ ], ChatElement.prototype, "currentBoost", void 0);
1130
+ __decorate([
1131
+ decorators_js.property({
1132
+ type: Object
1133
+ }),
1134
+ __metadata("design:type", Object)
1135
+ ], ChatElement.prototype, "context", void 0);
1136
+ __decorate([
1137
+ decorators_js.property({
1138
+ type: Array
1139
+ }),
1140
+ __metadata("design:type", Function),
1141
+ __metadata("design:paramtypes", []),
1142
+ __metadata("design:returntype", Array)
1143
+ ], ChatElement.prototype, "inputs", null);
1144
+ __decorate([
1145
+ decorators_js.property(),
1146
+ __metadata("design:type", String)
1147
+ ], ChatElement.prototype, "loadingStep", void 0);
1148
+ __decorate([
1149
+ decorators_js.query('#messageInput'),
1150
+ __metadata("design:type", typeof HTMLInputElement === "undefined" ? Object : HTMLInputElement)
1151
+ ], ChatElement.prototype, "messageInput", void 0);
1152
+ __decorate([
1153
+ decorators_js.query('digipair-chatbot-inputs'),
1154
+ __metadata("design:type", typeof InputsElement === "undefined" ? Object : InputsElement)
1155
+ ], ChatElement.prototype, "inputsElement", void 0);
1156
+ ChatElement = __decorate([
1157
+ decorators_js.customElement('digipair-chatbot-chat')
1158
+ ], ChatElement);
1159
+
1160
+ const styles$1 = lit.css`
1161
+ @keyframes bounce {
1162
+ from {
1163
+ width: 50px;
1164
+ height: 50px;
1165
+ }
1166
+ 50% {
1167
+ width: 55px;
1168
+ height: 55px;
1169
+ }
1170
+ to {
1171
+ width: 50px;
1172
+ height: 50px;
1173
+ }
1174
+ }
1175
+
1176
+ .container {
1177
+ position: fixed;
1178
+ z-index: 9999;
1179
+ right: 20px;
1180
+ bottom: 20px;
1181
+ line-height: 0.8;
1182
+ }
1183
+
1184
+ .panel {
1185
+ position: absolute;
1186
+ top: -50px;
1187
+ right: 0px;
1188
+ height: 50px;
1189
+ border-radius: 20px 0 20px 20px;
1190
+ transition-property: width, background-color;
1191
+ transition-duration: 0.3s, 0.3s;
1192
+ transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275),
1193
+ cubic-bezier(0.175, 0.885, 0.32, 1.275);
1194
+ transition-delay: 0s, 0s;
1195
+ box-shadow: rgba(0, 0, 0, 0.25) 4px 0.25rem 0.25rem;
1196
+ border: 1px solid rgb(134, 255, 0);
1197
+ width: 50px;
1198
+ background-color: rgb(255, 255, 255);
1199
+ }
1200
+
1201
+ .logo {
1202
+ width: 70px;
1203
+ height: 70px;
1204
+ position: absolute;
1205
+ right: -10px;
1206
+ top: -58px;
1207
+ transition: scale 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0s;
1208
+ }
1209
+
1210
+ .logo {
1211
+ cursor: pointer;
1212
+ }
1213
+ .logo:hover {
1214
+ scale: 1.1;
1215
+ }
1216
+
1217
+ .actions {
1218
+ float: right;
1219
+ margin-right: 60px;
1220
+ margin-top: -38px;
1221
+ }
1222
+
1223
+ .actions.loading {
1224
+ display: none;
1225
+ }
1226
+
1227
+ .actions > .action {
1228
+ background-color: rgba(255, 255, 255, 0.9);
1229
+ border-radius: 20px;
1230
+ font-size: 12px;
1231
+ color: rgb(60, 60, 60);
1232
+ padding: 8px 14px;
1233
+ cursor: pointer;
1234
+ display: inline-block;
1235
+ transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0s;
1236
+ transform: scale(0.95);
1237
+ margin-bottom: 4px;
1238
+ }
1239
+
1240
+ .actions > .action:hover {
1241
+ transform: scale(1);
1242
+ }
1243
+
1244
+ .result {
1245
+ position: absolute;
1246
+ right: 0px;
1247
+ top: -500px;
1248
+ width: 340px;
1249
+ height: 440px;
1250
+ border-radius: 20px 5px 0px 20px;
1251
+ background-color: rgb(255, 255, 255);
1252
+ box-shadow: rgba(0, 0, 0, 0.05) 0px 0.25rem 0.75rem;
1253
+ border: 1px solid rgb(134, 255, 0);
1254
+ color: rgb(60, 60, 60);
1255
+ }
1256
+
1257
+ .result-closed .result {
1258
+ display: none;
1259
+ }
1260
+ `;
1261
+
1262
+ function unescapeCSS(cssEscapedString) {
1263
+ return cssEscapedString.replace(/\\([0-9A-Fa-f]{1,6})\s?/g, (_match, charCode)=>String.fromCharCode(parseInt(charCode, 16))).replace(/\\/g, '');
1264
+ }
1265
+ function getCssSelector(element, options = {}) {
1266
+ const selector = getCssSelectorOrigin(element, options);
1267
+ return unescapeCSS(selector);
1268
+ }
1269
+
1270
+ let DomService = class DomService {
1271
+ async executeRemoteReasoning({ digipair, reasoning, input, apiUrl }, _pinsSettingsList, context) {
1272
+ const response = await fetch(`${apiUrl}/${digipair}/${reasoning}`, {
1273
+ method: 'POST',
1274
+ headers: {
1275
+ 'Content-Type': 'application/json'
1276
+ },
1277
+ body: JSON.stringify({
1278
+ ...context.input,
1279
+ ...input
1280
+ })
1281
+ });
1282
+ const result = await response.json();
1283
+ if (response.status >= 400) {
1284
+ throw new Error(result.message);
1285
+ }
1286
+ return result;
1287
+ }
1288
+ };
1289
+ const executeRemoteReasoning = (params, pinsSettingsList, context)=>new DomService().executeRemoteReasoning(params, pinsSettingsList, context);
1290
+
1291
+ var actionsChatbot = /*#__PURE__*/Object.freeze({
1292
+ __proto__: null,
1293
+ executeRemoteReasoning: executeRemoteReasoning
10
1294
  });
11
- Object.defineProperty(exports, "DigipairFullElement", {
12
- enumerable: true,
13
- get: function () { return index.DigipairFullElement; }
1295
+
1296
+ engine.config.set('LIBRARIES', {
1297
+ '@digipair/actions-chatbot': actionsChatbot
14
1298
  });
15
- exports.config = index.config;
1299
+ const _config = {
1300
+ API_URL: window.location.origin,
1301
+ COMMON_EXPERIENCE: 'common'
1302
+ };
1303
+ const config = {
1304
+ set: (key, value)=>{
1305
+ if (key === 'LIBRARIES') {
1306
+ engine.config.set('LIBRARIES', {
1307
+ '@digipair/actions-chatbot': actionsChatbot,
1308
+ ...value
1309
+ });
1310
+ return;
1311
+ }
1312
+ if ([
1313
+ 'BASE_URL',
1314
+ 'VERSIONS'
1315
+ ].indexOf(key) >= 0) {
1316
+ engine.config.set('BASE_URL', value);
1317
+ return;
1318
+ }
1319
+ _config[key] = value;
1320
+ }
1321
+ };
1322
+
1323
+ class ChatbotElement extends lit.LitElement {
1324
+ CHAT_COMMAND(digipair, reasoning) {
1325
+ return {
1326
+ library: '@digipair/actions-chatbot',
1327
+ element: 'executeRemoteReasoning',
1328
+ properties: {
1329
+ digipair,
1330
+ reasoning: reasoning ?? 'conversation',
1331
+ apiUrl: this.apiUrl
1332
+ }
1333
+ };
1334
+ }
1335
+ connectedCallback() {
1336
+ super.connectedCallback();
1337
+ this.loadUser();
1338
+ this.boostListener();
1339
+ this.externalBoostListener();
1340
+ this.initializeSSE();
1341
+ document.addEventListener('click', this.blurEvent);
1342
+ }
1343
+ disconnectedCallback() {
1344
+ document.removeEventListener('click', this.blurEvent);
1345
+ }
1346
+ externalBoostListener() {
1347
+ this.addEventListener('executeBoost', ({ detail })=>{
1348
+ setTimeout(()=>this.executeBoost({
1349
+ context: {},
1350
+ ...detail
1351
+ }), 1);
1352
+ });
1353
+ }
1354
+ initializeSSE() {
1355
+ const digipair = this.code;
1356
+ const reasoning = 'notification';
1357
+ fetchEventSource(`${this.apiUrl}/${digipair}/${reasoning}`, {
1358
+ method: 'POST',
1359
+ headers: {
1360
+ 'Content-Type': 'application/json'
1361
+ },
1362
+ onmessage: (message)=>{
1363
+ if (message.event !== 'message') {
1364
+ return;
1365
+ }
1366
+ const data = JSON.parse(message.data);
1367
+ if (data.type === 'step') {
1368
+ this.loadingStep = data.content;
1369
+ }
1370
+ if (data.type === 'message') {
1371
+ this.pushMessage(data.content);
1372
+ }
1373
+ },
1374
+ body: JSON.stringify({
1375
+ userId: this.userId
1376
+ }),
1377
+ onerror (err) {
1378
+ console.error('[Digipair] SSE Error:', err);
1379
+ }
1380
+ });
1381
+ }
1382
+ loadUser() {
1383
+ this.newUser = false;
1384
+ if (this.userId) {
1385
+ return;
1386
+ }
1387
+ this.userId = localStorage.getItem('digipair-user');
1388
+ if (!this.userId) {
1389
+ // set uuid
1390
+ this.userId = Math.random().toString(36).substring(2, 15);
1391
+ localStorage.setItem('digipair-user', this.userId);
1392
+ this.newUser = true;
1393
+ }
1394
+ }
1395
+ async boostListener() {
1396
+ const boosts = (await this.executeScene('boosts')).map((boost)=>({
1397
+ ...boost,
1398
+ checkUrl: new RegExp(boost.url)
1399
+ })).filter((boost)=>boost.selector);
1400
+ let lastSelectedBoosts = [];
1401
+ document.addEventListener('mouseover', (event)=>{
1402
+ lastSelectedBoosts = event.target.closest('digipair-chatbot') ? null : this.getBoostsFromTarget(event.target, boosts);
1403
+ setTimeout(async ()=>{
1404
+ // si on est sur le chatbot, on ne fait rien
1405
+ if (!lastSelectedBoosts) {
1406
+ return;
1407
+ }
1408
+ const selectedBoosts = this.getBoostsFromTarget(event.target, boosts);
1409
+ // garder les boosts communs entre les deux listes
1410
+ this.boosters = selectedBoosts.filter((boost)=>lastSelectedBoosts?.includes(boost)).map((boost)=>({
1411
+ ...boost,
1412
+ context: {
1413
+ ...boost.context || {},
1414
+ element: getCssSelector(event.target.closest(boost.selector))
1415
+ }
1416
+ }));
1417
+ }, 1000);
1418
+ }, true);
1419
+ }
1420
+ getBoostsFromTarget(target, boosts) {
1421
+ return boosts.filter((boost)=>boost.checkUrl.test(window.location.href) && !!target.closest(boost.selector));
1422
+ }
1423
+ async loadDigipair() {
1424
+ this.isDigipairLoading = true;
1425
+ const digipair = this.code;
1426
+ const reasoning = 'metadata';
1427
+ const metadata = await this.executeScene(reasoning);
1428
+ this.metadata = {
1429
+ ...metadata,
1430
+ id: digipair,
1431
+ config: {
1432
+ VERSIONS: metadata.config.VERSIONS
1433
+ }
1434
+ };
1435
+ await this.loadHistory();
1436
+ setTimeout(()=>{
1437
+ this.scrollDown();
1438
+ setTimeout(()=>{
1439
+ this.closeResult();
1440
+ }, 1);
1441
+ }, 1);
1442
+ this.isDigipairLoading = false;
1443
+ if (this.newUser) {
1444
+ this.manageNewUser();
1445
+ }
1446
+ }
1447
+ manageNewUser() {
1448
+ if (!this.firstOpenDelay) {
1449
+ return;
1450
+ }
1451
+ setTimeout(()=>{
1452
+ if (this.alreadyOpened) {
1453
+ return;
1454
+ }
1455
+ this.openResult();
1456
+ }, this.firstOpenDelay);
1457
+ }
1458
+ async loadHistory() {
1459
+ const userId = this.userId;
1460
+ const reasoning = 'history';
1461
+ const messages = (await this.executeScene(reasoning, {
1462
+ userId
1463
+ })).map((message)=>({
1464
+ ...message,
1465
+ boost: message.boost ? {
1466
+ ...message.boost,
1467
+ checkUrl: message.boost.url ? new RegExp(message.boost.url) : null
1468
+ } : null
1469
+ }));
1470
+ if (messages.length > 0) {
1471
+ this.messages = messages;
1472
+ }
1473
+ }
1474
+ scrollDown() {
1475
+ const container = this.shadowRoot.querySelector('.container');
1476
+ container.scrollTop = container.scrollHeight;
1477
+ }
1478
+ async execute(boost, message) {
1479
+ this.loadingStep = '';
1480
+ this.loading = true;
1481
+ if (message || boost?.command?.properties?.input?.prompt) {
1482
+ this.messages.push({
1483
+ role: 'user',
1484
+ content: message || boost.command.properties.input.prompt
1485
+ });
1486
+ }
1487
+ this.chatbot.requestUpdate();
1488
+ const command = boost?.command ? boost.command : this.CHAT_COMMAND(this.code, boost?.reasoning);
1489
+ try {
1490
+ const pins = JSON.parse(JSON.stringify(command));
1491
+ pins.properties = pins.properties || {};
1492
+ pins.properties.input = {
1493
+ ...pins.properties.input || {},
1494
+ prompt: message || pins.properties.input?.prompt,
1495
+ inputs: this.chatbot.inputs,
1496
+ userId: this.userId,
1497
+ step: boost?.step,
1498
+ parent_history: boost?.parent_history,
1499
+ parent_conversation: boost?.parent_conversation,
1500
+ context: boost?.context || {}
1501
+ };
1502
+ const detail = await engine.executePinsList([
1503
+ pins
1504
+ ], {
1505
+ config: {
1506
+ VERSIONS: this.metadata.config.VERSIONS
1507
+ }
1508
+ }, 'boost');
1509
+ this.currentBoost = detail.boost ? {
1510
+ parent_history: detail.uuid,
1511
+ parent_conversation: detail.parent_conversation || detail.uuid,
1512
+ ...detail.boost
1513
+ } : null;
1514
+ this.pushMessage({
1515
+ role: 'assistant',
1516
+ content: detail.assistant,
1517
+ uuid: detail.uuid,
1518
+ boost: detail.boost,
1519
+ boosts: detail.boosts,
1520
+ sources: detail.sources,
1521
+ parent_conversation: detail.parent_conversation,
1522
+ parent_history: detail.parent_history
1523
+ });
1524
+ if (detail.command && detail.command.length > 0) {
1525
+ await engine.executePinsList(detail.command, {
1526
+ config: {
1527
+ VERSIONS: this.metadata.config.VERSIONS
1528
+ }
1529
+ }, 'boost.command');
1530
+ }
1531
+ } catch (error) {
1532
+ this.pushMessage({
1533
+ role: 'assistant',
1534
+ content: 'Oops...'
1535
+ });
1536
+ }
1537
+ this.loadingStep = '';
1538
+ this.loading = false;
1539
+ }
1540
+ executeBoost(boost) {
1541
+ this.execute(boost);
1542
+ this.openResult();
1543
+ setTimeout(()=>{
1544
+ (this.chatbot?.shadowRoot?.querySelector('#messageInput')).focus();
1545
+ }, 1);
1546
+ }
1547
+ pushMessage(message) {
1548
+ this.openResult();
1549
+ this.messages.push(message);
1550
+ this.chatbot.requestUpdate();
1551
+ }
1552
+ openResult() {
1553
+ this.resultState = 'open';
1554
+ setTimeout(()=>{
1555
+ (this.chatbot?.shadowRoot?.querySelector('#messageInput')).focus();
1556
+ this.chatbot.requestUpdate();
1557
+ }, 1);
1558
+ this.alreadyOpened = true;
1559
+ }
1560
+ closeResult() {
1561
+ this.resultState = 'closed';
1562
+ }
1563
+ setBoost(boost) {
1564
+ this.currentBoost = boost;
1565
+ this.boosters = [];
1566
+ }
1567
+ static{
1568
+ this.styles = styles$1;
1569
+ }
1570
+ render() {
1571
+ if (this.metadata?.id !== this.code) {
1572
+ if (!this.isDigipairLoading) {
1573
+ this.loadDigipair();
1574
+ }
1575
+ return lit.html``;
1576
+ }
1577
+ return lit.html`
1578
+ <style>
1579
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
1580
+ font-family: 'Poppins', sans-serif;
1581
+ font-weight: 300;
1582
+ font-style: normal;
1583
+
1584
+ --digipair-color-primary: ${this.metadata.primary};
1585
+ --digipair-color-text-primary: ${this.metadata.textPrimary};
1586
+ --digipair-color-secondary: ${this.metadata.secondary};
1587
+ --digipair-color-text-secondary: ${this.metadata.textSecondary};
1588
+ </style>
1589
+
1590
+ <section class="container result-${this.resultState}">
1591
+ <section class="result" style="border: 1px solid var(--digipair-color-primary, #52DFDB)">
1592
+ <digipair-chatbot-chat
1593
+ ?loading=${this.loading}
1594
+ .messages=${this.messages}
1595
+ .currentBoost=${this.currentBoost}
1596
+ .context=${{
1597
+ config: this.metadata.config,
1598
+ variables: this.metadata.variables
1599
+ }}
1600
+ loadingStep=${this.loadingStep}
1601
+ @prompt=${(event)=>this.execute(this.currentBoost, event.detail.prompt)}
1602
+ @executeboost=${(event)=>this.executeBoost(event.detail)}
1603
+ @boost=${(event)=>this.setBoost(event.detail)}
1604
+ ></digipair-chatbot-chat>
1605
+ </section>
1606
+
1607
+ <section class="actions ${this.loading ? 'loading' : ''}">
1608
+ ${this.boosters.map((boost)=>lit.html`
1609
+ <span
1610
+ class="action"
1611
+ style="border: 1px solid var(--digipair-color-primary, #52DFDB)"
1612
+ @click=${()=>this.executeBoost(boost)}
1613
+ >${boost.summary}</span
1614
+ >
1615
+ `)}
1616
+ </section>
1617
+
1618
+ <section
1619
+ class="panel"
1620
+ style="border: 1px solid var(--digipair-color-primary, #52DFDB)"
1621
+ ></section>
1622
+ <img
1623
+ @click=${()=>this.resultState !== 'closed' ? this.closeResult() : this.openResult()}
1624
+ class="logo ${this.loading ? 'loading' : ''}"
1625
+ src="${this.apiUrl}/${this.code}/avatar.png"
1626
+ alt="Agent Avatar"
1627
+ />
1628
+ </section>
1629
+ `;
1630
+ }
1631
+ constructor(...args){
1632
+ super(...args);
1633
+ this.code = 'common';
1634
+ this.firstOpenDelay = 60000;
1635
+ this.apiUrl = _config.API_URL;
1636
+ this.userId = null;
1637
+ this.boosters = [];
1638
+ this.loading = false;
1639
+ this.resultState = 'open';
1640
+ this.currentBoost = null;
1641
+ this.messages = [];
1642
+ this.loadingStep = '';
1643
+ this.alreadyOpened = false;
1644
+ this.isDigipairLoading = false;
1645
+ this.blurEvent = (event)=>{
1646
+ const path = event.composedPath();
1647
+ if (!path.includes(this)) {
1648
+ // L'événement a été déclenché en dehors du composant
1649
+ this.closeResult();
1650
+ }
1651
+ };
1652
+ this.executeScene = async (reasoning, input = {})=>{
1653
+ const digipair = this.code;
1654
+ const response = await fetch(`${this.apiUrl}/${digipair}/${reasoning}`, {
1655
+ method: 'POST',
1656
+ headers: {
1657
+ 'Content-Type': 'application/json'
1658
+ },
1659
+ body: JSON.stringify(input)
1660
+ });
1661
+ return await response.json();
1662
+ };
1663
+ }
1664
+ }
1665
+ __decorate([
1666
+ decorators_js.property()
1667
+ ], ChatbotElement.prototype, "code", void 0);
1668
+ __decorate([
1669
+ decorators_js.property()
1670
+ ], ChatbotElement.prototype, "firstOpenDelay", void 0);
1671
+ __decorate([
1672
+ decorators_js.property()
1673
+ ], ChatbotElement.prototype, "apiUrl", void 0);
1674
+ __decorate([
1675
+ decorators_js.property(),
1676
+ __metadata("design:type", Object)
1677
+ ], ChatbotElement.prototype, "userId", void 0);
1678
+ __decorate([
1679
+ decorators_js.state(),
1680
+ __metadata("design:type", Array)
1681
+ ], ChatbotElement.prototype, "boosters", void 0);
1682
+ __decorate([
1683
+ decorators_js.state()
1684
+ ], ChatbotElement.prototype, "loading", void 0);
1685
+ __decorate([
1686
+ decorators_js.state()
1687
+ ], ChatbotElement.prototype, "resultState", void 0);
1688
+ __decorate([
1689
+ decorators_js.state(),
1690
+ __metadata("design:type", Object)
1691
+ ], ChatbotElement.prototype, "currentBoost", void 0);
1692
+ __decorate([
1693
+ decorators_js.state(),
1694
+ __metadata("design:type", Array)
1695
+ ], ChatbotElement.prototype, "messages", void 0);
1696
+ __decorate([
1697
+ decorators_js.state()
1698
+ ], ChatbotElement.prototype, "loadingStep", void 0);
1699
+ __decorate([
1700
+ decorators_js.query('digipair-chatbot-chat'),
1701
+ __metadata("design:type", typeof ChatElement === "undefined" ? Object : ChatElement)
1702
+ ], ChatbotElement.prototype, "chatbot", void 0);
1703
+ ChatbotElement = __decorate([
1704
+ decorators_js.customElement('digipair-chatbot')
1705
+ ], ChatbotElement);
1706
+
1707
+ const styles = lit.css`
1708
+ @keyframes bounce {
1709
+ from {
1710
+ width: 50px;
1711
+ height: 50px;
1712
+ }
1713
+ 50% {
1714
+ width: 55px;
1715
+ height: 55px;
1716
+ }
1717
+ to {
1718
+ width: 50px;
1719
+ height: 50px;
1720
+ }
1721
+ }
1722
+
1723
+ .container {
1724
+ position: absolute;
1725
+ top: 20px;
1726
+ bottom: 20px;
1727
+ right: 20px;
1728
+ left: 20px;
1729
+ line-height: 0.8;
1730
+ }
1731
+
1732
+ .panel {
1733
+ position: absolute;
1734
+ top: -5px;
1735
+ right: -5px;
1736
+ height: 50px;
1737
+ border-radius: 20px 0 20px 20px;
1738
+ transition-property: width, background-color;
1739
+ transition-duration: 0.3s, 0.3s;
1740
+ transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275),
1741
+ cubic-bezier(0.175, 0.885, 0.32, 1.275);
1742
+ transition-delay: 0s, 0s;
1743
+ box-shadow: rgba(0, 0, 0, 0.25) 4px 0.25rem 0.25rem;
1744
+ border: 1px solid rgb(134, 255, 0);
1745
+ width: 50px;
1746
+ background-color: rgb(255, 255, 255);
1747
+ }
1748
+
1749
+ .logo {
1750
+ width: 70px;
1751
+ height: 70px;
1752
+ position: absolute;
1753
+ right: -15px;
1754
+ top: -15px;
1755
+ transition: scale 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0s;
1756
+ }
1757
+
1758
+ .logo {
1759
+ cursor: pointer;
1760
+ }
1761
+ .logo:hover {
1762
+ scale: 1.1;
1763
+ }
1764
+
1765
+ .actions {
1766
+ position: absolute;
1767
+ right: -5px;
1768
+ top: 62px;
1769
+ text-align: right;
1770
+ }
1771
+
1772
+ .actions.loading {
1773
+ display: none;
1774
+ }
1775
+
1776
+ .actions .action {
1777
+ background-color: rgba(255, 255, 255, 0.9);
1778
+ border-radius: 20px;
1779
+ font-size: 12px;
1780
+ color: rgb(60, 60, 60);
1781
+ padding: 8px 14px;
1782
+ cursor: pointer;
1783
+ display: inline-block;
1784
+ transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0s;
1785
+ transform: scale(0.95);
1786
+ margin-bottom: 4px;
1787
+ }
1788
+
1789
+ .actions .action:hover {
1790
+ transform: scale(1);
1791
+ }
1792
+
1793
+ .result {
1794
+ position: absolute;
1795
+ left: 0;
1796
+ right: 0;
1797
+ top: 0;
1798
+ bottom: 0;
1799
+ border-radius: 20px 5px 0px 20px;
1800
+ background-color: rgb(255, 255, 255);
1801
+ box-shadow: rgba(0, 0, 0, 0.05) 0px 0.25rem 0.75rem;
1802
+ border: 1px solid rgb(134, 255, 0);
1803
+ color: rgb(60, 60, 60);
1804
+ }
1805
+ `;
1806
+
1807
+ class DigipairFullElement extends lit.LitElement {
1808
+ CHAT_COMMAND(digipair, reasoning) {
1809
+ return {
1810
+ library: '@digipair/actions-chatbot',
1811
+ element: 'executeRemoteReasoning',
1812
+ properties: {
1813
+ digipair,
1814
+ reasoning: reasoning ?? 'conversation',
1815
+ apiUrl: this.apiUrl
1816
+ }
1817
+ };
1818
+ }
1819
+ connectedCallback() {
1820
+ super.connectedCallback();
1821
+ this.loadUser();
1822
+ this.loadBoosters();
1823
+ this.initializeSSE();
1824
+ }
1825
+ initializeSSE() {
1826
+ const digipair = this.code;
1827
+ const reasoning = 'notification';
1828
+ fetchEventSource(`${this.apiUrl}/${digipair}/${reasoning}`, {
1829
+ method: 'POST',
1830
+ headers: {
1831
+ 'Content-Type': 'application/json'
1832
+ },
1833
+ onmessage: (message)=>{
1834
+ if (message.event !== 'message') {
1835
+ return;
1836
+ }
1837
+ const data = JSON.parse(message.data);
1838
+ if (data.type === 'step') {
1839
+ this.loadingStep = data.content;
1840
+ }
1841
+ if (data.type === 'message') {
1842
+ this.pushMessage(data.content);
1843
+ }
1844
+ },
1845
+ body: JSON.stringify({
1846
+ userId: this.userId
1847
+ }),
1848
+ onerror (err) {
1849
+ console.error('[Digipair] SSE Error:', err);
1850
+ }
1851
+ });
1852
+ }
1853
+ loadUser() {
1854
+ if (this.userId) {
1855
+ return;
1856
+ }
1857
+ this.userId = localStorage.getItem('digipair-user');
1858
+ if (!this.userId) {
1859
+ // set uuid
1860
+ this.userId = Math.random().toString(36).substring(2, 15);
1861
+ localStorage.setItem('digipair-user', this.userId);
1862
+ }
1863
+ }
1864
+ async loadBoosters() {
1865
+ this.cacheBoosters = (await this.executeScene('boosts')).map((boost)=>({
1866
+ ...boost,
1867
+ checkUrl: new RegExp(boost.url)
1868
+ })).filter((boost)=>boost.standalone);
1869
+ }
1870
+ async loadDigipair() {
1871
+ this.isDigipairLoading = true;
1872
+ const digipair = this.code;
1873
+ const reasoning = 'metadata';
1874
+ const metadata = await this.executeScene(reasoning);
1875
+ this.metadata = {
1876
+ ...metadata,
1877
+ id: digipair,
1878
+ config: {
1879
+ VERSIONS: metadata.config.VERSIONS
1880
+ }
1881
+ };
1882
+ await this.loadHistory();
1883
+ setTimeout(()=>{
1884
+ this.scrollDown();
1885
+ }, 1);
1886
+ this.isDigipairLoading = false;
1887
+ }
1888
+ async loadHistory() {
1889
+ const userId = this.userId;
1890
+ const reasoning = 'history';
1891
+ const messages = (await this.executeScene(reasoning, {
1892
+ userId
1893
+ })).map((message)=>({
1894
+ ...message,
1895
+ boost: message.boost ? {
1896
+ ...message.boost,
1897
+ checkUrl: message.boost.url ? new RegExp(message.boost.url) : null
1898
+ } : null
1899
+ }));
1900
+ if (messages.length > 0) {
1901
+ this.messages = messages;
1902
+ }
1903
+ }
1904
+ scrollDown() {
1905
+ const container = this.shadowRoot.querySelector('.container');
1906
+ container.scrollTop = container.scrollHeight;
1907
+ }
1908
+ async execute(boost, message) {
1909
+ this.loadingStep = '';
1910
+ this.loading = true;
1911
+ if (message || boost?.command?.properties?.input?.prompt) {
1912
+ this.messages.push({
1913
+ role: 'user',
1914
+ content: message || boost.command.properties.input.prompt
1915
+ });
1916
+ }
1917
+ this.chatbot.requestUpdate();
1918
+ const command = boost?.command ? boost.command : this.CHAT_COMMAND(this.code, boost?.reasoning);
1919
+ try {
1920
+ const pins = JSON.parse(JSON.stringify(command));
1921
+ pins.properties = pins.properties || {};
1922
+ pins.properties.input = {
1923
+ ...pins.properties.input || {},
1924
+ prompt: message || pins.properties.input?.prompt,
1925
+ inputs: this.chatbot.inputs,
1926
+ userId: this.userId,
1927
+ step: boost?.step,
1928
+ parent_history: boost?.parent_history,
1929
+ parent_conversation: boost?.parent_conversation,
1930
+ context: boost?.context || {},
1931
+ ...!boost ? {} : {
1932
+ boost: {
1933
+ name: boost.name,
1934
+ text: boost.text
1935
+ }
1936
+ }
1937
+ };
1938
+ const detail = await engine.executePinsList([
1939
+ pins
1940
+ ], {
1941
+ config: {
1942
+ VERSIONS: this.metadata.config.VERSIONS
1943
+ }
1944
+ }, 'boost');
1945
+ this.currentBoost = detail.boost ? {
1946
+ parent_history: detail.uuid,
1947
+ parent_conversation: detail.parent_conversation || detail.uuid,
1948
+ ...detail.boost
1949
+ } : null;
1950
+ this.pushMessage({
1951
+ role: 'assistant',
1952
+ content: detail.assistant,
1953
+ uuid: detail.uuid,
1954
+ boost: detail.boost,
1955
+ boosts: detail.boosts,
1956
+ sources: detail.sources,
1957
+ parent_conversation: detail.parent_conversation,
1958
+ parent_history: detail.parent_history
1959
+ });
1960
+ if (detail.command && detail.command.length > 0) {
1961
+ engine.executePinsList(detail.command, {
1962
+ config: {
1963
+ VERSIONS: this.metadata.config.VERSIONS
1964
+ }
1965
+ }, 'boost.command');
1966
+ }
1967
+ } catch (error) {
1968
+ this.pushMessage({
1969
+ role: 'assistant',
1970
+ content: 'Oops...'
1971
+ });
1972
+ }
1973
+ this.loadingStep = '';
1974
+ this.loading = false;
1975
+ }
1976
+ executeBoost(boost) {
1977
+ this.execute(boost);
1978
+ this.closeMenu();
1979
+ setTimeout(()=>{
1980
+ (this.chatbot?.shadowRoot?.querySelector('#messageInput')).focus();
1981
+ }, 1);
1982
+ }
1983
+ pushMessage(message) {
1984
+ this.messages.push(message);
1985
+ this.chatbot.requestUpdate();
1986
+ }
1987
+ async openMenu() {
1988
+ this.boosters = this.cacheBoosters;
1989
+ }
1990
+ closeMenu() {
1991
+ this.boosters = [];
1992
+ }
1993
+ setBoost(boost) {
1994
+ this.currentBoost = boost;
1995
+ this.boosters = [];
1996
+ }
1997
+ static{
1998
+ this.styles = styles;
1999
+ }
2000
+ render() {
2001
+ if (this.metadata?.id !== this.code) {
2002
+ if (!this.isDigipairLoading) {
2003
+ this.loadDigipair();
2004
+ }
2005
+ return lit.html``;
2006
+ }
2007
+ return lit.html`
2008
+ <style>
2009
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
2010
+ font-family: 'Poppins', sans-serif;
2011
+ font-weight: 300;
2012
+ font-style: normal;
2013
+
2014
+ --digipair-color-primary: ${this.metadata.primary};
2015
+ --digipair-color-primary: ${this.metadata.secondary};
2016
+ --digipair-color-text-primary: ${this.metadata.textPrimary};
2017
+ --digipair-color-text-primary: ${this.metadata.textSecondary};
2018
+ </style>
2019
+
2020
+ <section class="container">
2021
+ <section class="result" style="border: 1px solid var(--digipair-color-primary, #52DFDB)">
2022
+ <digipair-chatbot-chat
2023
+ ?loading=${this.loading}
2024
+ .messages=${this.messages}
2025
+ .currentBoost=${this.currentBoost}
2026
+ .context=${{
2027
+ config: this.metadata.config,
2028
+ variables: this.metadata.variables
2029
+ }}
2030
+ loadingStep=${this.loadingStep}
2031
+ @prompt=${(event)=>this.execute(this.currentBoost, event.detail.prompt)}
2032
+ @boost=${(event)=>this.setBoost(event.detail)}
2033
+ @executeboost=${(event)=>this.executeBoost(event.detail)}
2034
+ ></digipair-chatbot-chat>
2035
+ </section>
2036
+
2037
+ <section class="actions ${this.loading ? 'loading' : ''}">
2038
+ ${this.boosters.map((boost)=>lit.html`
2039
+ <div>
2040
+ <span
2041
+ class="action"
2042
+ style="border: 1px solid var(--digipair-color-primary, #52DFDB)"
2043
+ @click=${()=>this.executeBoost(boost)}
2044
+ >${boost.summary}</span
2045
+ >
2046
+ </div>
2047
+ `)}
2048
+ </section>
2049
+
2050
+ <section
2051
+ class="panel"
2052
+ style="border: 1px solid var(--digipair-color-primary, #52DFDB)"
2053
+ ></section>
2054
+ <img
2055
+ class="logo ${this.loading ? 'loading' : ''}"
2056
+ src=${this.metadata.avatar}
2057
+ @click=${()=>this.boosters.length <= 0 ? this.openMenu() : this.closeMenu()}
2058
+ />
2059
+ </section>
2060
+ `;
2061
+ }
2062
+ constructor(...args){
2063
+ super(...args);
2064
+ this.code = 'common';
2065
+ this.apiUrl = _config.API_URL;
2066
+ this.userId = null;
2067
+ this.boosters = [];
2068
+ this.loading = false;
2069
+ this.currentBoost = null;
2070
+ this.messages = [];
2071
+ this.loadingStep = '';
2072
+ this.cacheBoosters = [];
2073
+ this.isDigipairLoading = false;
2074
+ this.executeScene = async (reasoning, input = {})=>{
2075
+ const digipair = this.code;
2076
+ const response = await fetch(`${this.apiUrl}/${digipair}/${reasoning}`, {
2077
+ method: 'POST',
2078
+ headers: {
2079
+ 'Content-Type': 'application/json'
2080
+ },
2081
+ body: JSON.stringify(input)
2082
+ });
2083
+ return await response.json();
2084
+ };
2085
+ }
2086
+ }
2087
+ __decorate([
2088
+ decorators_js.property()
2089
+ ], DigipairFullElement.prototype, "code", void 0);
2090
+ __decorate([
2091
+ decorators_js.property()
2092
+ ], DigipairFullElement.prototype, "apiUrl", void 0);
2093
+ __decorate([
2094
+ decorators_js.property(),
2095
+ __metadata("design:type", Object)
2096
+ ], DigipairFullElement.prototype, "userId", void 0);
2097
+ __decorate([
2098
+ decorators_js.state(),
2099
+ __metadata("design:type", Array)
2100
+ ], DigipairFullElement.prototype, "boosters", void 0);
2101
+ __decorate([
2102
+ decorators_js.state()
2103
+ ], DigipairFullElement.prototype, "loading", void 0);
2104
+ __decorate([
2105
+ decorators_js.state(),
2106
+ __metadata("design:type", Object)
2107
+ ], DigipairFullElement.prototype, "currentBoost", void 0);
2108
+ __decorate([
2109
+ decorators_js.state(),
2110
+ __metadata("design:type", Array)
2111
+ ], DigipairFullElement.prototype, "messages", void 0);
2112
+ __decorate([
2113
+ decorators_js.state()
2114
+ ], DigipairFullElement.prototype, "loadingStep", void 0);
2115
+ __decorate([
2116
+ decorators_js.query('digipair-chatbot-chat'),
2117
+ __metadata("design:type", typeof ChatElement === "undefined" ? Object : ChatElement)
2118
+ ], DigipairFullElement.prototype, "chatbot", void 0);
2119
+ DigipairFullElement = __decorate([
2120
+ decorators_js.customElement('digipair-chatbot-full')
2121
+ ], DigipairFullElement);
2122
+
2123
+ exports.ChatbotElement = ChatbotElement;
2124
+ exports.DigipairFullElement = DigipairFullElement;
2125
+ exports.config = config;