@telia-ace/widget-conversation-flamingo 1.1.33 → 1.1.34-rc.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,1245 +0,0 @@
1
- let _;
2
- const vt = new Uint8Array(16);
3
- function yt() {
4
- if (!_ && (_ = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !_))
5
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
6
- return _(vt);
7
- }
8
- const d = [];
9
- for (let e = 0; e < 256; ++e)
10
- d.push((e + 256).toString(16).slice(1));
11
- function bt(e, r = 0) {
12
- return d[e[r + 0]] + d[e[r + 1]] + d[e[r + 2]] + d[e[r + 3]] + "-" + d[e[r + 4]] + d[e[r + 5]] + "-" + d[e[r + 6]] + d[e[r + 7]] + "-" + d[e[r + 8]] + d[e[r + 9]] + "-" + d[e[r + 10]] + d[e[r + 11]] + d[e[r + 12]] + d[e[r + 13]] + d[e[r + 14]] + d[e[r + 15]];
13
- }
14
- const mt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), H = {
15
- randomUUID: mt
16
- };
17
- function wt(e, r, t) {
18
- if (H.randomUUID && !r && !e)
19
- return H.randomUUID();
20
- e = e || {};
21
- const n = e.random || (e.rng || yt)();
22
- if (n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, r) {
23
- t = t || 0;
24
- for (let i = 0; i < 16; ++i)
25
- r[t + i] = n[i];
26
- return r;
27
- }
28
- return bt(n);
29
- }
30
- var R = function(e, r) {
31
- return R = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
32
- t.__proto__ = n;
33
- } || function(t, n) {
34
- for (var i in n)
35
- Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
36
- }, R(e, r);
37
- };
38
- function x(e, r) {
39
- if (typeof r != "function" && r !== null)
40
- throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
41
- R(e, r);
42
- function t() {
43
- this.constructor = e;
44
- }
45
- e.prototype = r === null ? Object.create(r) : (t.prototype = r.prototype, new t());
46
- }
47
- function St(e, r, t, n) {
48
- function i(o) {
49
- return o instanceof t ? o : new t(function(s) {
50
- s(o);
51
- });
52
- }
53
- return new (t || (t = Promise))(function(o, s) {
54
- function u(f) {
55
- try {
56
- c(n.next(f));
57
- } catch (b) {
58
- s(b);
59
- }
60
- }
61
- function a(f) {
62
- try {
63
- c(n.throw(f));
64
- } catch (b) {
65
- s(b);
66
- }
67
- }
68
- function c(f) {
69
- f.done ? o(f.value) : i(f.value).then(u, a);
70
- }
71
- c((n = n.apply(e, r || [])).next());
72
- });
73
- }
74
- function Q(e, r) {
75
- var t = { label: 0, sent: function() {
76
- if (o[0] & 1)
77
- throw o[1];
78
- return o[1];
79
- }, trys: [], ops: [] }, n, i, o, s;
80
- return s = { next: u(0), throw: u(1), return: u(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
81
- return this;
82
- }), s;
83
- function u(c) {
84
- return function(f) {
85
- return a([c, f]);
86
- };
87
- }
88
- function a(c) {
89
- if (n)
90
- throw new TypeError("Generator is already executing.");
91
- for (; s && (s = 0, c[0] && (t = 0)), t; )
92
- try {
93
- if (n = 1, i && (o = c[0] & 2 ? i.return : c[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, c[1])).done)
94
- return o;
95
- switch (i = 0, o && (c = [c[0] & 2, o.value]), c[0]) {
96
- case 0:
97
- case 1:
98
- o = c;
99
- break;
100
- case 4:
101
- return t.label++, { value: c[1], done: !1 };
102
- case 5:
103
- t.label++, i = c[1], c = [0];
104
- continue;
105
- case 7:
106
- c = t.ops.pop(), t.trys.pop();
107
- continue;
108
- default:
109
- if (o = t.trys, !(o = o.length > 0 && o[o.length - 1]) && (c[0] === 6 || c[0] === 2)) {
110
- t = 0;
111
- continue;
112
- }
113
- if (c[0] === 3 && (!o || c[1] > o[0] && c[1] < o[3])) {
114
- t.label = c[1];
115
- break;
116
- }
117
- if (c[0] === 6 && t.label < o[1]) {
118
- t.label = o[1], o = c;
119
- break;
120
- }
121
- if (o && t.label < o[2]) {
122
- t.label = o[2], t.ops.push(c);
123
- break;
124
- }
125
- o[2] && t.ops.pop(), t.trys.pop();
126
- continue;
127
- }
128
- c = r.call(e, t);
129
- } catch (f) {
130
- c = [6, f], i = 0;
131
- } finally {
132
- n = o = 0;
133
- }
134
- if (c[0] & 5)
135
- throw c[1];
136
- return { value: c[0] ? c[1] : void 0, done: !0 };
137
- }
138
- }
139
- function g(e) {
140
- var r = typeof Symbol == "function" && Symbol.iterator, t = r && e[r], n = 0;
141
- if (t)
142
- return t.call(e);
143
- if (e && typeof e.length == "number")
144
- return {
145
- next: function() {
146
- return e && n >= e.length && (e = void 0), { value: e && e[n++], done: !e };
147
- }
148
- };
149
- throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
150
- }
151
- function O(e, r) {
152
- var t = typeof Symbol == "function" && e[Symbol.iterator];
153
- if (!t)
154
- return e;
155
- var n = t.call(e), i, o = [], s;
156
- try {
157
- for (; (r === void 0 || r-- > 0) && !(i = n.next()).done; )
158
- o.push(i.value);
159
- } catch (u) {
160
- s = { error: u };
161
- } finally {
162
- try {
163
- i && !i.done && (t = n.return) && t.call(n);
164
- } finally {
165
- if (s)
166
- throw s.error;
167
- }
168
- }
169
- return o;
170
- }
171
- function U(e, r, t) {
172
- if (t || arguments.length === 2)
173
- for (var n = 0, i = r.length, o; n < i; n++)
174
- (o || !(n in r)) && (o || (o = Array.prototype.slice.call(r, 0, n)), o[n] = r[n]);
175
- return e.concat(o || Array.prototype.slice.call(r));
176
- }
177
- function S(e) {
178
- return this instanceof S ? (this.v = e, this) : new S(e);
179
- }
180
- function gt(e, r, t) {
181
- if (!Symbol.asyncIterator)
182
- throw new TypeError("Symbol.asyncIterator is not defined.");
183
- var n = t.apply(e, r || []), i, o = [];
184
- return i = {}, s("next"), s("throw"), s("return"), i[Symbol.asyncIterator] = function() {
185
- return this;
186
- }, i;
187
- function s(l) {
188
- n[l] && (i[l] = function(v) {
189
- return new Promise(function(E, p) {
190
- o.push([l, v, E, p]) > 1 || u(l, v);
191
- });
192
- });
193
- }
194
- function u(l, v) {
195
- try {
196
- a(n[l](v));
197
- } catch (E) {
198
- b(o[0][3], E);
199
- }
200
- }
201
- function a(l) {
202
- l.value instanceof S ? Promise.resolve(l.value.v).then(c, f) : b(o[0][2], l);
203
- }
204
- function c(l) {
205
- u("next", l);
206
- }
207
- function f(l) {
208
- u("throw", l);
209
- }
210
- function b(l, v) {
211
- l(v), o.shift(), o.length && u(o[0][0], o[0][1]);
212
- }
213
- }
214
- function xt(e) {
215
- if (!Symbol.asyncIterator)
216
- throw new TypeError("Symbol.asyncIterator is not defined.");
217
- var r = e[Symbol.asyncIterator], t;
218
- return r ? r.call(e) : (e = typeof g == "function" ? g(e) : e[Symbol.iterator](), t = {}, n("next"), n("throw"), n("return"), t[Symbol.asyncIterator] = function() {
219
- return this;
220
- }, t);
221
- function n(o) {
222
- t[o] = e[o] && function(s) {
223
- return new Promise(function(u, a) {
224
- s = e[o](s), i(u, a, s.done, s.value);
225
- });
226
- };
227
- }
228
- function i(o, s, u, a) {
229
- Promise.resolve(a).then(function(c) {
230
- o({ value: c, done: u });
231
- }, s);
232
- }
233
- }
234
- function h(e) {
235
- return typeof e == "function";
236
- }
237
- function W(e) {
238
- var r = function(n) {
239
- Error.call(n), n.stack = new Error().stack;
240
- }, t = e(r);
241
- return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
242
- }
243
- var $ = W(function(e) {
244
- return function(t) {
245
- e(this), this.message = t ? t.length + ` errors occurred during unsubscription:
246
- ` + t.map(function(n, i) {
247
- return i + 1 + ") " + n.toString();
248
- }).join(`
249
- `) : "", this.name = "UnsubscriptionError", this.errors = t;
250
- };
251
- });
252
- function F(e, r) {
253
- if (e) {
254
- var t = e.indexOf(r);
255
- 0 <= t && e.splice(t, 1);
256
- }
257
- }
258
- var A = function() {
259
- function e(r) {
260
- this.initialTeardown = r, this.closed = !1, this._parentage = null, this._finalizers = null;
261
- }
262
- return e.prototype.unsubscribe = function() {
263
- var r, t, n, i, o;
264
- if (!this.closed) {
265
- this.closed = !0;
266
- var s = this._parentage;
267
- if (s)
268
- if (this._parentage = null, Array.isArray(s))
269
- try {
270
- for (var u = g(s), a = u.next(); !a.done; a = u.next()) {
271
- var c = a.value;
272
- c.remove(this);
273
- }
274
- } catch (p) {
275
- r = { error: p };
276
- } finally {
277
- try {
278
- a && !a.done && (t = u.return) && t.call(u);
279
- } finally {
280
- if (r)
281
- throw r.error;
282
- }
283
- }
284
- else
285
- s.remove(this);
286
- var f = this.initialTeardown;
287
- if (h(f))
288
- try {
289
- f();
290
- } catch (p) {
291
- o = p instanceof $ ? p.errors : [p];
292
- }
293
- var b = this._finalizers;
294
- if (b) {
295
- this._finalizers = null;
296
- try {
297
- for (var l = g(b), v = l.next(); !v.done; v = l.next()) {
298
- var E = v.value;
299
- try {
300
- z(E);
301
- } catch (p) {
302
- o = o ?? [], p instanceof $ ? o = U(U([], O(o)), O(p.errors)) : o.push(p);
303
- }
304
- }
305
- } catch (p) {
306
- n = { error: p };
307
- } finally {
308
- try {
309
- v && !v.done && (i = l.return) && i.call(l);
310
- } finally {
311
- if (n)
312
- throw n.error;
313
- }
314
- }
315
- }
316
- if (o)
317
- throw new $(o);
318
- }
319
- }, e.prototype.add = function(r) {
320
- var t;
321
- if (r && r !== this)
322
- if (this.closed)
323
- z(r);
324
- else {
325
- if (r instanceof e) {
326
- if (r.closed || r._hasParent(this))
327
- return;
328
- r._addParent(this);
329
- }
330
- (this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(r);
331
- }
332
- }, e.prototype._hasParent = function(r) {
333
- var t = this._parentage;
334
- return t === r || Array.isArray(t) && t.includes(r);
335
- }, e.prototype._addParent = function(r) {
336
- var t = this._parentage;
337
- this._parentage = Array.isArray(t) ? (t.push(r), t) : t ? [t, r] : r;
338
- }, e.prototype._removeParent = function(r) {
339
- var t = this._parentage;
340
- t === r ? this._parentage = null : Array.isArray(t) && F(t, r);
341
- }, e.prototype.remove = function(r) {
342
- var t = this._finalizers;
343
- t && F(t, r), r instanceof e && r._removeParent(this);
344
- }, e.EMPTY = function() {
345
- var r = new e();
346
- return r.closed = !0, r;
347
- }(), e;
348
- }(), X = A.EMPTY;
349
- function Z(e) {
350
- return e instanceof A || e && "closed" in e && h(e.remove) && h(e.add) && h(e.unsubscribe);
351
- }
352
- function z(e) {
353
- h(e) ? e() : e.unsubscribe();
354
- }
355
- var N = {
356
- onUnhandledError: null,
357
- onStoppedNotification: null,
358
- Promise: void 0,
359
- useDeprecatedSynchronousErrorHandling: !1,
360
- useDeprecatedNextContext: !1
361
- }, L = {
362
- setTimeout: function(e, r) {
363
- for (var t = [], n = 2; n < arguments.length; n++)
364
- t[n - 2] = arguments[n];
365
- var i = L.delegate;
366
- return i != null && i.setTimeout ? i.setTimeout.apply(i, U([e, r], O(t))) : setTimeout.apply(void 0, U([e, r], O(t)));
367
- },
368
- clearTimeout: function(e) {
369
- var r = L.delegate;
370
- return ((r == null ? void 0 : r.clearTimeout) || clearTimeout)(e);
371
- },
372
- delegate: void 0
373
- };
374
- function tt(e) {
375
- L.setTimeout(function() {
376
- throw e;
377
- });
378
- }
379
- function D() {
380
- }
381
- function P(e) {
382
- e();
383
- }
384
- var Y = function(e) {
385
- x(r, e);
386
- function r(t) {
387
- var n = e.call(this) || this;
388
- return n.isStopped = !1, t ? (n.destination = t, Z(t) && t.add(n)) : n.destination = Pt, n;
389
- }
390
- return r.create = function(t, n, i) {
391
- return new V(t, n, i);
392
- }, r.prototype.next = function(t) {
393
- this.isStopped || this._next(t);
394
- }, r.prototype.error = function(t) {
395
- this.isStopped || (this.isStopped = !0, this._error(t));
396
- }, r.prototype.complete = function() {
397
- this.isStopped || (this.isStopped = !0, this._complete());
398
- }, r.prototype.unsubscribe = function() {
399
- this.closed || (this.isStopped = !0, e.prototype.unsubscribe.call(this), this.destination = null);
400
- }, r.prototype._next = function(t) {
401
- this.destination.next(t);
402
- }, r.prototype._error = function(t) {
403
- try {
404
- this.destination.error(t);
405
- } finally {
406
- this.unsubscribe();
407
- }
408
- }, r.prototype._complete = function() {
409
- try {
410
- this.destination.complete();
411
- } finally {
412
- this.unsubscribe();
413
- }
414
- }, r;
415
- }(A), Et = Function.prototype.bind;
416
- function C(e, r) {
417
- return Et.call(e, r);
418
- }
419
- var _t = function() {
420
- function e(r) {
421
- this.partialObserver = r;
422
- }
423
- return e.prototype.next = function(r) {
424
- var t = this.partialObserver;
425
- if (t.next)
426
- try {
427
- t.next(r);
428
- } catch (n) {
429
- I(n);
430
- }
431
- }, e.prototype.error = function(r) {
432
- var t = this.partialObserver;
433
- if (t.error)
434
- try {
435
- t.error(r);
436
- } catch (n) {
437
- I(n);
438
- }
439
- else
440
- I(r);
441
- }, e.prototype.complete = function() {
442
- var r = this.partialObserver;
443
- if (r.complete)
444
- try {
445
- r.complete();
446
- } catch (t) {
447
- I(t);
448
- }
449
- }, e;
450
- }(), V = function(e) {
451
- x(r, e);
452
- function r(t, n, i) {
453
- var o = e.call(this) || this, s;
454
- if (h(t) || !t)
455
- s = {
456
- next: t ?? void 0,
457
- error: n ?? void 0,
458
- complete: i ?? void 0
459
- };
460
- else {
461
- var u;
462
- o && N.useDeprecatedNextContext ? (u = Object.create(t), u.unsubscribe = function() {
463
- return o.unsubscribe();
464
- }, s = {
465
- next: t.next && C(t.next, u),
466
- error: t.error && C(t.error, u),
467
- complete: t.complete && C(t.complete, u)
468
- }) : s = t;
469
- }
470
- return o.destination = new _t(s), o;
471
- }
472
- return r;
473
- }(Y);
474
- function I(e) {
475
- tt(e);
476
- }
477
- function It(e) {
478
- throw e;
479
- }
480
- var Pt = {
481
- closed: !0,
482
- next: D,
483
- error: It,
484
- complete: D
485
- }, B = function() {
486
- return typeof Symbol == "function" && Symbol.observable || "@@observable";
487
- }();
488
- function Ot(e) {
489
- return e;
490
- }
491
- function Ut(e) {
492
- return e.length === 0 ? Ot : e.length === 1 ? e[0] : function(t) {
493
- return e.reduce(function(n, i) {
494
- return i(n);
495
- }, t);
496
- };
497
- }
498
- var y = function() {
499
- function e(r) {
500
- r && (this._subscribe = r);
501
- }
502
- return e.prototype.lift = function(r) {
503
- var t = new e();
504
- return t.source = this, t.operator = r, t;
505
- }, e.prototype.subscribe = function(r, t, n) {
506
- var i = this, o = Tt(r) ? r : new V(r, t, n);
507
- return P(function() {
508
- var s = i, u = s.operator, a = s.source;
509
- o.add(u ? u.call(o, a) : a ? i._subscribe(o) : i._trySubscribe(o));
510
- }), o;
511
- }, e.prototype._trySubscribe = function(r) {
512
- try {
513
- return this._subscribe(r);
514
- } catch (t) {
515
- r.error(t);
516
- }
517
- }, e.prototype.forEach = function(r, t) {
518
- var n = this;
519
- return t = K(t), new t(function(i, o) {
520
- var s = new V({
521
- next: function(u) {
522
- try {
523
- r(u);
524
- } catch (a) {
525
- o(a), s.unsubscribe();
526
- }
527
- },
528
- error: o,
529
- complete: i
530
- });
531
- n.subscribe(s);
532
- });
533
- }, e.prototype._subscribe = function(r) {
534
- var t;
535
- return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(r);
536
- }, e.prototype[B] = function() {
537
- return this;
538
- }, e.prototype.pipe = function() {
539
- for (var r = [], t = 0; t < arguments.length; t++)
540
- r[t] = arguments[t];
541
- return Ut(r)(this);
542
- }, e.prototype.toPromise = function(r) {
543
- var t = this;
544
- return r = K(r), new r(function(n, i) {
545
- var o;
546
- t.subscribe(function(s) {
547
- return o = s;
548
- }, function(s) {
549
- return i(s);
550
- }, function() {
551
- return n(o);
552
- });
553
- });
554
- }, e.create = function(r) {
555
- return new e(r);
556
- }, e;
557
- }();
558
- function K(e) {
559
- var r;
560
- return (r = e ?? N.Promise) !== null && r !== void 0 ? r : Promise;
561
- }
562
- function At(e) {
563
- return e && h(e.next) && h(e.error) && h(e.complete);
564
- }
565
- function Tt(e) {
566
- return e && e instanceof Y || At(e) && Z(e);
567
- }
568
- function kt(e) {
569
- return h(e == null ? void 0 : e.lift);
570
- }
571
- function T(e) {
572
- return function(r) {
573
- if (kt(r))
574
- return r.lift(function(t) {
575
- try {
576
- return e(t, this);
577
- } catch (n) {
578
- this.error(n);
579
- }
580
- });
581
- throw new TypeError("Unable to lift unknown Observable type");
582
- };
583
- }
584
- function q(e, r, t, n, i) {
585
- return new jt(e, r, t, n, i);
586
- }
587
- var jt = function(e) {
588
- x(r, e);
589
- function r(t, n, i, o, s, u) {
590
- var a = e.call(this, t) || this;
591
- return a.onFinalize = s, a.shouldUnsubscribe = u, a._next = n ? function(c) {
592
- try {
593
- n(c);
594
- } catch (f) {
595
- t.error(f);
596
- }
597
- } : e.prototype._next, a._error = o ? function(c) {
598
- try {
599
- o(c);
600
- } catch (f) {
601
- t.error(f);
602
- } finally {
603
- this.unsubscribe();
604
- }
605
- } : e.prototype._error, a._complete = i ? function() {
606
- try {
607
- i();
608
- } catch (c) {
609
- t.error(c);
610
- } finally {
611
- this.unsubscribe();
612
- }
613
- } : e.prototype._complete, a;
614
- }
615
- return r.prototype.unsubscribe = function() {
616
- var t;
617
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
618
- var n = this.closed;
619
- e.prototype.unsubscribe.call(this), !n && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
620
- }
621
- }, r;
622
- }(Y), $t = W(function(e) {
623
- return function() {
624
- e(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
625
- };
626
- }), w = function(e) {
627
- x(r, e);
628
- function r() {
629
- var t = e.call(this) || this;
630
- return t.closed = !1, t.currentObservers = null, t.observers = [], t.isStopped = !1, t.hasError = !1, t.thrownError = null, t;
631
- }
632
- return r.prototype.lift = function(t) {
633
- var n = new J(this, this);
634
- return n.operator = t, n;
635
- }, r.prototype._throwIfClosed = function() {
636
- if (this.closed)
637
- throw new $t();
638
- }, r.prototype.next = function(t) {
639
- var n = this;
640
- P(function() {
641
- var i, o;
642
- if (n._throwIfClosed(), !n.isStopped) {
643
- n.currentObservers || (n.currentObservers = Array.from(n.observers));
644
- try {
645
- for (var s = g(n.currentObservers), u = s.next(); !u.done; u = s.next()) {
646
- var a = u.value;
647
- a.next(t);
648
- }
649
- } catch (c) {
650
- i = { error: c };
651
- } finally {
652
- try {
653
- u && !u.done && (o = s.return) && o.call(s);
654
- } finally {
655
- if (i)
656
- throw i.error;
657
- }
658
- }
659
- }
660
- });
661
- }, r.prototype.error = function(t) {
662
- var n = this;
663
- P(function() {
664
- if (n._throwIfClosed(), !n.isStopped) {
665
- n.hasError = n.isStopped = !0, n.thrownError = t;
666
- for (var i = n.observers; i.length; )
667
- i.shift().error(t);
668
- }
669
- });
670
- }, r.prototype.complete = function() {
671
- var t = this;
672
- P(function() {
673
- if (t._throwIfClosed(), !t.isStopped) {
674
- t.isStopped = !0;
675
- for (var n = t.observers; n.length; )
676
- n.shift().complete();
677
- }
678
- });
679
- }, r.prototype.unsubscribe = function() {
680
- this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
681
- }, Object.defineProperty(r.prototype, "observed", {
682
- get: function() {
683
- var t;
684
- return ((t = this.observers) === null || t === void 0 ? void 0 : t.length) > 0;
685
- },
686
- enumerable: !1,
687
- configurable: !0
688
- }), r.prototype._trySubscribe = function(t) {
689
- return this._throwIfClosed(), e.prototype._trySubscribe.call(this, t);
690
- }, r.prototype._subscribe = function(t) {
691
- return this._throwIfClosed(), this._checkFinalizedStatuses(t), this._innerSubscribe(t);
692
- }, r.prototype._innerSubscribe = function(t) {
693
- var n = this, i = this, o = i.hasError, s = i.isStopped, u = i.observers;
694
- return o || s ? X : (this.currentObservers = null, u.push(t), new A(function() {
695
- n.currentObservers = null, F(u, t);
696
- }));
697
- }, r.prototype._checkFinalizedStatuses = function(t) {
698
- var n = this, i = n.hasError, o = n.thrownError, s = n.isStopped;
699
- i ? t.error(o) : s && t.complete();
700
- }, r.prototype.asObservable = function() {
701
- var t = new y();
702
- return t.source = this, t;
703
- }, r.create = function(t, n) {
704
- return new J(t, n);
705
- }, r;
706
- }(y), J = function(e) {
707
- x(r, e);
708
- function r(t, n) {
709
- var i = e.call(this) || this;
710
- return i.destination = t, i.source = n, i;
711
- }
712
- return r.prototype.next = function(t) {
713
- var n, i;
714
- (i = (n = this.destination) === null || n === void 0 ? void 0 : n.next) === null || i === void 0 || i.call(n, t);
715
- }, r.prototype.error = function(t) {
716
- var n, i;
717
- (i = (n = this.destination) === null || n === void 0 ? void 0 : n.error) === null || i === void 0 || i.call(n, t);
718
- }, r.prototype.complete = function() {
719
- var t, n;
720
- (n = (t = this.destination) === null || t === void 0 ? void 0 : t.complete) === null || n === void 0 || n.call(t);
721
- }, r.prototype._subscribe = function(t) {
722
- var n, i;
723
- return (i = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t)) !== null && i !== void 0 ? i : X;
724
- }, r;
725
- }(w), et = function(e) {
726
- x(r, e);
727
- function r(t) {
728
- var n = e.call(this) || this;
729
- return n._value = t, n;
730
- }
731
- return Object.defineProperty(r.prototype, "value", {
732
- get: function() {
733
- return this.getValue();
734
- },
735
- enumerable: !1,
736
- configurable: !0
737
- }), r.prototype._subscribe = function(t) {
738
- var n = e.prototype._subscribe.call(this, t);
739
- return !n.closed && t.next(this._value), n;
740
- }, r.prototype.getValue = function() {
741
- var t = this, n = t.hasError, i = t.thrownError, o = t._value;
742
- if (n)
743
- throw i;
744
- return this._throwIfClosed(), o;
745
- }, r.prototype.next = function(t) {
746
- e.prototype.next.call(this, this._value = t);
747
- }, r;
748
- }(w), Ct = new y(function(e) {
749
- return e.complete();
750
- });
751
- function Rt(e) {
752
- return e && h(e.schedule);
753
- }
754
- function Ft(e) {
755
- return e[e.length - 1];
756
- }
757
- function Lt(e) {
758
- return Rt(Ft(e)) ? e.pop() : void 0;
759
- }
760
- var rt = function(e) {
761
- return e && typeof e.length == "number" && typeof e != "function";
762
- };
763
- function nt(e) {
764
- return h(e == null ? void 0 : e.then);
765
- }
766
- function it(e) {
767
- return h(e[B]);
768
- }
769
- function ot(e) {
770
- return Symbol.asyncIterator && h(e == null ? void 0 : e[Symbol.asyncIterator]);
771
- }
772
- function st(e) {
773
- return new TypeError("You provided " + (e !== null && typeof e == "object" ? "an invalid object" : "'" + e + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
774
- }
775
- function Dt() {
776
- return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
777
- }
778
- var ut = Dt();
779
- function ct(e) {
780
- return h(e == null ? void 0 : e[ut]);
781
- }
782
- function at(e) {
783
- return gt(this, arguments, function() {
784
- var t, n, i, o;
785
- return Q(this, function(s) {
786
- switch (s.label) {
787
- case 0:
788
- t = e.getReader(), s.label = 1;
789
- case 1:
790
- s.trys.push([1, , 9, 10]), s.label = 2;
791
- case 2:
792
- return [4, S(t.read())];
793
- case 3:
794
- return n = s.sent(), i = n.value, o = n.done, o ? [4, S(void 0)] : [3, 5];
795
- case 4:
796
- return [2, s.sent()];
797
- case 5:
798
- return [4, S(i)];
799
- case 6:
800
- return [4, s.sent()];
801
- case 7:
802
- return s.sent(), [3, 2];
803
- case 8:
804
- return [3, 10];
805
- case 9:
806
- return t.releaseLock(), [7];
807
- case 10:
808
- return [2];
809
- }
810
- });
811
- });
812
- }
813
- function lt(e) {
814
- return h(e == null ? void 0 : e.getReader);
815
- }
816
- function k(e) {
817
- if (e instanceof y)
818
- return e;
819
- if (e != null) {
820
- if (it(e))
821
- return Vt(e);
822
- if (rt(e))
823
- return Yt(e);
824
- if (nt(e))
825
- return Bt(e);
826
- if (ot(e))
827
- return ft(e);
828
- if (ct(e))
829
- return qt(e);
830
- if (lt(e))
831
- return Mt(e);
832
- }
833
- throw st(e);
834
- }
835
- function Vt(e) {
836
- return new y(function(r) {
837
- var t = e[B]();
838
- if (h(t.subscribe))
839
- return t.subscribe(r);
840
- throw new TypeError("Provided object does not correctly implement Symbol.observable");
841
- });
842
- }
843
- function Yt(e) {
844
- return new y(function(r) {
845
- for (var t = 0; t < e.length && !r.closed; t++)
846
- r.next(e[t]);
847
- r.complete();
848
- });
849
- }
850
- function Bt(e) {
851
- return new y(function(r) {
852
- e.then(function(t) {
853
- r.closed || (r.next(t), r.complete());
854
- }, function(t) {
855
- return r.error(t);
856
- }).then(null, tt);
857
- });
858
- }
859
- function qt(e) {
860
- return new y(function(r) {
861
- var t, n;
862
- try {
863
- for (var i = g(e), o = i.next(); !o.done; o = i.next()) {
864
- var s = o.value;
865
- if (r.next(s), r.closed)
866
- return;
867
- }
868
- } catch (u) {
869
- t = { error: u };
870
- } finally {
871
- try {
872
- o && !o.done && (n = i.return) && n.call(i);
873
- } finally {
874
- if (t)
875
- throw t.error;
876
- }
877
- }
878
- r.complete();
879
- });
880
- }
881
- function ft(e) {
882
- return new y(function(r) {
883
- Gt(e, r).catch(function(t) {
884
- return r.error(t);
885
- });
886
- });
887
- }
888
- function Mt(e) {
889
- return ft(at(e));
890
- }
891
- function Gt(e, r) {
892
- var t, n, i, o;
893
- return St(this, void 0, void 0, function() {
894
- var s, u;
895
- return Q(this, function(a) {
896
- switch (a.label) {
897
- case 0:
898
- a.trys.push([0, 5, 6, 11]), t = xt(e), a.label = 1;
899
- case 1:
900
- return [4, t.next()];
901
- case 2:
902
- if (n = a.sent(), !!n.done)
903
- return [3, 4];
904
- if (s = n.value, r.next(s), r.closed)
905
- return [2];
906
- a.label = 3;
907
- case 3:
908
- return [3, 1];
909
- case 4:
910
- return [3, 11];
911
- case 5:
912
- return u = a.sent(), i = { error: u }, [3, 11];
913
- case 6:
914
- return a.trys.push([6, , 9, 10]), n && !n.done && (o = t.return) ? [4, o.call(t)] : [3, 8];
915
- case 7:
916
- a.sent(), a.label = 8;
917
- case 8:
918
- return [3, 10];
919
- case 9:
920
- if (i)
921
- throw i.error;
922
- return [7];
923
- case 10:
924
- return [7];
925
- case 11:
926
- return r.complete(), [2];
927
- }
928
- });
929
- });
930
- }
931
- function m(e, r, t, n, i) {
932
- n === void 0 && (n = 0), i === void 0 && (i = !1);
933
- var o = r.schedule(function() {
934
- t(), i ? e.add(this.schedule(null, n)) : this.unsubscribe();
935
- }, n);
936
- if (e.add(o), !i)
937
- return o;
938
- }
939
- function ht(e, r) {
940
- return r === void 0 && (r = 0), T(function(t, n) {
941
- t.subscribe(q(n, function(i) {
942
- return m(n, e, function() {
943
- return n.next(i);
944
- }, r);
945
- }, function() {
946
- return m(n, e, function() {
947
- return n.complete();
948
- }, r);
949
- }, function(i) {
950
- return m(n, e, function() {
951
- return n.error(i);
952
- }, r);
953
- }));
954
- });
955
- }
956
- function dt(e, r) {
957
- return r === void 0 && (r = 0), T(function(t, n) {
958
- n.add(e.schedule(function() {
959
- return t.subscribe(n);
960
- }, r));
961
- });
962
- }
963
- function Ht(e, r) {
964
- return k(e).pipe(dt(r), ht(r));
965
- }
966
- function zt(e, r) {
967
- return k(e).pipe(dt(r), ht(r));
968
- }
969
- function Kt(e, r) {
970
- return new y(function(t) {
971
- var n = 0;
972
- return r.schedule(function() {
973
- n === e.length ? t.complete() : (t.next(e[n++]), t.closed || this.schedule());
974
- });
975
- });
976
- }
977
- function Jt(e, r) {
978
- return new y(function(t) {
979
- var n;
980
- return m(t, r, function() {
981
- n = e[ut](), m(t, r, function() {
982
- var i, o, s;
983
- try {
984
- i = n.next(), o = i.value, s = i.done;
985
- } catch (u) {
986
- t.error(u);
987
- return;
988
- }
989
- s ? t.complete() : t.next(o);
990
- }, 0, !0);
991
- }), function() {
992
- return h(n == null ? void 0 : n.return) && n.return();
993
- };
994
- });
995
- }
996
- function pt(e, r) {
997
- if (!e)
998
- throw new Error("Iterable cannot be null");
999
- return new y(function(t) {
1000
- m(t, r, function() {
1001
- var n = e[Symbol.asyncIterator]();
1002
- m(t, r, function() {
1003
- n.next().then(function(i) {
1004
- i.done ? t.complete() : t.next(i.value);
1005
- });
1006
- }, 0, !0);
1007
- });
1008
- });
1009
- }
1010
- function Qt(e, r) {
1011
- return pt(at(e), r);
1012
- }
1013
- function Wt(e, r) {
1014
- if (e != null) {
1015
- if (it(e))
1016
- return Ht(e, r);
1017
- if (rt(e))
1018
- return Kt(e, r);
1019
- if (nt(e))
1020
- return zt(e, r);
1021
- if (ot(e))
1022
- return pt(e, r);
1023
- if (ct(e))
1024
- return Jt(e, r);
1025
- if (lt(e))
1026
- return Qt(e, r);
1027
- }
1028
- throw st(e);
1029
- }
1030
- function Xt(e, r) {
1031
- return r ? Wt(e, r) : k(e);
1032
- }
1033
- function Zt() {
1034
- for (var e = [], r = 0; r < arguments.length; r++)
1035
- e[r] = arguments[r];
1036
- var t = Lt(e);
1037
- return Xt(e, t);
1038
- }
1039
- function Nt(e) {
1040
- return e <= 0 ? function() {
1041
- return Ct;
1042
- } : T(function(r, t) {
1043
- var n = 0;
1044
- r.subscribe(q(t, function(i) {
1045
- ++n <= e && (t.next(i), e <= n && t.complete());
1046
- }));
1047
- });
1048
- }
1049
- function te(e) {
1050
- return T(function(r, t) {
1051
- k(e).subscribe(q(t, function() {
1052
- return t.complete();
1053
- }, D)), !t.closed && r.subscribe(t);
1054
- });
1055
- }
1056
- class ee {
1057
- constructor(r, t, n) {
1058
- this.id = r, this.component = t, this.platform = n, this.entries$ = new et([]), this.kill$ = new w(), this.queue = [], t.addEventListener("user-submit", (i) => {
1059
- if (!this.provider) {
1060
- console.warn(
1061
- "No provider activated, unable to print message to conversation."
1062
- );
1063
- return;
1064
- }
1065
- this.provider.onUserSubmit(i.detail);
1066
- });
1067
- }
1068
- write(r) {
1069
- this.entries$.pipe(Nt(1)).subscribe((t) => {
1070
- this.entries$.next([...t, r]);
1071
- });
1072
- }
1073
- entries() {
1074
- return this.entries$.asObservable();
1075
- }
1076
- setProvider(r) {
1077
- this.provider = r, this.provider.actions().pipe(te(this.kill$)).subscribe((t) => {
1078
- this.write(t);
1079
- });
1080
- }
1081
- handover(r) {
1082
- const t = this.platform.registeredProviders.get(r);
1083
- if (t) {
1084
- this.provider && this.queue.unshift(this.provider), this.kill$.next();
1085
- const n = t(this);
1086
- this.setProvider(n);
1087
- }
1088
- }
1089
- completeProvider() {
1090
- const [r] = this.queue;
1091
- r && this.setProvider(r);
1092
- }
1093
- isTyping() {
1094
- return this.provider ? this.provider.isTyping() : Zt(!1);
1095
- }
1096
- }
1097
- class M {
1098
- constructor() {
1099
- this.sessions = /* @__PURE__ */ new Map(), this.registeredProviders = /* @__PURE__ */ new Map(), this.activeSessionId = null;
1100
- }
1101
- static async getInstance(r) {
1102
- let t = await r.get("conversation");
1103
- return t || (t = new M(), await r.register("conversation", t), t);
1104
- }
1105
- registerProvider(r, t) {
1106
- this.registeredProviders.set(r, t);
1107
- }
1108
- createSession(r) {
1109
- const t = new ee(wt(), r, this), n = this.getProviderByConfiguration(r);
1110
- if (n) {
1111
- const i = n(t);
1112
- t.setProvider(i);
1113
- }
1114
- return this.sessions.set(t.id, t), this.activeSessionId = t.id, t;
1115
- }
1116
- getProviderByConfiguration(r) {
1117
- const [t] = r.properties.providers || [];
1118
- if (!t) {
1119
- console.warn(
1120
- "No providers registered. You most likely forgot to add a provider to the conversation component properties."
1121
- );
1122
- return;
1123
- }
1124
- return this.registeredProviders.get(t);
1125
- }
1126
- }
1127
- const ie = async (e) => {
1128
- e.registerComponent("conversation", import("./conversation-d74b7570.mjs").then((r) => r.c)), await M.getInstance(e.container);
1129
- };
1130
- var j = /* @__PURE__ */ ((e) => (e.User = "user", e.Agent = "agent", e.System = "system", e))(j || {});
1131
- class G {
1132
- constructor(r, t, n) {
1133
- this.type = r, this.sender = t, this.messages = n, this.didUpdate = new w(), this.timestamp = Date.now();
1134
- }
1135
- update(r) {
1136
- this.messages = [
1137
- {
1138
- items: r
1139
- }
1140
- ], this.didUpdate.next(this);
1141
- }
1142
- }
1143
- class re {
1144
- constructor(r) {
1145
- this.name = r, this.print$ = new w();
1146
- }
1147
- print(r) {
1148
- const t = new G(
1149
- j.Agent,
1150
- { name: this.name },
1151
- [
1152
- {
1153
- items: [["html", { content: r }]]
1154
- }
1155
- ]
1156
- );
1157
- return this.print$.next(t), t;
1158
- }
1159
- subscribe() {
1160
- return this.print$.asObservable();
1161
- }
1162
- }
1163
- class ne {
1164
- constructor(r) {
1165
- this.name = r, this.print$ = new w();
1166
- }
1167
- print(r) {
1168
- const t = new G(
1169
- j.User,
1170
- { name: this.name },
1171
- [
1172
- {
1173
- items: [["html", { content: r }]]
1174
- }
1175
- ]
1176
- );
1177
- return this.print$.next(t), t;
1178
- }
1179
- subscribe() {
1180
- return this.print$.asObservable();
1181
- }
1182
- }
1183
- class oe {
1184
- constructor(r, t) {
1185
- this.name = r, this.session = t, this.print$ = new w(), this.typingState$ = new et(!1);
1186
- }
1187
- onUserSubmit(r) {
1188
- this.print(j.User, r.text);
1189
- }
1190
- print(r, t) {
1191
- const n = new G(
1192
- r,
1193
- {
1194
- name: ""
1195
- },
1196
- [
1197
- {
1198
- items: [["html", { content: t }]]
1199
- }
1200
- ]
1201
- );
1202
- return this.printEntry(n);
1203
- }
1204
- printEntry(r) {
1205
- return this.print$.next(r), r;
1206
- }
1207
- createAgent(r) {
1208
- const t = new re(r);
1209
- return t.subscribe().subscribe((n) => {
1210
- this.playNotification(), this.printEntry(n);
1211
- }), t;
1212
- }
1213
- createUser(r) {
1214
- const t = new ne(r);
1215
- return t.subscribe().subscribe((n) => {
1216
- this.printEntry(n);
1217
- }), t;
1218
- }
1219
- setTypingState(r) {
1220
- this.typingState$.next(r);
1221
- }
1222
- isTyping() {
1223
- return this.typingState$.asObservable();
1224
- }
1225
- actions() {
1226
- return this.print$.asObservable();
1227
- }
1228
- complete() {
1229
- this.session.completeProvider();
1230
- }
1231
- playNotification() {
1232
- const r = "https://publicpoc.blob.core.windows.net/widget-assets/notification.mp3";
1233
- this.session.component.application.branding().other.disableSound || new Audio(r).play();
1234
- }
1235
- }
1236
- export {
1237
- re as A,
1238
- j as C,
1239
- ne as U,
1240
- ie as a,
1241
- M as b,
1242
- oe as c,
1243
- G as d,
1244
- ee as e
1245
- };