@telia-ace/widget-conversation-flamingo 1.1.12-rc.1 → 1.1.12-rc.2
Sign up to get free protection for your applications and to get access to all the features.
- package/conversation-8e924136.js +572 -0
- package/conversation-a518bd92.mjs +2634 -0
- package/conversation-component.d.ts +2 -0
- package/conversation-platform.d.ts +9 -49
- package/conversation-session.d.ts +11 -0
- package/conversation.d.ts +23 -0
- package/entry.d.ts +9 -0
- package/group.d.ts +7 -0
- package/index-231900d1.mjs +780 -0
- package/index-592f145b.js +3 -0
- package/index-b34ddf78.js +1 -0
- package/{index-1ea0fde8.mjs → index-b5ca9962.mjs} +320 -319
- package/index.d.ts +6 -10
- package/index.js +1 -1
- package/index.mjs +7 -9
- package/{components/conversation/ui/message-types → message-types}/message-type-html.d.ts +3 -2
- package/models/agent.d.ts +8 -0
- package/models/conversation-entry.d.ts +11 -0
- package/models/conversation-provider.d.ts +19 -0
- package/models/conversation-session-state.d.ts +13 -0
- package/models/user.d.ts +8 -0
- package/package.json +5 -6
- package/types.d.ts +9 -123
- package/agent.d.ts +0 -20
- package/components/conversation/conversation.d.ts +0 -19
- package/components/conversation/plugin.d.ts +0 -45
- package/components/conversation/ui/message-list.d.ts +0 -9
- package/components/conversation/ui/message-types/message-type-link-list.d.ts +0 -8
- package/components/conversation/ui/message-types/message-type-separator.d.ts +0 -7
- package/components/conversation/ui/message.d.ts +0 -8
- package/components/conversation/utils.d.ts +0 -1
- package/conversation-5265abc7.js +0 -446
- package/conversation-8c2255c2.mjs +0 -1865
- package/conversation-controller.d.ts +0 -118
- package/conversation-history.d.ts +0 -26
- package/conversation-provider.d.ts +0 -32
- package/index-5cf6726d.js +0 -156
- package/index-836222bd.mjs +0 -3923
- package/index-c51d4b6a.js +0 -1
- package/send-18482cae.mjs +0 -4
- package/send-eb8b9428.js +0 -1
- package/store.d.ts +0 -31
- package/user.d.ts +0 -9
- package/utils/custom-message.d.ts +0 -2
- package/utils/index.d.ts +0 -1
- package/utils/open-chat-widget.d.ts +0 -4
- package/utils/swap-provider.d.ts +0 -8
@@ -0,0 +1,780 @@
|
|
1
|
+
const gt = async (e) => {
|
2
|
+
e.registerComponent("conversation", import("./conversation-a518bd92.mjs").then((t) => t.c));
|
3
|
+
const r = await Promise.resolve().then(() => yt).then(
|
4
|
+
(t) => t.ConversationPlatform
|
5
|
+
);
|
6
|
+
e.container.environment.container.register(
|
7
|
+
"conversation",
|
8
|
+
new r()
|
9
|
+
);
|
10
|
+
};
|
11
|
+
let m;
|
12
|
+
const q = new Uint8Array(16);
|
13
|
+
function G() {
|
14
|
+
if (!m && (m = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !m))
|
15
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
16
|
+
return m(q);
|
17
|
+
}
|
18
|
+
const a = [];
|
19
|
+
for (let e = 0; e < 256; ++e)
|
20
|
+
a.push((e + 256).toString(16).slice(1));
|
21
|
+
function J(e, r = 0) {
|
22
|
+
return a[e[r + 0]] + a[e[r + 1]] + a[e[r + 2]] + a[e[r + 3]] + "-" + a[e[r + 4]] + a[e[r + 5]] + "-" + a[e[r + 6]] + a[e[r + 7]] + "-" + a[e[r + 8]] + a[e[r + 9]] + "-" + a[e[r + 10]] + a[e[r + 11]] + a[e[r + 12]] + a[e[r + 13]] + a[e[r + 14]] + a[e[r + 15]];
|
23
|
+
}
|
24
|
+
const Q = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), R = {
|
25
|
+
randomUUID: Q
|
26
|
+
};
|
27
|
+
function W(e, r, t) {
|
28
|
+
if (R.randomUUID && !r && !e)
|
29
|
+
return R.randomUUID();
|
30
|
+
e = e || {};
|
31
|
+
const n = e.random || (e.rng || G)();
|
32
|
+
if (n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, r) {
|
33
|
+
t = t || 0;
|
34
|
+
for (let i = 0; i < 16; ++i)
|
35
|
+
r[t + i] = n[i];
|
36
|
+
return r;
|
37
|
+
}
|
38
|
+
return J(n);
|
39
|
+
}
|
40
|
+
var O = function(e, r) {
|
41
|
+
return O = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
|
42
|
+
t.__proto__ = n;
|
43
|
+
} || function(t, n) {
|
44
|
+
for (var i in n)
|
45
|
+
Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
|
46
|
+
}, O(e, r);
|
47
|
+
};
|
48
|
+
function d(e, r) {
|
49
|
+
if (typeof r != "function" && r !== null)
|
50
|
+
throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
|
51
|
+
O(e, r);
|
52
|
+
function t() {
|
53
|
+
this.constructor = e;
|
54
|
+
}
|
55
|
+
e.prototype = r === null ? Object.create(r) : (t.prototype = r.prototype, new t());
|
56
|
+
}
|
57
|
+
function j(e) {
|
58
|
+
var r = typeof Symbol == "function" && Symbol.iterator, t = r && e[r], n = 0;
|
59
|
+
if (t)
|
60
|
+
return t.call(e);
|
61
|
+
if (e && typeof e.length == "number")
|
62
|
+
return {
|
63
|
+
next: function() {
|
64
|
+
return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e };
|
65
|
+
}
|
66
|
+
};
|
67
|
+
throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
68
|
+
}
|
69
|
+
function w(e, r) {
|
70
|
+
var t = typeof Symbol == "function" && e[Symbol.iterator];
|
71
|
+
if (!t)
|
72
|
+
return e;
|
73
|
+
var n = t.call(e), i, o = [], s;
|
74
|
+
try {
|
75
|
+
for (; (r === void 0 || r-- > 0) && !(i = n.next()).done; )
|
76
|
+
o.push(i.value);
|
77
|
+
} catch (u) {
|
78
|
+
s = { error: u };
|
79
|
+
} finally {
|
80
|
+
try {
|
81
|
+
i && !i.done && (t = n.return) && t.call(n);
|
82
|
+
} finally {
|
83
|
+
if (s)
|
84
|
+
throw s.error;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
return o;
|
88
|
+
}
|
89
|
+
function _(e, r, t) {
|
90
|
+
if (t || arguments.length === 2)
|
91
|
+
for (var n = 0, i = r.length, o; n < i; n++)
|
92
|
+
(o || !(n in r)) && (o || (o = Array.prototype.slice.call(r, 0, n)), o[n] = r[n]);
|
93
|
+
return e.concat(o || Array.prototype.slice.call(r));
|
94
|
+
}
|
95
|
+
function p(e) {
|
96
|
+
return typeof e == "function";
|
97
|
+
}
|
98
|
+
function Y(e) {
|
99
|
+
var r = function(n) {
|
100
|
+
Error.call(n), n.stack = new Error().stack;
|
101
|
+
}, t = e(r);
|
102
|
+
return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
|
103
|
+
}
|
104
|
+
var x = Y(function(e) {
|
105
|
+
return function(t) {
|
106
|
+
e(this), this.message = t ? t.length + ` errors occurred during unsubscription:
|
107
|
+
` + t.map(function(n, i) {
|
108
|
+
return i + 1 + ") " + n.toString();
|
109
|
+
}).join(`
|
110
|
+
`) : "", this.name = "UnsubscriptionError", this.errors = t;
|
111
|
+
};
|
112
|
+
});
|
113
|
+
function A(e, r) {
|
114
|
+
if (e) {
|
115
|
+
var t = e.indexOf(r);
|
116
|
+
0 <= t && e.splice(t, 1);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
var E = function() {
|
120
|
+
function e(r) {
|
121
|
+
this.initialTeardown = r, this.closed = !1, this._parentage = null, this._finalizers = null;
|
122
|
+
}
|
123
|
+
return e.prototype.unsubscribe = function() {
|
124
|
+
var r, t, n, i, o;
|
125
|
+
if (!this.closed) {
|
126
|
+
this.closed = !0;
|
127
|
+
var s = this._parentage;
|
128
|
+
if (s)
|
129
|
+
if (this._parentage = null, Array.isArray(s))
|
130
|
+
try {
|
131
|
+
for (var u = j(s), c = u.next(); !c.done; c = u.next()) {
|
132
|
+
var h = c.value;
|
133
|
+
h.remove(this);
|
134
|
+
}
|
135
|
+
} catch (l) {
|
136
|
+
r = { error: l };
|
137
|
+
} finally {
|
138
|
+
try {
|
139
|
+
c && !c.done && (t = u.return) && t.call(u);
|
140
|
+
} finally {
|
141
|
+
if (r)
|
142
|
+
throw r.error;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
else
|
146
|
+
s.remove(this);
|
147
|
+
var f = this.initialTeardown;
|
148
|
+
if (p(f))
|
149
|
+
try {
|
150
|
+
f();
|
151
|
+
} catch (l) {
|
152
|
+
o = l instanceof x ? l.errors : [l];
|
153
|
+
}
|
154
|
+
var F = this._finalizers;
|
155
|
+
if (F) {
|
156
|
+
this._finalizers = null;
|
157
|
+
try {
|
158
|
+
for (var y = j(F), b = y.next(); !b.done; b = y.next()) {
|
159
|
+
var K = b.value;
|
160
|
+
try {
|
161
|
+
B(K);
|
162
|
+
} catch (l) {
|
163
|
+
o = o ?? [], l instanceof x ? o = _(_([], w(o)), w(l.errors)) : o.push(l);
|
164
|
+
}
|
165
|
+
}
|
166
|
+
} catch (l) {
|
167
|
+
n = { error: l };
|
168
|
+
} finally {
|
169
|
+
try {
|
170
|
+
b && !b.done && (i = y.return) && i.call(y);
|
171
|
+
} finally {
|
172
|
+
if (n)
|
173
|
+
throw n.error;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}
|
177
|
+
if (o)
|
178
|
+
throw new x(o);
|
179
|
+
}
|
180
|
+
}, e.prototype.add = function(r) {
|
181
|
+
var t;
|
182
|
+
if (r && r !== this)
|
183
|
+
if (this.closed)
|
184
|
+
B(r);
|
185
|
+
else {
|
186
|
+
if (r instanceof e) {
|
187
|
+
if (r.closed || r._hasParent(this))
|
188
|
+
return;
|
189
|
+
r._addParent(this);
|
190
|
+
}
|
191
|
+
(this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(r);
|
192
|
+
}
|
193
|
+
}, e.prototype._hasParent = function(r) {
|
194
|
+
var t = this._parentage;
|
195
|
+
return t === r || Array.isArray(t) && t.includes(r);
|
196
|
+
}, e.prototype._addParent = function(r) {
|
197
|
+
var t = this._parentage;
|
198
|
+
this._parentage = Array.isArray(t) ? (t.push(r), t) : t ? [t, r] : r;
|
199
|
+
}, e.prototype._removeParent = function(r) {
|
200
|
+
var t = this._parentage;
|
201
|
+
t === r ? this._parentage = null : Array.isArray(t) && A(t, r);
|
202
|
+
}, e.prototype.remove = function(r) {
|
203
|
+
var t = this._finalizers;
|
204
|
+
t && A(t, r), r instanceof e && r._removeParent(this);
|
205
|
+
}, e.EMPTY = function() {
|
206
|
+
var r = new e();
|
207
|
+
return r.closed = !0, r;
|
208
|
+
}(), e;
|
209
|
+
}(), H = E.EMPTY;
|
210
|
+
function z(e) {
|
211
|
+
return e instanceof E || e && "closed" in e && p(e.remove) && p(e.add) && p(e.unsubscribe);
|
212
|
+
}
|
213
|
+
function B(e) {
|
214
|
+
p(e) ? e() : e.unsubscribe();
|
215
|
+
}
|
216
|
+
var L = {
|
217
|
+
onUnhandledError: null,
|
218
|
+
onStoppedNotification: null,
|
219
|
+
Promise: void 0,
|
220
|
+
useDeprecatedSynchronousErrorHandling: !1,
|
221
|
+
useDeprecatedNextContext: !1
|
222
|
+
}, C = {
|
223
|
+
setTimeout: function(e, r) {
|
224
|
+
for (var t = [], n = 2; n < arguments.length; n++)
|
225
|
+
t[n - 2] = arguments[n];
|
226
|
+
var i = C.delegate;
|
227
|
+
return i != null && i.setTimeout ? i.setTimeout.apply(i, _([e, r], w(t))) : setTimeout.apply(void 0, _([e, r], w(t)));
|
228
|
+
},
|
229
|
+
clearTimeout: function(e) {
|
230
|
+
var r = C.delegate;
|
231
|
+
return ((r == null ? void 0 : r.clearTimeout) || clearTimeout)(e);
|
232
|
+
},
|
233
|
+
delegate: void 0
|
234
|
+
};
|
235
|
+
function X(e) {
|
236
|
+
C.setTimeout(function() {
|
237
|
+
throw e;
|
238
|
+
});
|
239
|
+
}
|
240
|
+
function V() {
|
241
|
+
}
|
242
|
+
function g(e) {
|
243
|
+
e();
|
244
|
+
}
|
245
|
+
var $ = function(e) {
|
246
|
+
d(r, e);
|
247
|
+
function r(t) {
|
248
|
+
var n = e.call(this) || this;
|
249
|
+
return n.isStopped = !1, t ? (n.destination = t, z(t) && t.add(n)) : n.destination = rt, n;
|
250
|
+
}
|
251
|
+
return r.create = function(t, n, i) {
|
252
|
+
return new T(t, n, i);
|
253
|
+
}, r.prototype.next = function(t) {
|
254
|
+
this.isStopped || this._next(t);
|
255
|
+
}, r.prototype.error = function(t) {
|
256
|
+
this.isStopped || (this.isStopped = !0, this._error(t));
|
257
|
+
}, r.prototype.complete = function() {
|
258
|
+
this.isStopped || (this.isStopped = !0, this._complete());
|
259
|
+
}, r.prototype.unsubscribe = function() {
|
260
|
+
this.closed || (this.isStopped = !0, e.prototype.unsubscribe.call(this), this.destination = null);
|
261
|
+
}, r.prototype._next = function(t) {
|
262
|
+
this.destination.next(t);
|
263
|
+
}, r.prototype._error = function(t) {
|
264
|
+
try {
|
265
|
+
this.destination.error(t);
|
266
|
+
} finally {
|
267
|
+
this.unsubscribe();
|
268
|
+
}
|
269
|
+
}, r.prototype._complete = function() {
|
270
|
+
try {
|
271
|
+
this.destination.complete();
|
272
|
+
} finally {
|
273
|
+
this.unsubscribe();
|
274
|
+
}
|
275
|
+
}, r;
|
276
|
+
}(E), Z = Function.prototype.bind;
|
277
|
+
function U(e, r) {
|
278
|
+
return Z.call(e, r);
|
279
|
+
}
|
280
|
+
var N = function() {
|
281
|
+
function e(r) {
|
282
|
+
this.partialObserver = r;
|
283
|
+
}
|
284
|
+
return e.prototype.next = function(r) {
|
285
|
+
var t = this.partialObserver;
|
286
|
+
if (t.next)
|
287
|
+
try {
|
288
|
+
t.next(r);
|
289
|
+
} catch (n) {
|
290
|
+
S(n);
|
291
|
+
}
|
292
|
+
}, e.prototype.error = function(r) {
|
293
|
+
var t = this.partialObserver;
|
294
|
+
if (t.error)
|
295
|
+
try {
|
296
|
+
t.error(r);
|
297
|
+
} catch (n) {
|
298
|
+
S(n);
|
299
|
+
}
|
300
|
+
else
|
301
|
+
S(r);
|
302
|
+
}, e.prototype.complete = function() {
|
303
|
+
var r = this.partialObserver;
|
304
|
+
if (r.complete)
|
305
|
+
try {
|
306
|
+
r.complete();
|
307
|
+
} catch (t) {
|
308
|
+
S(t);
|
309
|
+
}
|
310
|
+
}, e;
|
311
|
+
}(), T = function(e) {
|
312
|
+
d(r, e);
|
313
|
+
function r(t, n, i) {
|
314
|
+
var o = e.call(this) || this, s;
|
315
|
+
if (p(t) || !t)
|
316
|
+
s = {
|
317
|
+
next: t ?? void 0,
|
318
|
+
error: n ?? void 0,
|
319
|
+
complete: i ?? void 0
|
320
|
+
};
|
321
|
+
else {
|
322
|
+
var u;
|
323
|
+
o && L.useDeprecatedNextContext ? (u = Object.create(t), u.unsubscribe = function() {
|
324
|
+
return o.unsubscribe();
|
325
|
+
}, s = {
|
326
|
+
next: t.next && U(t.next, u),
|
327
|
+
error: t.error && U(t.error, u),
|
328
|
+
complete: t.complete && U(t.complete, u)
|
329
|
+
}) : s = t;
|
330
|
+
}
|
331
|
+
return o.destination = new N(s), o;
|
332
|
+
}
|
333
|
+
return r;
|
334
|
+
}($);
|
335
|
+
function S(e) {
|
336
|
+
X(e);
|
337
|
+
}
|
338
|
+
function tt(e) {
|
339
|
+
throw e;
|
340
|
+
}
|
341
|
+
var rt = {
|
342
|
+
closed: !0,
|
343
|
+
next: V,
|
344
|
+
error: tt,
|
345
|
+
complete: V
|
346
|
+
}, et = function() {
|
347
|
+
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
348
|
+
}();
|
349
|
+
function nt(e) {
|
350
|
+
return e;
|
351
|
+
}
|
352
|
+
function it(e) {
|
353
|
+
return e.length === 0 ? nt : e.length === 1 ? e[0] : function(t) {
|
354
|
+
return e.reduce(function(n, i) {
|
355
|
+
return i(n);
|
356
|
+
}, t);
|
357
|
+
};
|
358
|
+
}
|
359
|
+
var I = function() {
|
360
|
+
function e(r) {
|
361
|
+
r && (this._subscribe = r);
|
362
|
+
}
|
363
|
+
return e.prototype.lift = function(r) {
|
364
|
+
var t = new e();
|
365
|
+
return t.source = this, t.operator = r, t;
|
366
|
+
}, e.prototype.subscribe = function(r, t, n) {
|
367
|
+
var i = this, o = st(r) ? r : new T(r, t, n);
|
368
|
+
return g(function() {
|
369
|
+
var s = i, u = s.operator, c = s.source;
|
370
|
+
o.add(u ? u.call(o, c) : c ? i._subscribe(o) : i._trySubscribe(o));
|
371
|
+
}), o;
|
372
|
+
}, e.prototype._trySubscribe = function(r) {
|
373
|
+
try {
|
374
|
+
return this._subscribe(r);
|
375
|
+
} catch (t) {
|
376
|
+
r.error(t);
|
377
|
+
}
|
378
|
+
}, e.prototype.forEach = function(r, t) {
|
379
|
+
var n = this;
|
380
|
+
return t = k(t), new t(function(i, o) {
|
381
|
+
var s = new T({
|
382
|
+
next: function(u) {
|
383
|
+
try {
|
384
|
+
r(u);
|
385
|
+
} catch (c) {
|
386
|
+
o(c), s.unsubscribe();
|
387
|
+
}
|
388
|
+
},
|
389
|
+
error: o,
|
390
|
+
complete: i
|
391
|
+
});
|
392
|
+
n.subscribe(s);
|
393
|
+
});
|
394
|
+
}, e.prototype._subscribe = function(r) {
|
395
|
+
var t;
|
396
|
+
return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(r);
|
397
|
+
}, e.prototype[et] = function() {
|
398
|
+
return this;
|
399
|
+
}, e.prototype.pipe = function() {
|
400
|
+
for (var r = [], t = 0; t < arguments.length; t++)
|
401
|
+
r[t] = arguments[t];
|
402
|
+
return it(r)(this);
|
403
|
+
}, e.prototype.toPromise = function(r) {
|
404
|
+
var t = this;
|
405
|
+
return r = k(r), new r(function(n, i) {
|
406
|
+
var o;
|
407
|
+
t.subscribe(function(s) {
|
408
|
+
return o = s;
|
409
|
+
}, function(s) {
|
410
|
+
return i(s);
|
411
|
+
}, function() {
|
412
|
+
return n(o);
|
413
|
+
});
|
414
|
+
});
|
415
|
+
}, e.create = function(r) {
|
416
|
+
return new e(r);
|
417
|
+
}, e;
|
418
|
+
}();
|
419
|
+
function k(e) {
|
420
|
+
var r;
|
421
|
+
return (r = e ?? L.Promise) !== null && r !== void 0 ? r : Promise;
|
422
|
+
}
|
423
|
+
function ot(e) {
|
424
|
+
return e && p(e.next) && p(e.error) && p(e.complete);
|
425
|
+
}
|
426
|
+
function st(e) {
|
427
|
+
return e && e instanceof $ || ot(e) && z(e);
|
428
|
+
}
|
429
|
+
function ut(e) {
|
430
|
+
return p(e == null ? void 0 : e.lift);
|
431
|
+
}
|
432
|
+
function ct(e) {
|
433
|
+
return function(r) {
|
434
|
+
if (ut(r))
|
435
|
+
return r.lift(function(t) {
|
436
|
+
try {
|
437
|
+
return e(t, this);
|
438
|
+
} catch (n) {
|
439
|
+
this.error(n);
|
440
|
+
}
|
441
|
+
});
|
442
|
+
throw new TypeError("Unable to lift unknown Observable type");
|
443
|
+
};
|
444
|
+
}
|
445
|
+
function at(e, r, t, n, i) {
|
446
|
+
return new lt(e, r, t, n, i);
|
447
|
+
}
|
448
|
+
var lt = function(e) {
|
449
|
+
d(r, e);
|
450
|
+
function r(t, n, i, o, s, u) {
|
451
|
+
var c = e.call(this, t) || this;
|
452
|
+
return c.onFinalize = s, c.shouldUnsubscribe = u, c._next = n ? function(h) {
|
453
|
+
try {
|
454
|
+
n(h);
|
455
|
+
} catch (f) {
|
456
|
+
t.error(f);
|
457
|
+
}
|
458
|
+
} : e.prototype._next, c._error = o ? function(h) {
|
459
|
+
try {
|
460
|
+
o(h);
|
461
|
+
} catch (f) {
|
462
|
+
t.error(f);
|
463
|
+
} finally {
|
464
|
+
this.unsubscribe();
|
465
|
+
}
|
466
|
+
} : e.prototype._error, c._complete = i ? function() {
|
467
|
+
try {
|
468
|
+
i();
|
469
|
+
} catch (h) {
|
470
|
+
t.error(h);
|
471
|
+
} finally {
|
472
|
+
this.unsubscribe();
|
473
|
+
}
|
474
|
+
} : e.prototype._complete, c;
|
475
|
+
}
|
476
|
+
return r.prototype.unsubscribe = function() {
|
477
|
+
var t;
|
478
|
+
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
479
|
+
var n = this.closed;
|
480
|
+
e.prototype.unsubscribe.call(this), !n && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
|
481
|
+
}
|
482
|
+
}, r;
|
483
|
+
}($), pt = Y(function(e) {
|
484
|
+
return function() {
|
485
|
+
e(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
486
|
+
};
|
487
|
+
}), v = function(e) {
|
488
|
+
d(r, e);
|
489
|
+
function r() {
|
490
|
+
var t = e.call(this) || this;
|
491
|
+
return t.closed = !1, t.currentObservers = null, t.observers = [], t.isStopped = !1, t.hasError = !1, t.thrownError = null, t;
|
492
|
+
}
|
493
|
+
return r.prototype.lift = function(t) {
|
494
|
+
var n = new M(this, this);
|
495
|
+
return n.operator = t, n;
|
496
|
+
}, r.prototype._throwIfClosed = function() {
|
497
|
+
if (this.closed)
|
498
|
+
throw new pt();
|
499
|
+
}, r.prototype.next = function(t) {
|
500
|
+
var n = this;
|
501
|
+
g(function() {
|
502
|
+
var i, o;
|
503
|
+
if (n._throwIfClosed(), !n.isStopped) {
|
504
|
+
n.currentObservers || (n.currentObservers = Array.from(n.observers));
|
505
|
+
try {
|
506
|
+
for (var s = j(n.currentObservers), u = s.next(); !u.done; u = s.next()) {
|
507
|
+
var c = u.value;
|
508
|
+
c.next(t);
|
509
|
+
}
|
510
|
+
} catch (h) {
|
511
|
+
i = { error: h };
|
512
|
+
} finally {
|
513
|
+
try {
|
514
|
+
u && !u.done && (o = s.return) && o.call(s);
|
515
|
+
} finally {
|
516
|
+
if (i)
|
517
|
+
throw i.error;
|
518
|
+
}
|
519
|
+
}
|
520
|
+
}
|
521
|
+
});
|
522
|
+
}, r.prototype.error = function(t) {
|
523
|
+
var n = this;
|
524
|
+
g(function() {
|
525
|
+
if (n._throwIfClosed(), !n.isStopped) {
|
526
|
+
n.hasError = n.isStopped = !0, n.thrownError = t;
|
527
|
+
for (var i = n.observers; i.length; )
|
528
|
+
i.shift().error(t);
|
529
|
+
}
|
530
|
+
});
|
531
|
+
}, r.prototype.complete = function() {
|
532
|
+
var t = this;
|
533
|
+
g(function() {
|
534
|
+
if (t._throwIfClosed(), !t.isStopped) {
|
535
|
+
t.isStopped = !0;
|
536
|
+
for (var n = t.observers; n.length; )
|
537
|
+
n.shift().complete();
|
538
|
+
}
|
539
|
+
});
|
540
|
+
}, r.prototype.unsubscribe = function() {
|
541
|
+
this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
|
542
|
+
}, Object.defineProperty(r.prototype, "observed", {
|
543
|
+
get: function() {
|
544
|
+
var t;
|
545
|
+
return ((t = this.observers) === null || t === void 0 ? void 0 : t.length) > 0;
|
546
|
+
},
|
547
|
+
enumerable: !1,
|
548
|
+
configurable: !0
|
549
|
+
}), r.prototype._trySubscribe = function(t) {
|
550
|
+
return this._throwIfClosed(), e.prototype._trySubscribe.call(this, t);
|
551
|
+
}, r.prototype._subscribe = function(t) {
|
552
|
+
return this._throwIfClosed(), this._checkFinalizedStatuses(t), this._innerSubscribe(t);
|
553
|
+
}, r.prototype._innerSubscribe = function(t) {
|
554
|
+
var n = this, i = this, o = i.hasError, s = i.isStopped, u = i.observers;
|
555
|
+
return o || s ? H : (this.currentObservers = null, u.push(t), new E(function() {
|
556
|
+
n.currentObservers = null, A(u, t);
|
557
|
+
}));
|
558
|
+
}, r.prototype._checkFinalizedStatuses = function(t) {
|
559
|
+
var n = this, i = n.hasError, o = n.thrownError, s = n.isStopped;
|
560
|
+
i ? t.error(o) : s && t.complete();
|
561
|
+
}, r.prototype.asObservable = function() {
|
562
|
+
var t = new I();
|
563
|
+
return t.source = this, t;
|
564
|
+
}, r.create = function(t, n) {
|
565
|
+
return new M(t, n);
|
566
|
+
}, r;
|
567
|
+
}(I), M = function(e) {
|
568
|
+
d(r, e);
|
569
|
+
function r(t, n) {
|
570
|
+
var i = e.call(this) || this;
|
571
|
+
return i.destination = t, i.source = n, i;
|
572
|
+
}
|
573
|
+
return r.prototype.next = function(t) {
|
574
|
+
var n, i;
|
575
|
+
(i = (n = this.destination) === null || n === void 0 ? void 0 : n.next) === null || i === void 0 || i.call(n, t);
|
576
|
+
}, r.prototype.error = function(t) {
|
577
|
+
var n, i;
|
578
|
+
(i = (n = this.destination) === null || n === void 0 ? void 0 : n.error) === null || i === void 0 || i.call(n, t);
|
579
|
+
}, r.prototype.complete = function() {
|
580
|
+
var t, n;
|
581
|
+
(n = (t = this.destination) === null || t === void 0 ? void 0 : t.complete) === null || n === void 0 || n.call(t);
|
582
|
+
}, r.prototype._subscribe = function(t) {
|
583
|
+
var n, i;
|
584
|
+
return (i = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t)) !== null && i !== void 0 ? i : H;
|
585
|
+
}, r;
|
586
|
+
}(v), ht = function(e) {
|
587
|
+
d(r, e);
|
588
|
+
function r(t) {
|
589
|
+
var n = e.call(this) || this;
|
590
|
+
return n._value = t, n;
|
591
|
+
}
|
592
|
+
return Object.defineProperty(r.prototype, "value", {
|
593
|
+
get: function() {
|
594
|
+
return this.getValue();
|
595
|
+
},
|
596
|
+
enumerable: !1,
|
597
|
+
configurable: !0
|
598
|
+
}), r.prototype._subscribe = function(t) {
|
599
|
+
var n = e.prototype._subscribe.call(this, t);
|
600
|
+
return !n.closed && t.next(this._value), n;
|
601
|
+
}, r.prototype.getValue = function() {
|
602
|
+
var t = this, n = t.hasError, i = t.thrownError, o = t._value;
|
603
|
+
if (n)
|
604
|
+
throw i;
|
605
|
+
return this._throwIfClosed(), o;
|
606
|
+
}, r.prototype.next = function(t) {
|
607
|
+
e.prototype.next.call(this, this._value = t);
|
608
|
+
}, r;
|
609
|
+
}(v), ft = new I(function(e) {
|
610
|
+
return e.complete();
|
611
|
+
});
|
612
|
+
function dt(e) {
|
613
|
+
return e <= 0 ? function() {
|
614
|
+
return ft;
|
615
|
+
} : ct(function(r, t) {
|
616
|
+
var n = 0;
|
617
|
+
r.subscribe(at(t, function(i) {
|
618
|
+
++n <= e && (t.next(i), e <= n && t.complete());
|
619
|
+
}));
|
620
|
+
});
|
621
|
+
}
|
622
|
+
class vt {
|
623
|
+
constructor(r, t) {
|
624
|
+
this.id = r, this.entries$ = new ht([]), t.addEventListener("user-submit", (n) => {
|
625
|
+
if (!this.provider) {
|
626
|
+
console.warn(
|
627
|
+
"No provider activated, unable to print message to conversation."
|
628
|
+
);
|
629
|
+
return;
|
630
|
+
}
|
631
|
+
this.provider.onUserSubmit(n.detail);
|
632
|
+
});
|
633
|
+
}
|
634
|
+
write(r) {
|
635
|
+
this.entries$.pipe(dt(1)).subscribe((t) => {
|
636
|
+
this.entries$.next([...t, r]);
|
637
|
+
});
|
638
|
+
}
|
639
|
+
entries() {
|
640
|
+
return this.entries$.asObservable();
|
641
|
+
}
|
642
|
+
setProvider(r) {
|
643
|
+
this.provider = r, this.provider.actions().subscribe((t) => {
|
644
|
+
this.write(t);
|
645
|
+
});
|
646
|
+
}
|
647
|
+
}
|
648
|
+
class bt {
|
649
|
+
constructor() {
|
650
|
+
this.sessions = /* @__PURE__ */ new Map(), this.registeredProviders = /* @__PURE__ */ new Map();
|
651
|
+
}
|
652
|
+
registerProvider(r, t) {
|
653
|
+
this.registeredProviders.set(r, t);
|
654
|
+
}
|
655
|
+
createSession(r) {
|
656
|
+
const t = new vt(W(), r), n = this.getProviderByConfiguration(r);
|
657
|
+
if (n) {
|
658
|
+
const i = n();
|
659
|
+
t.setProvider(i);
|
660
|
+
}
|
661
|
+
return this.sessions.set(t.id, t), t;
|
662
|
+
}
|
663
|
+
getProviderByConfiguration(r) {
|
664
|
+
const [t] = r.properties.providers || [];
|
665
|
+
if (!t) {
|
666
|
+
console.warn(
|
667
|
+
"No providers registered. You most likely forgot to add a provider to the conversation component properties."
|
668
|
+
);
|
669
|
+
return;
|
670
|
+
}
|
671
|
+
return this.registeredProviders.get(t);
|
672
|
+
}
|
673
|
+
}
|
674
|
+
const yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
675
|
+
__proto__: null,
|
676
|
+
ConversationPlatform: bt
|
677
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
678
|
+
var P = /* @__PURE__ */ ((e) => (e.User = "user", e.Agent = "agent", e.System = "system", e))(P || {});
|
679
|
+
class D {
|
680
|
+
constructor(r, t, n) {
|
681
|
+
this.type = r, this.sender = t, this.messages = n, this.didUpdate = new v(), this.timestamp = Date.now();
|
682
|
+
}
|
683
|
+
update(r) {
|
684
|
+
this.messages = [
|
685
|
+
{
|
686
|
+
items: r
|
687
|
+
}
|
688
|
+
], this.didUpdate.next(this);
|
689
|
+
}
|
690
|
+
}
|
691
|
+
class mt {
|
692
|
+
constructor(r) {
|
693
|
+
this.name = r, this.print$ = new v();
|
694
|
+
}
|
695
|
+
print(r) {
|
696
|
+
const t = new D(
|
697
|
+
P.Agent,
|
698
|
+
{ name: this.name },
|
699
|
+
[
|
700
|
+
{
|
701
|
+
items: [["html", { content: r }]]
|
702
|
+
}
|
703
|
+
]
|
704
|
+
);
|
705
|
+
return this.print$.next(t), t;
|
706
|
+
}
|
707
|
+
subscribe() {
|
708
|
+
return this.print$.asObservable();
|
709
|
+
}
|
710
|
+
}
|
711
|
+
class St {
|
712
|
+
constructor(r) {
|
713
|
+
this.name = r, this.print$ = new v();
|
714
|
+
}
|
715
|
+
print(r) {
|
716
|
+
const t = new D(
|
717
|
+
P.User,
|
718
|
+
{ name: this.name },
|
719
|
+
[
|
720
|
+
{
|
721
|
+
items: [["html", { content: r }]]
|
722
|
+
}
|
723
|
+
]
|
724
|
+
);
|
725
|
+
return this.print$.next(t), t;
|
726
|
+
}
|
727
|
+
subscribe() {
|
728
|
+
return this.print$.asObservable();
|
729
|
+
}
|
730
|
+
}
|
731
|
+
class wt {
|
732
|
+
constructor(r) {
|
733
|
+
this.name = r, this.print$ = new v();
|
734
|
+
}
|
735
|
+
onUserSubmit(r) {
|
736
|
+
this.print(P.User, r.text);
|
737
|
+
}
|
738
|
+
print(r, t) {
|
739
|
+
const n = new D(
|
740
|
+
r,
|
741
|
+
{
|
742
|
+
name: "Botsson"
|
743
|
+
// TODO:
|
744
|
+
},
|
745
|
+
[
|
746
|
+
{
|
747
|
+
items: [["html", { content: t }]]
|
748
|
+
}
|
749
|
+
]
|
750
|
+
);
|
751
|
+
return this.printEntry(n);
|
752
|
+
}
|
753
|
+
printEntry(r) {
|
754
|
+
return this.print$.next(r), r;
|
755
|
+
}
|
756
|
+
createAgent(r) {
|
757
|
+
const t = new mt(r);
|
758
|
+
return t.subscribe().subscribe((n) => {
|
759
|
+
this.printEntry(n);
|
760
|
+
}), t;
|
761
|
+
}
|
762
|
+
createUser(r) {
|
763
|
+
const t = new St(r);
|
764
|
+
return t.subscribe().subscribe((n) => {
|
765
|
+
this.printEntry(n);
|
766
|
+
}), t;
|
767
|
+
}
|
768
|
+
actions() {
|
769
|
+
return this.print$.asObservable();
|
770
|
+
}
|
771
|
+
}
|
772
|
+
export {
|
773
|
+
mt as A,
|
774
|
+
P as C,
|
775
|
+
St as U,
|
776
|
+
gt as a,
|
777
|
+
bt as b,
|
778
|
+
wt as c,
|
779
|
+
D as d
|
780
|
+
};
|