@asgard-js/core 0.0.1 → 0.0.3-8.canary-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +329 -6
  2. package/dist/constants/enum.d.ts +12 -3
  3. package/dist/constants/enum.d.ts.map +1 -1
  4. package/dist/index.cjs +3 -3
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +3 -3
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.mjs +1119 -1010
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/lib/channel.d.ts +19 -0
  13. package/dist/lib/channel.d.ts.map +1 -0
  14. package/dist/lib/client.d.ts +11 -13
  15. package/dist/lib/client.d.ts.map +1 -1
  16. package/dist/lib/conversation.d.ts +18 -0
  17. package/dist/lib/conversation.d.ts.map +1 -0
  18. package/dist/lib/create-sse-observable.d.ts +7 -6
  19. package/dist/lib/create-sse-observable.d.ts.map +1 -1
  20. package/dist/lib/event-emitter.d.ts +8 -0
  21. package/dist/lib/event-emitter.d.ts.map +1 -0
  22. package/dist/types/channel.d.ts +42 -0
  23. package/dist/types/channel.d.ts.map +1 -0
  24. package/dist/types/client.d.ts +62 -16
  25. package/dist/types/client.d.ts.map +1 -1
  26. package/dist/types/event-emitter.d.ts +5 -0
  27. package/dist/types/event-emitter.d.ts.map +1 -0
  28. package/dist/types/index.d.ts +2 -0
  29. package/dist/types/index.d.ts.map +1 -1
  30. package/dist/types/sse-response.d.ts +60 -11
  31. package/dist/types/sse-response.d.ts.map +1 -1
  32. package/eslint.config.cjs +22 -0
  33. package/package.json +13 -1
  34. package/src/constants/enum.ts +32 -0
  35. package/src/index.ts +11 -0
  36. package/src/lib/channel.ts +153 -0
  37. package/src/lib/client.spec.ts +150 -0
  38. package/src/lib/client.ts +141 -0
  39. package/src/lib/conversation.ts +120 -0
  40. package/src/lib/create-sse-observable.ts +77 -0
  41. package/src/lib/event-emitter.ts +30 -0
  42. package/src/types/channel.ts +50 -0
  43. package/src/types/client.ts +89 -0
  44. package/src/types/event-emitter.ts +8 -0
  45. package/src/types/index.ts +4 -0
  46. package/src/types/sse-response.ts +176 -0
  47. package/tsconfig.json +13 -0
  48. package/tsconfig.lib.json +28 -0
  49. package/tsconfig.spec.json +33 -0
  50. package/vite.config.ts +80 -0
package/dist/index.mjs CHANGED
@@ -1,754 +1,525 @@
1
- var qe = Object.defineProperty;
2
- var Ve = (t, n, e) => n in t ? qe(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
- var E = (t, n, e) => Ve(t, typeof n != "symbol" ? n + "" : n, e);
4
- var C = /* @__PURE__ */ ((t) => (t.RESET_CHANNEL = "RESET_CHANNEL", t.NONE = "NONE", t))(C || {}), Ye = /* @__PURE__ */ ((t) => (t.INIT = "asgard.run.init", t.MESSAGE_START = "asgard.message.start", t.MESSAGE_DELTA = "asgard.message.delta", t.MESSAGE_COMPLETE = "asgard.message.complete", t.DONE = "asgard.run.done", t))(Ye || {}), Be = /* @__PURE__ */ ((t) => (t.TEXT = "TEXT", t.HINT = "HINT", t.BUTTON = "BUTTON", t.IMAGE = "IMAGE", t.VIDEO = "VIDEO", t.AUDIO = "AUDIO", t.LOCATION = "LOCATION", t.CAROUSEL = "CAROUSEL", t))(Be || {});
5
- function Ke(t) {
6
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
7
- }
8
- var J = { exports: {} }, I = typeof Reflect == "object" ? Reflect : null, Z = I && typeof I.apply == "function" ? I.apply : function(n, e, r) {
9
- return Function.prototype.apply.call(n, e, r);
10
- }, U;
11
- I && typeof I.ownKeys == "function" ? U = I.ownKeys : Object.getOwnPropertySymbols ? U = function(n) {
12
- return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n));
13
- } : U = function(n) {
14
- return Object.getOwnPropertyNames(n);
15
- };
16
- function ze(t) {
17
- console && console.warn && console.warn(t);
18
- }
19
- var le = Number.isNaN || function(n) {
20
- return n !== n;
21
- };
22
- function d() {
23
- d.init.call(this);
24
- }
25
- J.exports = d;
26
- J.exports.once = Ze;
27
- d.EventEmitter = d;
28
- d.prototype._events = void 0;
29
- d.prototype._eventsCount = 0;
30
- d.prototype._maxListeners = void 0;
31
- var ee = 10;
32
- function G(t) {
33
- if (typeof t != "function")
34
- throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t);
35
- }
36
- Object.defineProperty(d, "defaultMaxListeners", {
37
- enumerable: !0,
38
- get: function() {
39
- return ee;
40
- },
41
- set: function(t) {
42
- if (typeof t != "number" || t < 0 || le(t))
43
- throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + ".");
44
- ee = t;
45
- }
46
- });
47
- d.init = function() {
48
- (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
49
- };
50
- d.prototype.setMaxListeners = function(n) {
51
- if (typeof n != "number" || n < 0 || le(n))
52
- throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
53
- return this._maxListeners = n, this;
54
- };
55
- function de(t) {
56
- return t._maxListeners === void 0 ? d.defaultMaxListeners : t._maxListeners;
57
- }
58
- d.prototype.getMaxListeners = function() {
59
- return de(this);
60
- };
61
- d.prototype.emit = function(n) {
62
- for (var e = [], r = 1; r < arguments.length; r++) e.push(arguments[r]);
63
- var i = n === "error", o = this._events;
64
- if (o !== void 0)
65
- i = i && o.error === void 0;
66
- else if (!i)
67
- return !1;
68
- if (i) {
69
- var u;
70
- if (e.length > 0 && (u = e[0]), u instanceof Error)
71
- throw u;
72
- var s = new Error("Unhandled error." + (u ? " (" + u.message + ")" : ""));
73
- throw s.context = u, s;
74
- }
75
- var f = o[n];
76
- if (f === void 0)
77
- return !1;
78
- if (typeof f == "function")
79
- Z(f, this, e);
80
- else
81
- for (var a = f.length, l = be(f, a), r = 0; r < a; ++r)
82
- Z(l[r], this, e);
83
- return !0;
84
- };
85
- function he(t, n, e, r) {
86
- var i, o, u;
87
- if (G(e), o = t._events, o === void 0 ? (o = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (o.newListener !== void 0 && (t.emit(
88
- "newListener",
89
- n,
90
- e.listener ? e.listener : e
91
- ), o = t._events), u = o[n]), u === void 0)
92
- u = o[n] = e, ++t._eventsCount;
93
- else if (typeof u == "function" ? u = o[n] = r ? [e, u] : [u, e] : r ? u.unshift(e) : u.push(e), i = de(t), i > 0 && u.length > i && !u.warned) {
94
- u.warned = !0;
95
- var s = new Error("Possible EventEmitter memory leak detected. " + u.length + " " + String(n) + " listeners added. Use emitter.setMaxListeners() to increase limit");
96
- s.name = "MaxListenersExceededWarning", s.emitter = t, s.type = n, s.count = u.length, ze(s);
97
- }
98
- return t;
99
- }
100
- d.prototype.addListener = function(n, e) {
101
- return he(this, n, e, !1);
102
- };
103
- d.prototype.on = d.prototype.addListener;
104
- d.prototype.prependListener = function(n, e) {
105
- return he(this, n, e, !0);
106
- };
107
- function Je() {
108
- if (!this.fired)
109
- return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
110
- }
111
- function ve(t, n, e) {
112
- var r = { fired: !1, wrapFn: void 0, target: t, type: n, listener: e }, i = Je.bind(r);
113
- return i.listener = e, r.wrapFn = i, i;
114
- }
115
- d.prototype.once = function(n, e) {
116
- return G(e), this.on(n, ve(this, n, e)), this;
117
- };
118
- d.prototype.prependOnceListener = function(n, e) {
119
- return G(e), this.prependListener(n, ve(this, n, e)), this;
120
- };
121
- d.prototype.removeListener = function(n, e) {
122
- var r, i, o, u, s;
123
- if (G(e), i = this._events, i === void 0)
124
- return this;
125
- if (r = i[n], r === void 0)
126
- return this;
127
- if (r === e || r.listener === e)
128
- --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete i[n], i.removeListener && this.emit("removeListener", n, r.listener || e));
129
- else if (typeof r != "function") {
130
- for (o = -1, u = r.length - 1; u >= 0; u--)
131
- if (r[u] === e || r[u].listener === e) {
132
- s = r[u].listener, o = u;
133
- break;
134
- }
135
- if (o < 0)
136
- return this;
137
- o === 0 ? r.shift() : Xe(r, o), r.length === 1 && (i[n] = r[0]), i.removeListener !== void 0 && this.emit("removeListener", n, s || e);
138
- }
139
- return this;
140
- };
141
- d.prototype.off = d.prototype.removeListener;
142
- d.prototype.removeAllListeners = function(n) {
143
- var e, r, i;
144
- if (r = this._events, r === void 0)
145
- return this;
146
- if (r.removeListener === void 0)
147
- return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : r[n] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete r[n]), this;
148
- if (arguments.length === 0) {
149
- var o = Object.keys(r), u;
150
- for (i = 0; i < o.length; ++i)
151
- u = o[i], u !== "removeListener" && this.removeAllListeners(u);
152
- return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
153
- }
154
- if (e = r[n], typeof e == "function")
155
- this.removeListener(n, e);
156
- else if (e !== void 0)
157
- for (i = e.length - 1; i >= 0; i--)
158
- this.removeListener(n, e[i]);
159
- return this;
160
- };
161
- function pe(t, n, e) {
162
- var r = t._events;
163
- if (r === void 0)
164
- return [];
165
- var i = r[n];
166
- return i === void 0 ? [] : typeof i == "function" ? e ? [i.listener || i] : [i] : e ? Qe(i) : be(i, i.length);
167
- }
168
- d.prototype.listeners = function(n) {
169
- return pe(this, n, !0);
170
- };
171
- d.prototype.rawListeners = function(n) {
172
- return pe(this, n, !1);
173
- };
174
- d.listenerCount = function(t, n) {
175
- return typeof t.listenerCount == "function" ? t.listenerCount(n) : ye.call(t, n);
176
- };
177
- d.prototype.listenerCount = ye;
178
- function ye(t) {
179
- var n = this._events;
180
- if (n !== void 0) {
181
- var e = n[t];
182
- if (typeof e == "function")
183
- return 1;
184
- if (e !== void 0)
185
- return e.length;
186
- }
187
- return 0;
188
- }
189
- d.prototype.eventNames = function() {
190
- return this._eventsCount > 0 ? U(this._events) : [];
191
- };
192
- function be(t, n) {
193
- for (var e = new Array(n), r = 0; r < n; ++r)
194
- e[r] = t[r];
195
- return e;
196
- }
197
- function Xe(t, n) {
198
- for (; n + 1 < t.length; n++)
199
- t[n] = t[n + 1];
200
- t.pop();
201
- }
202
- function Qe(t) {
203
- for (var n = new Array(t.length), e = 0; e < n.length; ++e)
204
- n[e] = t[e].listener || t[e];
205
- return n;
206
- }
207
- function Ze(t, n) {
208
- return new Promise(function(e, r) {
209
- function i(u) {
210
- t.removeListener(n, o), r(u);
211
- }
212
- function o() {
213
- typeof t.removeListener == "function" && t.removeListener("error", i), e([].slice.call(arguments));
214
- }
215
- me(t, n, o, { once: !0 }), n !== "error" && et(t, i, { once: !0 });
216
- });
217
- }
218
- function et(t, n, e) {
219
- typeof t.on == "function" && me(t, "error", n, e);
220
- }
221
- function me(t, n, e, r) {
222
- if (typeof t.on == "function")
223
- r.once ? t.once(n, e) : t.on(n, e);
224
- else if (typeof t.addEventListener == "function")
225
- t.addEventListener(n, function i(o) {
226
- r.once && t.removeEventListener(n, i), e(o);
227
- });
228
- else
229
- throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof t);
230
- }
231
- var tt = J.exports;
232
- const nt = /* @__PURE__ */ Ke(tt);
233
- var Y = function(t, n) {
1
+ var De = Object.defineProperty;
2
+ var Ue = (n, t, e) => t in n ? De(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var m = (n, t, e) => Ue(n, typeof t != "symbol" ? t + "" : t, e);
4
+ var K = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n))(K || {}), h = /* @__PURE__ */ ((n) => (n.INIT = "asgard.run.init", n.PROCESS = "asgard.process", n.PROCESS_START = "asgard.process.start", n.PROCESS_COMPLETE = "asgard.process.complete", n.MESSAGE = "asgard.message", n.MESSAGE_START = "asgard.message.start", n.MESSAGE_DELTA = "asgard.message.delta", n.MESSAGE_COMPLETE = "asgard.message.complete", n.TOOL_CALL = "asgard.tool_call", n.TOOL_CALL_START = "asgard.tool_call.start", n.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(h || {}), Ne = /* @__PURE__ */ ((n) => (n.TEXT = "TEXT", n.HINT = "HINT", n.BUTTON = "BUTTON", n.IMAGE = "IMAGE", n.VIDEO = "VIDEO", n.AUDIO = "AUDIO", n.LOCATION = "LOCATION", n.CAROUSEL = "CAROUSEL", n.CHART = "CHART", n))(Ne || {}), Y = function(n, t) {
234
5
  return Y = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
235
6
  e.__proto__ = r;
236
7
  } || function(e, r) {
237
8
  for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (e[i] = r[i]);
238
- }, Y(t, n);
9
+ }, Y(n, t);
239
10
  };
240
- function S(t, n) {
241
- if (typeof n != "function" && n !== null)
242
- throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
243
- Y(t, n);
11
+ function O(n, t) {
12
+ if (typeof t != "function" && t !== null)
13
+ throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
14
+ Y(n, t);
244
15
  function e() {
245
- this.constructor = t;
16
+ this.constructor = n;
246
17
  }
247
- t.prototype = n === null ? Object.create(n) : (e.prototype = n.prototype, new e());
18
+ n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
248
19
  }
249
- function rt(t, n, e, r) {
20
+ function $e(n, t, e, r) {
250
21
  function i(o) {
251
- return o instanceof e ? o : new e(function(u) {
252
- u(o);
22
+ return o instanceof e ? o : new e(function(s) {
23
+ s(o);
253
24
  });
254
25
  }
255
- return new (e || (e = Promise))(function(o, u) {
256
- function s(l) {
26
+ return new (e || (e = Promise))(function(o, s) {
27
+ function c(f) {
257
28
  try {
258
- a(r.next(l));
29
+ u(r.next(f));
259
30
  } catch (y) {
260
- u(y);
31
+ s(y);
261
32
  }
262
33
  }
263
- function f(l) {
34
+ function a(f) {
264
35
  try {
265
- a(r.throw(l));
36
+ u(r.throw(f));
266
37
  } catch (y) {
267
- u(y);
38
+ s(y);
268
39
  }
269
40
  }
270
- function a(l) {
271
- l.done ? o(l.value) : i(l.value).then(s, f);
41
+ function u(f) {
42
+ f.done ? o(f.value) : i(f.value).then(c, a);
272
43
  }
273
- a((r = r.apply(t, n || [])).next());
44
+ u((r = r.apply(n, t || [])).next());
274
45
  });
275
46
  }
276
- function we(t, n) {
47
+ function ce(n, t) {
277
48
  var e = { label: 0, sent: function() {
278
49
  if (o[0] & 1) throw o[1];
279
50
  return o[1];
280
- }, trys: [], ops: [] }, r, i, o, u = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
281
- return u.next = s(0), u.throw = s(1), u.return = s(2), typeof Symbol == "function" && (u[Symbol.iterator] = function() {
51
+ }, trys: [], ops: [] }, r, i, o, s = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
52
+ return s.next = c(0), s.throw = c(1), s.return = c(2), typeof Symbol == "function" && (s[Symbol.iterator] = function() {
282
53
  return this;
283
- }), u;
284
- function s(a) {
285
- return function(l) {
286
- return f([a, l]);
54
+ }), s;
55
+ function c(u) {
56
+ return function(f) {
57
+ return a([u, f]);
287
58
  };
288
59
  }
289
- function f(a) {
60
+ function a(u) {
290
61
  if (r) throw new TypeError("Generator is already executing.");
291
- for (; u && (u = 0, a[0] && (e = 0)), e; ) try {
292
- if (r = 1, i && (o = a[0] & 2 ? i.return : a[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, a[1])).done) return o;
293
- switch (i = 0, o && (a = [a[0] & 2, o.value]), a[0]) {
62
+ for (; s && (s = 0, u[0] && (e = 0)), e; ) try {
63
+ if (r = 1, i && (o = u[0] & 2 ? i.return : u[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, u[1])).done) return o;
64
+ switch (i = 0, o && (u = [u[0] & 2, o.value]), u[0]) {
294
65
  case 0:
295
66
  case 1:
296
- o = a;
67
+ o = u;
297
68
  break;
298
69
  case 4:
299
- return e.label++, { value: a[1], done: !1 };
70
+ return e.label++, { value: u[1], done: !1 };
300
71
  case 5:
301
- e.label++, i = a[1], a = [0];
72
+ e.label++, i = u[1], u = [0];
302
73
  continue;
303
74
  case 7:
304
- a = e.ops.pop(), e.trys.pop();
75
+ u = e.ops.pop(), e.trys.pop();
305
76
  continue;
306
77
  default:
307
- if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (a[0] === 6 || a[0] === 2)) {
78
+ if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
308
79
  e = 0;
309
80
  continue;
310
81
  }
311
- if (a[0] === 3 && (!o || a[1] > o[0] && a[1] < o[3])) {
312
- e.label = a[1];
82
+ if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
83
+ e.label = u[1];
313
84
  break;
314
85
  }
315
- if (a[0] === 6 && e.label < o[1]) {
316
- e.label = o[1], o = a;
86
+ if (u[0] === 6 && e.label < o[1]) {
87
+ e.label = o[1], o = u;
317
88
  break;
318
89
  }
319
90
  if (o && e.label < o[2]) {
320
- e.label = o[2], e.ops.push(a);
91
+ e.label = o[2], e.ops.push(u);
321
92
  break;
322
93
  }
323
94
  o[2] && e.ops.pop(), e.trys.pop();
324
95
  continue;
325
96
  }
326
- a = n.call(t, e);
327
- } catch (l) {
328
- a = [6, l], i = 0;
97
+ u = t.call(n, e);
98
+ } catch (f) {
99
+ u = [6, f], i = 0;
329
100
  } finally {
330
101
  r = o = 0;
331
102
  }
332
- if (a[0] & 5) throw a[1];
333
- return { value: a[0] ? a[1] : void 0, done: !0 };
103
+ if (u[0] & 5) throw u[1];
104
+ return { value: u[0] ? u[1] : void 0, done: !0 };
334
105
  }
335
106
  }
336
- function T(t) {
337
- var n = typeof Symbol == "function" && Symbol.iterator, e = n && t[n], r = 0;
338
- if (e) return e.call(t);
339
- if (t && typeof t.length == "number") return {
107
+ function M(n) {
108
+ var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], r = 0;
109
+ if (e) return e.call(n);
110
+ if (n && typeof n.length == "number") return {
340
111
  next: function() {
341
- return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t };
112
+ return n && r >= n.length && (n = void 0), { value: n && n[r++], done: !n };
342
113
  }
343
114
  };
344
- throw new TypeError(n ? "Object is not iterable." : "Symbol.iterator is not defined.");
115
+ throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
345
116
  }
346
- function $(t, n) {
347
- var e = typeof Symbol == "function" && t[Symbol.iterator];
348
- if (!e) return t;
349
- var r = e.call(t), i, o = [], u;
117
+ function L(n, t) {
118
+ var e = typeof Symbol == "function" && n[Symbol.iterator];
119
+ if (!e) return n;
120
+ var r = e.call(n), i, o = [], s;
350
121
  try {
351
- for (; (n === void 0 || n-- > 0) && !(i = r.next()).done; ) o.push(i.value);
352
- } catch (s) {
353
- u = { error: s };
122
+ for (; (t === void 0 || t-- > 0) && !(i = r.next()).done; ) o.push(i.value);
123
+ } catch (c) {
124
+ s = { error: c };
354
125
  } finally {
355
126
  try {
356
127
  i && !i.done && (e = r.return) && e.call(r);
357
128
  } finally {
358
- if (u) throw u.error;
129
+ if (s) throw s.error;
359
130
  }
360
131
  }
361
132
  return o;
362
133
  }
363
- function D(t, n, e) {
364
- if (e || arguments.length === 2) for (var r = 0, i = n.length, o; r < i; r++)
365
- (o || !(r in n)) && (o || (o = Array.prototype.slice.call(n, 0, r)), o[r] = n[r]);
366
- return t.concat(o || Array.prototype.slice.call(n));
134
+ function R(n, t, e) {
135
+ if (e || arguments.length === 2) for (var r = 0, i = t.length, o; r < i; r++)
136
+ (o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
137
+ return n.concat(o || Array.prototype.slice.call(t));
367
138
  }
368
- function k(t) {
369
- return this instanceof k ? (this.v = t, this) : new k(t);
139
+ function P(n) {
140
+ return this instanceof P ? (this.v = n, this) : new P(n);
370
141
  }
371
- function it(t, n, e) {
142
+ function Ge(n, t, e) {
372
143
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
373
- var r = e.apply(t, n || []), i, o = [];
374
- return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), s("next"), s("throw"), s("return", u), i[Symbol.asyncIterator] = function() {
144
+ var r = e.apply(n, t || []), i, o = [];
145
+ return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), c("next"), c("throw"), c("return", s), i[Symbol.asyncIterator] = function() {
375
146
  return this;
376
147
  }, i;
377
- function u(c) {
378
- return function(p) {
379
- return Promise.resolve(p).then(c, y);
148
+ function s(l) {
149
+ return function(v) {
150
+ return Promise.resolve(v).then(l, y);
380
151
  };
381
152
  }
382
- function s(c, p) {
383
- r[c] && (i[c] = function(h) {
384
- return new Promise(function(O, w) {
385
- o.push([c, h, O, w]) > 1 || f(c, h);
153
+ function c(l, v) {
154
+ r[l] && (i[l] = function(d) {
155
+ return new Promise(function(g, w) {
156
+ o.push([l, d, g, w]) > 1 || a(l, d);
386
157
  });
387
- }, p && (i[c] = p(i[c])));
158
+ }, v && (i[l] = v(i[l])));
388
159
  }
389
- function f(c, p) {
160
+ function a(l, v) {
390
161
  try {
391
- a(r[c](p));
392
- } catch (h) {
393
- m(o[0][3], h);
162
+ u(r[l](v));
163
+ } catch (d) {
164
+ b(o[0][3], d);
394
165
  }
395
166
  }
396
- function a(c) {
397
- c.value instanceof k ? Promise.resolve(c.value.v).then(l, y) : m(o[0][2], c);
167
+ function u(l) {
168
+ l.value instanceof P ? Promise.resolve(l.value.v).then(f, y) : b(o[0][2], l);
398
169
  }
399
- function l(c) {
400
- f("next", c);
170
+ function f(l) {
171
+ a("next", l);
401
172
  }
402
- function y(c) {
403
- f("throw", c);
173
+ function y(l) {
174
+ a("throw", l);
404
175
  }
405
- function m(c, p) {
406
- c(p), o.shift(), o.length && f(o[0][0], o[0][1]);
176
+ function b(l, v) {
177
+ l(v), o.shift(), o.length && a(o[0][0], o[0][1]);
407
178
  }
408
179
  }
409
- function ot(t) {
180
+ function Fe(n) {
410
181
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
411
- var n = t[Symbol.asyncIterator], e;
412
- return n ? n.call(t) : (t = typeof T == "function" ? T(t) : t[Symbol.iterator](), e = {}, r("next"), r("throw"), r("return"), e[Symbol.asyncIterator] = function() {
182
+ var t = n[Symbol.asyncIterator], e;
183
+ return t ? t.call(n) : (n = typeof M == "function" ? M(n) : n[Symbol.iterator](), e = {}, r("next"), r("throw"), r("return"), e[Symbol.asyncIterator] = function() {
413
184
  return this;
414
185
  }, e);
415
186
  function r(o) {
416
- e[o] = t[o] && function(u) {
417
- return new Promise(function(s, f) {
418
- u = t[o](u), i(s, f, u.done, u.value);
187
+ e[o] = n[o] && function(s) {
188
+ return new Promise(function(c, a) {
189
+ s = n[o](s), i(c, a, s.done, s.value);
419
190
  });
420
191
  };
421
192
  }
422
- function i(o, u, s, f) {
423
- Promise.resolve(f).then(function(a) {
424
- o({ value: a, done: s });
425
- }, u);
193
+ function i(o, s, c, a) {
194
+ Promise.resolve(a).then(function(u) {
195
+ o({ value: u, done: c });
196
+ }, s);
426
197
  }
427
198
  }
428
- function v(t) {
429
- return typeof t == "function";
199
+ function p(n) {
200
+ return typeof n == "function";
430
201
  }
431
- function ge(t) {
432
- var n = function(r) {
202
+ function fe(n) {
203
+ var t = function(r) {
433
204
  Error.call(r), r.stack = new Error().stack;
434
- }, e = t(n);
205
+ }, e = n(t);
435
206
  return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
436
207
  }
437
- var V = ge(function(t) {
208
+ var B = fe(function(n) {
438
209
  return function(e) {
439
- t(this), this.message = e ? e.length + ` errors occurred during unsubscription:
210
+ n(this), this.message = e ? e.length + ` errors occurred during unsubscription:
440
211
  ` + e.map(function(r, i) {
441
212
  return i + 1 + ") " + r.toString();
442
213
  }).join(`
443
214
  `) : "", this.name = "UnsubscriptionError", this.errors = e;
444
215
  };
445
216
  });
446
- function F(t, n) {
447
- if (t) {
448
- var e = t.indexOf(n);
449
- 0 <= e && t.splice(e, 1);
217
+ function N(n, t) {
218
+ if (n) {
219
+ var e = n.indexOf(t);
220
+ 0 <= e && n.splice(e, 1);
450
221
  }
451
222
  }
452
- var N = function() {
453
- function t(n) {
454
- this.initialTeardown = n, this.closed = !1, this._parentage = null, this._finalizers = null;
223
+ var k = function() {
224
+ function n(t) {
225
+ this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
455
226
  }
456
- return t.prototype.unsubscribe = function() {
457
- var n, e, r, i, o;
227
+ return n.prototype.unsubscribe = function() {
228
+ var t, e, r, i, o;
458
229
  if (!this.closed) {
459
230
  this.closed = !0;
460
- var u = this._parentage;
461
- if (u)
462
- if (this._parentage = null, Array.isArray(u))
231
+ var s = this._parentage;
232
+ if (s)
233
+ if (this._parentage = null, Array.isArray(s))
463
234
  try {
464
- for (var s = T(u), f = s.next(); !f.done; f = s.next()) {
465
- var a = f.value;
466
- a.remove(this);
235
+ for (var c = M(s), a = c.next(); !a.done; a = c.next()) {
236
+ var u = a.value;
237
+ u.remove(this);
467
238
  }
468
- } catch (h) {
469
- n = { error: h };
239
+ } catch (d) {
240
+ t = { error: d };
470
241
  } finally {
471
242
  try {
472
- f && !f.done && (e = s.return) && e.call(s);
243
+ a && !a.done && (e = c.return) && e.call(c);
473
244
  } finally {
474
- if (n) throw n.error;
245
+ if (t) throw t.error;
475
246
  }
476
247
  }
477
248
  else
478
- u.remove(this);
479
- var l = this.initialTeardown;
480
- if (v(l))
249
+ s.remove(this);
250
+ var f = this.initialTeardown;
251
+ if (p(f))
481
252
  try {
482
- l();
483
- } catch (h) {
484
- o = h instanceof V ? h.errors : [h];
253
+ f();
254
+ } catch (d) {
255
+ o = d instanceof B ? d.errors : [d];
485
256
  }
486
257
  var y = this._finalizers;
487
258
  if (y) {
488
259
  this._finalizers = null;
489
260
  try {
490
- for (var m = T(y), c = m.next(); !c.done; c = m.next()) {
491
- var p = c.value;
261
+ for (var b = M(y), l = b.next(); !l.done; l = b.next()) {
262
+ var v = l.value;
492
263
  try {
493
- te(p);
494
- } catch (h) {
495
- o = o ?? [], h instanceof V ? o = D(D([], $(o)), $(h.errors)) : o.push(h);
264
+ ee(v);
265
+ } catch (d) {
266
+ o = o ?? [], d instanceof B ? o = R(R([], L(o)), L(d.errors)) : o.push(d);
496
267
  }
497
268
  }
498
- } catch (h) {
499
- r = { error: h };
269
+ } catch (d) {
270
+ r = { error: d };
500
271
  } finally {
501
272
  try {
502
- c && !c.done && (i = m.return) && i.call(m);
273
+ l && !l.done && (i = b.return) && i.call(b);
503
274
  } finally {
504
275
  if (r) throw r.error;
505
276
  }
506
277
  }
507
278
  }
508
279
  if (o)
509
- throw new V(o);
280
+ throw new B(o);
510
281
  }
511
- }, t.prototype.add = function(n) {
282
+ }, n.prototype.add = function(t) {
512
283
  var e;
513
- if (n && n !== this)
284
+ if (t && t !== this)
514
285
  if (this.closed)
515
- te(n);
286
+ ee(t);
516
287
  else {
517
- if (n instanceof t) {
518
- if (n.closed || n._hasParent(this))
288
+ if (t instanceof n) {
289
+ if (t.closed || t._hasParent(this))
519
290
  return;
520
- n._addParent(this);
291
+ t._addParent(this);
521
292
  }
522
- (this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(n);
293
+ (this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(t);
523
294
  }
524
- }, t.prototype._hasParent = function(n) {
295
+ }, n.prototype._hasParent = function(t) {
525
296
  var e = this._parentage;
526
- return e === n || Array.isArray(e) && e.includes(n);
527
- }, t.prototype._addParent = function(n) {
297
+ return e === t || Array.isArray(e) && e.includes(t);
298
+ }, n.prototype._addParent = function(t) {
528
299
  var e = this._parentage;
529
- this._parentage = Array.isArray(e) ? (e.push(n), e) : e ? [e, n] : n;
530
- }, t.prototype._removeParent = function(n) {
300
+ this._parentage = Array.isArray(e) ? (e.push(t), e) : e ? [e, t] : t;
301
+ }, n.prototype._removeParent = function(t) {
531
302
  var e = this._parentage;
532
- e === n ? this._parentage = null : Array.isArray(e) && F(e, n);
533
- }, t.prototype.remove = function(n) {
303
+ e === t ? this._parentage = null : Array.isArray(e) && N(e, t);
304
+ }, n.prototype.remove = function(t) {
534
305
  var e = this._finalizers;
535
- e && F(e, n), n instanceof t && n._removeParent(this);
536
- }, t.EMPTY = function() {
537
- var n = new t();
538
- return n.closed = !0, n;
539
- }(), t;
540
- }(), Ee = N.EMPTY;
541
- function Se(t) {
542
- return t instanceof N || t && "closed" in t && v(t.remove) && v(t.add) && v(t.unsubscribe);
543
- }
544
- function te(t) {
545
- v(t) ? t() : t.unsubscribe();
546
- }
547
- var ut = {
306
+ e && N(e, t), t instanceof n && t._removeParent(this);
307
+ }, n.EMPTY = function() {
308
+ var t = new n();
309
+ return t.closed = !0, t;
310
+ }(), n;
311
+ }(), le = k.EMPTY;
312
+ function de(n) {
313
+ return n instanceof k || n && "closed" in n && p(n.remove) && p(n.add) && p(n.unsubscribe);
314
+ }
315
+ function ee(n) {
316
+ p(n) ? n() : n.unsubscribe();
317
+ }
318
+ var He = {
548
319
  onUnhandledError: null,
549
320
  onStoppedNotification: null,
550
321
  Promise: void 0,
551
322
  useDeprecatedSynchronousErrorHandling: !1,
552
323
  useDeprecatedNextContext: !1
553
- }, Oe = {
554
- setTimeout: function(t, n) {
324
+ }, he = {
325
+ setTimeout: function(n, t) {
555
326
  for (var e = [], r = 2; r < arguments.length; r++)
556
327
  e[r - 2] = arguments[r];
557
- return setTimeout.apply(void 0, D([t, n], $(e)));
328
+ return setTimeout.apply(void 0, R([n, t], L(e)));
558
329
  },
559
- clearTimeout: function(t) {
560
- var n = Oe.delegate;
561
- return ((n == null ? void 0 : n.clearTimeout) || clearTimeout)(t);
330
+ clearTimeout: function(n) {
331
+ var t = he.delegate;
332
+ return ((t == null ? void 0 : t.clearTimeout) || clearTimeout)(n);
562
333
  },
563
334
  delegate: void 0
564
335
  };
565
- function _e(t) {
566
- Oe.setTimeout(function() {
567
- throw t;
336
+ function ye(n) {
337
+ he.setTimeout(function() {
338
+ throw n;
568
339
  });
569
340
  }
570
- function B() {
341
+ function q() {
571
342
  }
572
- function M(t) {
573
- t();
343
+ function U(n) {
344
+ n();
574
345
  }
575
- var X = function(t) {
576
- S(n, t);
577
- function n(e) {
578
- var r = t.call(this) || this;
579
- return r.isStopped = !1, e ? (r.destination = e, Se(e) && e.add(r)) : r.destination = ft, r;
346
+ var X = function(n) {
347
+ O(t, n);
348
+ function t(e) {
349
+ var r = n.call(this) || this;
350
+ return r.isStopped = !1, e ? (r.destination = e, de(e) && e.add(r)) : r.destination = Ke, r;
580
351
  }
581
- return n.create = function(e, r, i) {
582
- return new K(e, r, i);
583
- }, n.prototype.next = function(e) {
352
+ return t.create = function(e, r, i) {
353
+ return new W(e, r, i);
354
+ }, t.prototype.next = function(e) {
584
355
  this.isStopped || this._next(e);
585
- }, n.prototype.error = function(e) {
356
+ }, t.prototype.error = function(e) {
586
357
  this.isStopped || (this.isStopped = !0, this._error(e));
587
- }, n.prototype.complete = function() {
358
+ }, t.prototype.complete = function() {
588
359
  this.isStopped || (this.isStopped = !0, this._complete());
589
- }, n.prototype.unsubscribe = function() {
590
- this.closed || (this.isStopped = !0, t.prototype.unsubscribe.call(this), this.destination = null);
591
- }, n.prototype._next = function(e) {
360
+ }, t.prototype.unsubscribe = function() {
361
+ this.closed || (this.isStopped = !0, n.prototype.unsubscribe.call(this), this.destination = null);
362
+ }, t.prototype._next = function(e) {
592
363
  this.destination.next(e);
593
- }, n.prototype._error = function(e) {
364
+ }, t.prototype._error = function(e) {
594
365
  try {
595
366
  this.destination.error(e);
596
367
  } finally {
597
368
  this.unsubscribe();
598
369
  }
599
- }, n.prototype._complete = function() {
370
+ }, t.prototype._complete = function() {
600
371
  try {
601
372
  this.destination.complete();
602
373
  } finally {
603
374
  this.unsubscribe();
604
375
  }
605
- }, n;
606
- }(N), st = function() {
607
- function t(n) {
608
- this.partialObserver = n;
376
+ }, t;
377
+ }(k), Ve = function() {
378
+ function n(t) {
379
+ this.partialObserver = t;
609
380
  }
610
- return t.prototype.next = function(n) {
381
+ return n.prototype.next = function(t) {
611
382
  var e = this.partialObserver;
612
383
  if (e.next)
613
384
  try {
614
- e.next(n);
385
+ e.next(t);
615
386
  } catch (r) {
616
- R(r);
387
+ D(r);
617
388
  }
618
- }, t.prototype.error = function(n) {
389
+ }, n.prototype.error = function(t) {
619
390
  var e = this.partialObserver;
620
391
  if (e.error)
621
392
  try {
622
- e.error(n);
393
+ e.error(t);
623
394
  } catch (r) {
624
- R(r);
395
+ D(r);
625
396
  }
626
397
  else
627
- R(n);
628
- }, t.prototype.complete = function() {
629
- var n = this.partialObserver;
630
- if (n.complete)
398
+ D(t);
399
+ }, n.prototype.complete = function() {
400
+ var t = this.partialObserver;
401
+ if (t.complete)
631
402
  try {
632
- n.complete();
403
+ t.complete();
633
404
  } catch (e) {
634
- R(e);
405
+ D(e);
635
406
  }
636
- }, t;
637
- }(), K = function(t) {
638
- S(n, t);
639
- function n(e, r, i) {
640
- var o = t.call(this) || this, u;
641
- return v(e) || !e ? u = {
407
+ }, n;
408
+ }(), W = function(n) {
409
+ O(t, n);
410
+ function t(e, r, i) {
411
+ var o = n.call(this) || this, s;
412
+ return p(e) || !e ? s = {
642
413
  next: e ?? void 0,
643
414
  error: r ?? void 0,
644
415
  complete: i ?? void 0
645
- } : u = e, o.destination = new st(u), o;
416
+ } : s = e, o.destination = new Ve(s), o;
646
417
  }
647
- return n;
418
+ return t;
648
419
  }(X);
649
- function R(t) {
650
- _e(t);
420
+ function D(n) {
421
+ ye(n);
651
422
  }
652
- function at(t) {
653
- throw t;
423
+ function Be(n) {
424
+ throw n;
654
425
  }
655
- var ft = {
426
+ var Ke = {
656
427
  closed: !0,
657
- next: B,
658
- error: at,
659
- complete: B
660
- }, Q = function() {
428
+ next: q,
429
+ error: Be,
430
+ complete: q
431
+ }, z = function() {
661
432
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
662
433
  }();
663
- function ct(t) {
664
- return t;
434
+ function G(n) {
435
+ return n;
665
436
  }
666
- function lt(t) {
667
- return t.length === 0 ? ct : t.length === 1 ? t[0] : function(e) {
668
- return t.reduce(function(r, i) {
437
+ function Ye(n) {
438
+ return n.length === 0 ? G : n.length === 1 ? n[0] : function(e) {
439
+ return n.reduce(function(r, i) {
669
440
  return i(r);
670
441
  }, e);
671
442
  };
672
443
  }
673
- var b = function() {
674
- function t(n) {
675
- n && (this._subscribe = n);
444
+ var S = function() {
445
+ function n(t) {
446
+ t && (this._subscribe = t);
676
447
  }
677
- return t.prototype.lift = function(n) {
678
- var e = new t();
679
- return e.source = this, e.operator = n, e;
680
- }, t.prototype.subscribe = function(n, e, r) {
681
- var i = this, o = ht(n) ? n : new K(n, e, r);
682
- return M(function() {
683
- var u = i, s = u.operator, f = u.source;
684
- o.add(s ? s.call(o, f) : f ? i._subscribe(o) : i._trySubscribe(o));
448
+ return n.prototype.lift = function(t) {
449
+ var e = new n();
450
+ return e.source = this, e.operator = t, e;
451
+ }, n.prototype.subscribe = function(t, e, r) {
452
+ var i = this, o = We(t) ? t : new W(t, e, r);
453
+ return U(function() {
454
+ var s = i, c = s.operator, a = s.source;
455
+ o.add(c ? c.call(o, a) : a ? i._subscribe(o) : i._trySubscribe(o));
685
456
  }), o;
686
- }, t.prototype._trySubscribe = function(n) {
457
+ }, n.prototype._trySubscribe = function(t) {
687
458
  try {
688
- return this._subscribe(n);
459
+ return this._subscribe(t);
689
460
  } catch (e) {
690
- n.error(e);
461
+ t.error(e);
691
462
  }
692
- }, t.prototype.forEach = function(n, e) {
463
+ }, n.prototype.forEach = function(t, e) {
693
464
  var r = this;
694
- return e = ne(e), new e(function(i, o) {
695
- var u = new K({
696
- next: function(s) {
465
+ return e = te(e), new e(function(i, o) {
466
+ var s = new W({
467
+ next: function(c) {
697
468
  try {
698
- n(s);
699
- } catch (f) {
700
- o(f), u.unsubscribe();
469
+ t(c);
470
+ } catch (a) {
471
+ o(a), s.unsubscribe();
701
472
  }
702
473
  },
703
474
  error: o,
704
475
  complete: i
705
476
  });
706
- r.subscribe(u);
477
+ r.subscribe(s);
707
478
  });
708
- }, t.prototype._subscribe = function(n) {
479
+ }, n.prototype._subscribe = function(t) {
709
480
  var e;
710
- return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(n);
711
- }, t.prototype[Q] = function() {
481
+ return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(t);
482
+ }, n.prototype[z] = function() {
712
483
  return this;
713
- }, t.prototype.pipe = function() {
714
- for (var n = [], e = 0; e < arguments.length; e++)
715
- n[e] = arguments[e];
716
- return lt(n)(this);
717
- }, t.prototype.toPromise = function(n) {
484
+ }, n.prototype.pipe = function() {
485
+ for (var t = [], e = 0; e < arguments.length; e++)
486
+ t[e] = arguments[e];
487
+ return Ye(t)(this);
488
+ }, n.prototype.toPromise = function(t) {
718
489
  var e = this;
719
- return n = ne(n), new n(function(r, i) {
490
+ return t = te(t), new t(function(r, i) {
720
491
  var o;
721
- e.subscribe(function(u) {
722
- return o = u;
723
- }, function(u) {
724
- return i(u);
492
+ e.subscribe(function(s) {
493
+ return o = s;
494
+ }, function(s) {
495
+ return i(s);
725
496
  }, function() {
726
497
  return r(o);
727
498
  });
728
499
  });
729
- }, t.create = function(n) {
730
- return new t(n);
731
- }, t;
500
+ }, n.create = function(t) {
501
+ return new n(t);
502
+ }, n;
732
503
  }();
733
- function ne(t) {
734
- var n;
735
- return (n = t ?? ut.Promise) !== null && n !== void 0 ? n : Promise;
504
+ function te(n) {
505
+ var t;
506
+ return (t = n ?? He.Promise) !== null && t !== void 0 ? t : Promise;
736
507
  }
737
- function dt(t) {
738
- return t && v(t.next) && v(t.error) && v(t.complete);
508
+ function qe(n) {
509
+ return n && p(n.next) && p(n.error) && p(n.complete);
739
510
  }
740
- function ht(t) {
741
- return t && t instanceof X || dt(t) && Se(t);
511
+ function We(n) {
512
+ return n && n instanceof X || qe(n) && de(n);
742
513
  }
743
- function vt(t) {
744
- return v(t == null ? void 0 : t.lift);
514
+ function Je(n) {
515
+ return p(n == null ? void 0 : n.lift);
745
516
  }
746
- function L(t) {
747
- return function(n) {
748
- if (vt(n))
749
- return n.lift(function(e) {
517
+ function T(n) {
518
+ return function(t) {
519
+ if (Je(t))
520
+ return t.lift(function(e) {
750
521
  try {
751
- return t(e, this);
522
+ return n(e, this);
752
523
  } catch (r) {
753
524
  this.error(r);
754
525
  }
@@ -756,189 +527,212 @@ function L(t) {
756
527
  throw new TypeError("Unable to lift unknown Observable type");
757
528
  };
758
529
  }
759
- function P(t, n, e, r, i) {
760
- return new pt(t, n, e, r, i);
530
+ function E(n, t, e, r, i) {
531
+ return new Xe(n, t, e, r, i);
761
532
  }
762
- var pt = function(t) {
763
- S(n, t);
764
- function n(e, r, i, o, u, s) {
765
- var f = t.call(this, e) || this;
766
- return f.onFinalize = u, f.shouldUnsubscribe = s, f._next = r ? function(a) {
533
+ var Xe = function(n) {
534
+ O(t, n);
535
+ function t(e, r, i, o, s, c) {
536
+ var a = n.call(this, e) || this;
537
+ return a.onFinalize = s, a.shouldUnsubscribe = c, a._next = r ? function(u) {
767
538
  try {
768
- r(a);
769
- } catch (l) {
770
- e.error(l);
539
+ r(u);
540
+ } catch (f) {
541
+ e.error(f);
771
542
  }
772
- } : t.prototype._next, f._error = o ? function(a) {
543
+ } : n.prototype._next, a._error = o ? function(u) {
773
544
  try {
774
- o(a);
775
- } catch (l) {
776
- e.error(l);
545
+ o(u);
546
+ } catch (f) {
547
+ e.error(f);
777
548
  } finally {
778
549
  this.unsubscribe();
779
550
  }
780
- } : t.prototype._error, f._complete = i ? function() {
551
+ } : n.prototype._error, a._complete = i ? function() {
781
552
  try {
782
553
  i();
783
- } catch (a) {
784
- e.error(a);
554
+ } catch (u) {
555
+ e.error(u);
785
556
  } finally {
786
557
  this.unsubscribe();
787
558
  }
788
- } : t.prototype._complete, f;
559
+ } : n.prototype._complete, a;
789
560
  }
790
- return n.prototype.unsubscribe = function() {
561
+ return t.prototype.unsubscribe = function() {
791
562
  var e;
792
563
  if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
793
564
  var r = this.closed;
794
- t.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
565
+ n.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
795
566
  }
796
- }, n;
797
- }(X), yt = ge(function(t) {
567
+ }, t;
568
+ }(X), ze = fe(function(n) {
798
569
  return function() {
799
- t(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
570
+ n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
800
571
  };
801
- }), xe = function(t) {
802
- S(n, t);
803
- function n() {
804
- var e = t.call(this) || this;
572
+ }), Q = function(n) {
573
+ O(t, n);
574
+ function t() {
575
+ var e = n.call(this) || this;
805
576
  return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
806
577
  }
807
- return n.prototype.lift = function(e) {
808
- var r = new re(this, this);
578
+ return t.prototype.lift = function(e) {
579
+ var r = new ne(this, this);
809
580
  return r.operator = e, r;
810
- }, n.prototype._throwIfClosed = function() {
581
+ }, t.prototype._throwIfClosed = function() {
811
582
  if (this.closed)
812
- throw new yt();
813
- }, n.prototype.next = function(e) {
583
+ throw new ze();
584
+ }, t.prototype.next = function(e) {
814
585
  var r = this;
815
- M(function() {
586
+ U(function() {
816
587
  var i, o;
817
588
  if (r._throwIfClosed(), !r.isStopped) {
818
589
  r.currentObservers || (r.currentObservers = Array.from(r.observers));
819
590
  try {
820
- for (var u = T(r.currentObservers), s = u.next(); !s.done; s = u.next()) {
821
- var f = s.value;
822
- f.next(e);
591
+ for (var s = M(r.currentObservers), c = s.next(); !c.done; c = s.next()) {
592
+ var a = c.value;
593
+ a.next(e);
823
594
  }
824
- } catch (a) {
825
- i = { error: a };
595
+ } catch (u) {
596
+ i = { error: u };
826
597
  } finally {
827
598
  try {
828
- s && !s.done && (o = u.return) && o.call(u);
599
+ c && !c.done && (o = s.return) && o.call(s);
829
600
  } finally {
830
601
  if (i) throw i.error;
831
602
  }
832
603
  }
833
604
  }
834
605
  });
835
- }, n.prototype.error = function(e) {
606
+ }, t.prototype.error = function(e) {
836
607
  var r = this;
837
- M(function() {
608
+ U(function() {
838
609
  if (r._throwIfClosed(), !r.isStopped) {
839
610
  r.hasError = r.isStopped = !0, r.thrownError = e;
840
611
  for (var i = r.observers; i.length; )
841
612
  i.shift().error(e);
842
613
  }
843
614
  });
844
- }, n.prototype.complete = function() {
615
+ }, t.prototype.complete = function() {
845
616
  var e = this;
846
- M(function() {
617
+ U(function() {
847
618
  if (e._throwIfClosed(), !e.isStopped) {
848
619
  e.isStopped = !0;
849
620
  for (var r = e.observers; r.length; )
850
621
  r.shift().complete();
851
622
  }
852
623
  });
853
- }, n.prototype.unsubscribe = function() {
624
+ }, t.prototype.unsubscribe = function() {
854
625
  this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
855
- }, Object.defineProperty(n.prototype, "observed", {
626
+ }, Object.defineProperty(t.prototype, "observed", {
856
627
  get: function() {
857
628
  var e;
858
629
  return ((e = this.observers) === null || e === void 0 ? void 0 : e.length) > 0;
859
630
  },
860
631
  enumerable: !1,
861
632
  configurable: !0
862
- }), n.prototype._trySubscribe = function(e) {
863
- return this._throwIfClosed(), t.prototype._trySubscribe.call(this, e);
864
- }, n.prototype._subscribe = function(e) {
633
+ }), t.prototype._trySubscribe = function(e) {
634
+ return this._throwIfClosed(), n.prototype._trySubscribe.call(this, e);
635
+ }, t.prototype._subscribe = function(e) {
865
636
  return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
866
- }, n.prototype._innerSubscribe = function(e) {
867
- var r = this, i = this, o = i.hasError, u = i.isStopped, s = i.observers;
868
- return o || u ? Ee : (this.currentObservers = null, s.push(e), new N(function() {
869
- r.currentObservers = null, F(s, e);
637
+ }, t.prototype._innerSubscribe = function(e) {
638
+ var r = this, i = this, o = i.hasError, s = i.isStopped, c = i.observers;
639
+ return o || s ? le : (this.currentObservers = null, c.push(e), new k(function() {
640
+ r.currentObservers = null, N(c, e);
870
641
  }));
871
- }, n.prototype._checkFinalizedStatuses = function(e) {
872
- var r = this, i = r.hasError, o = r.thrownError, u = r.isStopped;
873
- i ? e.error(o) : u && e.complete();
874
- }, n.prototype.asObservable = function() {
875
- var e = new b();
642
+ }, t.prototype._checkFinalizedStatuses = function(e) {
643
+ var r = this, i = r.hasError, o = r.thrownError, s = r.isStopped;
644
+ i ? e.error(o) : s && e.complete();
645
+ }, t.prototype.asObservable = function() {
646
+ var e = new S();
876
647
  return e.source = this, e;
877
- }, n.create = function(e, r) {
878
- return new re(e, r);
879
- }, n;
880
- }(b), re = function(t) {
881
- S(n, t);
882
- function n(e, r) {
883
- var i = t.call(this) || this;
648
+ }, t.create = function(e, r) {
649
+ return new ne(e, r);
650
+ }, t;
651
+ }(S), ne = function(n) {
652
+ O(t, n);
653
+ function t(e, r) {
654
+ var i = n.call(this) || this;
884
655
  return i.destination = e, i.source = r, i;
885
656
  }
886
- return n.prototype.next = function(e) {
657
+ return t.prototype.next = function(e) {
887
658
  var r, i;
888
659
  (i = (r = this.destination) === null || r === void 0 ? void 0 : r.next) === null || i === void 0 || i.call(r, e);
889
- }, n.prototype.error = function(e) {
660
+ }, t.prototype.error = function(e) {
890
661
  var r, i;
891
662
  (i = (r = this.destination) === null || r === void 0 ? void 0 : r.error) === null || i === void 0 || i.call(r, e);
892
- }, n.prototype.complete = function() {
663
+ }, t.prototype.complete = function() {
893
664
  var e, r;
894
665
  (r = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || r === void 0 || r.call(e);
895
- }, n.prototype._subscribe = function(e) {
666
+ }, t.prototype._subscribe = function(e) {
896
667
  var r, i;
897
- return (i = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && i !== void 0 ? i : Ee;
898
- }, n;
899
- }(xe), bt = {
668
+ return (i = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && i !== void 0 ? i : le;
669
+ }, t;
670
+ }(Q), re = function(n) {
671
+ O(t, n);
672
+ function t(e) {
673
+ var r = n.call(this) || this;
674
+ return r._value = e, r;
675
+ }
676
+ return Object.defineProperty(t.prototype, "value", {
677
+ get: function() {
678
+ return this.getValue();
679
+ },
680
+ enumerable: !1,
681
+ configurable: !0
682
+ }), t.prototype._subscribe = function(e) {
683
+ var r = n.prototype._subscribe.call(this, e);
684
+ return !r.closed && e.next(this._value), r;
685
+ }, t.prototype.getValue = function() {
686
+ var e = this, r = e.hasError, i = e.thrownError, o = e._value;
687
+ if (r)
688
+ throw i;
689
+ return this._throwIfClosed(), o;
690
+ }, t.prototype.next = function(e) {
691
+ n.prototype.next.call(this, this._value = e);
692
+ }, t;
693
+ }(Q), Qe = {
900
694
  now: function() {
901
695
  return Date.now();
902
696
  },
903
697
  delegate: void 0
904
- }, mt = function(t) {
905
- S(n, t);
906
- function n(e, r) {
907
- return t.call(this) || this;
698
+ }, Ze = function(n) {
699
+ O(t, n);
700
+ function t(e, r) {
701
+ return n.call(this) || this;
908
702
  }
909
- return n.prototype.schedule = function(e, r) {
703
+ return t.prototype.schedule = function(e, r) {
910
704
  return this;
911
- }, n;
912
- }(N), ie = {
913
- setInterval: function(t, n) {
705
+ }, t;
706
+ }(k), ie = {
707
+ setInterval: function(n, t) {
914
708
  for (var e = [], r = 2; r < arguments.length; r++)
915
709
  e[r - 2] = arguments[r];
916
- return setInterval.apply(void 0, D([t, n], $(e)));
710
+ return setInterval.apply(void 0, R([n, t], L(e)));
917
711
  },
918
- clearInterval: function(t) {
919
- return clearInterval(t);
712
+ clearInterval: function(n) {
713
+ return clearInterval(n);
920
714
  },
921
715
  delegate: void 0
922
- }, wt = function(t) {
923
- S(n, t);
924
- function n(e, r) {
925
- var i = t.call(this, e, r) || this;
716
+ }, et = function(n) {
717
+ O(t, n);
718
+ function t(e, r) {
719
+ var i = n.call(this, e, r) || this;
926
720
  return i.scheduler = e, i.work = r, i.pending = !1, i;
927
721
  }
928
- return n.prototype.schedule = function(e, r) {
722
+ return t.prototype.schedule = function(e, r) {
929
723
  var i;
930
724
  if (r === void 0 && (r = 0), this.closed)
931
725
  return this;
932
726
  this.state = e;
933
- var o = this.id, u = this.scheduler;
934
- return o != null && (this.id = this.recycleAsyncId(u, o, r)), this.pending = !0, this.delay = r, this.id = (i = this.id) !== null && i !== void 0 ? i : this.requestAsyncId(u, this.id, r), this;
935
- }, n.prototype.requestAsyncId = function(e, r, i) {
727
+ var o = this.id, s = this.scheduler;
728
+ return o != null && (this.id = this.recycleAsyncId(s, o, r)), this.pending = !0, this.delay = r, this.id = (i = this.id) !== null && i !== void 0 ? i : this.requestAsyncId(s, this.id, r), this;
729
+ }, t.prototype.requestAsyncId = function(e, r, i) {
936
730
  return i === void 0 && (i = 0), ie.setInterval(e.flush.bind(e, this), i);
937
- }, n.prototype.recycleAsyncId = function(e, r, i) {
731
+ }, t.prototype.recycleAsyncId = function(e, r, i) {
938
732
  if (i === void 0 && (i = 0), i != null && this.delay === i && this.pending === !1)
939
733
  return r;
940
734
  r != null && ie.clearInterval(r);
941
- }, n.prototype.execute = function(e, r) {
735
+ }, t.prototype.execute = function(e, r) {
942
736
  if (this.closed)
943
737
  return new Error("executing a cancelled action");
944
738
  this.pending = !1;
@@ -946,36 +740,36 @@ var pt = function(t) {
946
740
  if (i)
947
741
  return i;
948
742
  this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
949
- }, n.prototype._execute = function(e, r) {
743
+ }, t.prototype._execute = function(e, r) {
950
744
  var i = !1, o;
951
745
  try {
952
746
  this.work(e);
953
- } catch (u) {
954
- i = !0, o = u || new Error("Scheduled action threw falsy error");
747
+ } catch (s) {
748
+ i = !0, o = s || new Error("Scheduled action threw falsy error");
955
749
  }
956
750
  if (i)
957
751
  return this.unsubscribe(), o;
958
- }, n.prototype.unsubscribe = function() {
752
+ }, t.prototype.unsubscribe = function() {
959
753
  if (!this.closed) {
960
754
  var e = this, r = e.id, i = e.scheduler, o = i.actions;
961
- this.work = this.state = this.scheduler = null, this.pending = !1, F(o, this), r != null && (this.id = this.recycleAsyncId(i, r, null)), this.delay = null, t.prototype.unsubscribe.call(this);
755
+ this.work = this.state = this.scheduler = null, this.pending = !1, N(o, this), r != null && (this.id = this.recycleAsyncId(i, r, null)), this.delay = null, n.prototype.unsubscribe.call(this);
962
756
  }
963
- }, n;
964
- }(mt), oe = function() {
965
- function t(n, e) {
966
- e === void 0 && (e = t.now), this.schedulerActionCtor = n, this.now = e;
757
+ }, t;
758
+ }(Ze), oe = function() {
759
+ function n(t, e) {
760
+ e === void 0 && (e = n.now), this.schedulerActionCtor = t, this.now = e;
967
761
  }
968
- return t.prototype.schedule = function(n, e, r) {
969
- return e === void 0 && (e = 0), new this.schedulerActionCtor(this, n).schedule(r, e);
970
- }, t.now = bt.now, t;
971
- }(), gt = function(t) {
972
- S(n, t);
973
- function n(e, r) {
762
+ return n.prototype.schedule = function(t, e, r) {
763
+ return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(r, e);
764
+ }, n.now = Qe.now, n;
765
+ }(), tt = function(n) {
766
+ O(t, n);
767
+ function t(e, r) {
974
768
  r === void 0 && (r = oe.now);
975
- var i = t.call(this, e, r) || this;
769
+ var i = n.call(this, e, r) || this;
976
770
  return i.actions = [], i._active = !1, i;
977
771
  }
978
- return n.prototype.flush = function(e) {
772
+ return t.prototype.flush = function(e) {
979
773
  var r = this.actions;
980
774
  if (this._active) {
981
775
  r.push(e);
@@ -992,62 +786,65 @@ var pt = function(t) {
992
786
  e.unsubscribe();
993
787
  throw i;
994
788
  }
995
- }, n;
996
- }(oe), Le = new gt(wt), Et = Le, St = new b(function(t) {
997
- return t.complete();
789
+ }, t;
790
+ }(oe), ve = new tt(et), nt = ve, rt = new S(function(n) {
791
+ return n.complete();
998
792
  });
999
- function Ae(t) {
1000
- return t && v(t.schedule);
793
+ function pe(n) {
794
+ return n && p(n.schedule);
795
+ }
796
+ function be(n) {
797
+ return n[n.length - 1];
1001
798
  }
1002
- function Ot(t) {
1003
- return t[t.length - 1];
799
+ function it(n) {
800
+ return p(be(n)) ? n.pop() : void 0;
1004
801
  }
1005
- function _t(t) {
1006
- return Ae(Ot(t)) ? t.pop() : void 0;
802
+ function me(n) {
803
+ return pe(be(n)) ? n.pop() : void 0;
1007
804
  }
1008
- var Ie = function(t) {
1009
- return t && typeof t.length == "number" && typeof t != "function";
805
+ var Se = function(n) {
806
+ return n && typeof n.length == "number" && typeof n != "function";
1010
807
  };
1011
- function ke(t) {
1012
- return v(t == null ? void 0 : t.then);
808
+ function ge(n) {
809
+ return p(n == null ? void 0 : n.then);
1013
810
  }
1014
- function Te(t) {
1015
- return v(t[Q]);
811
+ function we(n) {
812
+ return p(n[z]);
1016
813
  }
1017
- function Pe(t) {
1018
- return Symbol.asyncIterator && v(t == null ? void 0 : t[Symbol.asyncIterator]);
814
+ function Ee(n) {
815
+ return Symbol.asyncIterator && p(n == null ? void 0 : n[Symbol.asyncIterator]);
1019
816
  }
1020
- function Ce(t) {
1021
- return new TypeError("You provided " + (t !== null && typeof t == "object" ? "an invalid object" : "'" + t + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
817
+ function Oe(n) {
818
+ return new TypeError("You provided " + (n !== null && typeof n == "object" ? "an invalid object" : "'" + n + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
1022
819
  }
1023
- function xt() {
820
+ function ot() {
1024
821
  return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
1025
822
  }
1026
- var Ne = xt();
1027
- function je(t) {
1028
- return v(t == null ? void 0 : t[Ne]);
823
+ var Ie = ot();
824
+ function Ae(n) {
825
+ return p(n == null ? void 0 : n[Ie]);
1029
826
  }
1030
- function Re(t) {
1031
- return it(this, arguments, function() {
827
+ function xe(n) {
828
+ return Ge(this, arguments, function() {
1032
829
  var e, r, i, o;
1033
- return we(this, function(u) {
1034
- switch (u.label) {
830
+ return ce(this, function(s) {
831
+ switch (s.label) {
1035
832
  case 0:
1036
- e = t.getReader(), u.label = 1;
833
+ e = n.getReader(), s.label = 1;
1037
834
  case 1:
1038
- u.trys.push([1, , 9, 10]), u.label = 2;
835
+ s.trys.push([1, , 9, 10]), s.label = 2;
1039
836
  case 2:
1040
- return [4, k(e.read())];
837
+ return [4, P(e.read())];
1041
838
  case 3:
1042
- return r = u.sent(), i = r.value, o = r.done, o ? [4, k(void 0)] : [3, 5];
839
+ return r = s.sent(), i = r.value, o = r.done, o ? [4, P(void 0)] : [3, 5];
1043
840
  case 4:
1044
- return [2, u.sent()];
841
+ return [2, s.sent()];
1045
842
  case 5:
1046
- return [4, k(i)];
843
+ return [4, P(i)];
1047
844
  case 6:
1048
- return [4, u.sent()];
845
+ return [4, s.sent()];
1049
846
  case 7:
1050
- return u.sent(), [3, 2];
847
+ return s.sent(), [3, 2];
1051
848
  case 8:
1052
849
  return [3, 10];
1053
850
  case 9:
@@ -1058,63 +855,63 @@ function Re(t) {
1058
855
  });
1059
856
  });
1060
857
  }
1061
- function Ue(t) {
1062
- return v(t == null ? void 0 : t.getReader);
1063
- }
1064
- function A(t) {
1065
- if (t instanceof b)
1066
- return t;
1067
- if (t != null) {
1068
- if (Te(t))
1069
- return Lt(t);
1070
- if (Ie(t))
1071
- return At(t);
1072
- if (ke(t))
1073
- return It(t);
1074
- if (Pe(t))
1075
- return Me(t);
1076
- if (je(t))
1077
- return kt(t);
1078
- if (Ue(t))
1079
- return Tt(t);
858
+ function _e(n) {
859
+ return p(n == null ? void 0 : n.getReader);
860
+ }
861
+ function x(n) {
862
+ if (n instanceof S)
863
+ return n;
864
+ if (n != null) {
865
+ if (we(n))
866
+ return st(n);
867
+ if (Se(n))
868
+ return ut(n);
869
+ if (ge(n))
870
+ return at(n);
871
+ if (Ee(n))
872
+ return Te(n);
873
+ if (Ae(n))
874
+ return ct(n);
875
+ if (_e(n))
876
+ return ft(n);
1080
877
  }
1081
- throw Ce(t);
878
+ throw Oe(n);
1082
879
  }
1083
- function Lt(t) {
1084
- return new b(function(n) {
1085
- var e = t[Q]();
1086
- if (v(e.subscribe))
1087
- return e.subscribe(n);
880
+ function st(n) {
881
+ return new S(function(t) {
882
+ var e = n[z]();
883
+ if (p(e.subscribe))
884
+ return e.subscribe(t);
1088
885
  throw new TypeError("Provided object does not correctly implement Symbol.observable");
1089
886
  });
1090
887
  }
1091
- function At(t) {
1092
- return new b(function(n) {
1093
- for (var e = 0; e < t.length && !n.closed; e++)
1094
- n.next(t[e]);
1095
- n.complete();
888
+ function ut(n) {
889
+ return new S(function(t) {
890
+ for (var e = 0; e < n.length && !t.closed; e++)
891
+ t.next(n[e]);
892
+ t.complete();
1096
893
  });
1097
894
  }
1098
- function It(t) {
1099
- return new b(function(n) {
1100
- t.then(function(e) {
1101
- n.closed || (n.next(e), n.complete());
895
+ function at(n) {
896
+ return new S(function(t) {
897
+ n.then(function(e) {
898
+ t.closed || (t.next(e), t.complete());
1102
899
  }, function(e) {
1103
- return n.error(e);
1104
- }).then(null, _e);
900
+ return t.error(e);
901
+ }).then(null, ye);
1105
902
  });
1106
903
  }
1107
- function kt(t) {
1108
- return new b(function(n) {
904
+ function ct(n) {
905
+ return new S(function(t) {
1109
906
  var e, r;
1110
907
  try {
1111
- for (var i = T(t), o = i.next(); !o.done; o = i.next()) {
1112
- var u = o.value;
1113
- if (n.next(u), n.closed)
908
+ for (var i = M(n), o = i.next(); !o.done; o = i.next()) {
909
+ var s = o.value;
910
+ if (t.next(s), t.closed)
1114
911
  return;
1115
912
  }
1116
- } catch (s) {
1117
- e = { error: s };
913
+ } catch (c) {
914
+ e = { error: c };
1118
915
  } finally {
1119
916
  try {
1120
917
  o && !o.done && (r = i.return) && r.call(i);
@@ -1122,44 +919,44 @@ function kt(t) {
1122
919
  if (e) throw e.error;
1123
920
  }
1124
921
  }
1125
- n.complete();
922
+ t.complete();
1126
923
  });
1127
924
  }
1128
- function Me(t) {
1129
- return new b(function(n) {
1130
- Pt(t, n).catch(function(e) {
1131
- return n.error(e);
925
+ function Te(n) {
926
+ return new S(function(t) {
927
+ lt(n, t).catch(function(e) {
928
+ return t.error(e);
1132
929
  });
1133
930
  });
1134
931
  }
1135
- function Tt(t) {
1136
- return Me(Re(t));
932
+ function ft(n) {
933
+ return Te(xe(n));
1137
934
  }
1138
- function Pt(t, n) {
935
+ function lt(n, t) {
1139
936
  var e, r, i, o;
1140
- return rt(this, void 0, void 0, function() {
1141
- var u, s;
1142
- return we(this, function(f) {
1143
- switch (f.label) {
937
+ return $e(this, void 0, void 0, function() {
938
+ var s, c;
939
+ return ce(this, function(a) {
940
+ switch (a.label) {
1144
941
  case 0:
1145
- f.trys.push([0, 5, 6, 11]), e = ot(t), f.label = 1;
942
+ a.trys.push([0, 5, 6, 11]), e = Fe(n), a.label = 1;
1146
943
  case 1:
1147
944
  return [4, e.next()];
1148
945
  case 2:
1149
- if (r = f.sent(), !!r.done) return [3, 4];
1150
- if (u = r.value, n.next(u), n.closed)
946
+ if (r = a.sent(), !!r.done) return [3, 4];
947
+ if (s = r.value, t.next(s), t.closed)
1151
948
  return [2];
1152
- f.label = 3;
949
+ a.label = 3;
1153
950
  case 3:
1154
951
  return [3, 1];
1155
952
  case 4:
1156
953
  return [3, 11];
1157
954
  case 5:
1158
- return s = f.sent(), i = { error: s }, [3, 11];
955
+ return c = a.sent(), i = { error: c }, [3, 11];
1159
956
  case 6:
1160
- return f.trys.push([6, , 9, 10]), r && !r.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
957
+ return a.trys.push([6, , 9, 10]), r && !r.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
1161
958
  case 7:
1162
- f.sent(), f.label = 8;
959
+ a.sent(), a.label = 8;
1163
960
  case 8:
1164
961
  return [3, 10];
1165
962
  case 9:
@@ -1168,83 +965,83 @@ function Pt(t, n) {
1168
965
  case 10:
1169
966
  return [7];
1170
967
  case 11:
1171
- return n.complete(), [2];
968
+ return t.complete(), [2];
1172
969
  }
1173
970
  });
1174
971
  });
1175
972
  }
1176
- function x(t, n, e, r, i) {
973
+ function A(n, t, e, r, i) {
1177
974
  r === void 0 && (r = 0), i === void 0 && (i = !1);
1178
- var o = n.schedule(function() {
1179
- e(), i ? t.add(this.schedule(null, r)) : this.unsubscribe();
975
+ var o = t.schedule(function() {
976
+ e(), i ? n.add(this.schedule(null, r)) : this.unsubscribe();
1180
977
  }, r);
1181
- if (t.add(o), !i)
978
+ if (n.add(o), !i)
1182
979
  return o;
1183
980
  }
1184
- function $e(t, n) {
1185
- return n === void 0 && (n = 0), L(function(e, r) {
1186
- e.subscribe(P(r, function(i) {
1187
- return x(r, t, function() {
981
+ function Ce(n, t) {
982
+ return t === void 0 && (t = 0), T(function(e, r) {
983
+ e.subscribe(E(r, function(i) {
984
+ return A(r, n, function() {
1188
985
  return r.next(i);
1189
- }, n);
986
+ }, t);
1190
987
  }, function() {
1191
- return x(r, t, function() {
988
+ return A(r, n, function() {
1192
989
  return r.complete();
1193
- }, n);
990
+ }, t);
1194
991
  }, function(i) {
1195
- return x(r, t, function() {
992
+ return A(r, n, function() {
1196
993
  return r.error(i);
1197
- }, n);
994
+ }, t);
1198
995
  }));
1199
996
  });
1200
997
  }
1201
- function De(t, n) {
1202
- return n === void 0 && (n = 0), L(function(e, r) {
1203
- r.add(t.schedule(function() {
998
+ function Pe(n, t) {
999
+ return t === void 0 && (t = 0), T(function(e, r) {
1000
+ r.add(n.schedule(function() {
1204
1001
  return e.subscribe(r);
1205
- }, n));
1002
+ }, t));
1206
1003
  });
1207
1004
  }
1208
- function Ct(t, n) {
1209
- return A(t).pipe(De(n), $e(n));
1005
+ function dt(n, t) {
1006
+ return x(n).pipe(Pe(t), Ce(t));
1210
1007
  }
1211
- function Nt(t, n) {
1212
- return A(t).pipe(De(n), $e(n));
1008
+ function ht(n, t) {
1009
+ return x(n).pipe(Pe(t), Ce(t));
1213
1010
  }
1214
- function jt(t, n) {
1215
- return new b(function(e) {
1011
+ function yt(n, t) {
1012
+ return new S(function(e) {
1216
1013
  var r = 0;
1217
- return n.schedule(function() {
1218
- r === t.length ? e.complete() : (e.next(t[r++]), e.closed || this.schedule());
1014
+ return t.schedule(function() {
1015
+ r === n.length ? e.complete() : (e.next(n[r++]), e.closed || this.schedule());
1219
1016
  });
1220
1017
  });
1221
1018
  }
1222
- function Rt(t, n) {
1223
- return new b(function(e) {
1019
+ function vt(n, t) {
1020
+ return new S(function(e) {
1224
1021
  var r;
1225
- return x(e, n, function() {
1226
- r = t[Ne](), x(e, n, function() {
1227
- var i, o, u;
1022
+ return A(e, t, function() {
1023
+ r = n[Ie](), A(e, t, function() {
1024
+ var i, o, s;
1228
1025
  try {
1229
- i = r.next(), o = i.value, u = i.done;
1230
- } catch (s) {
1231
- e.error(s);
1026
+ i = r.next(), o = i.value, s = i.done;
1027
+ } catch (c) {
1028
+ e.error(c);
1232
1029
  return;
1233
1030
  }
1234
- u ? e.complete() : e.next(o);
1031
+ s ? e.complete() : e.next(o);
1235
1032
  }, 0, !0);
1236
1033
  }), function() {
1237
- return v(r == null ? void 0 : r.return) && r.return();
1034
+ return p(r == null ? void 0 : r.return) && r.return();
1238
1035
  };
1239
1036
  });
1240
1037
  }
1241
- function Fe(t, n) {
1242
- if (!t)
1038
+ function Me(n, t) {
1039
+ if (!n)
1243
1040
  throw new Error("Iterable cannot be null");
1244
- return new b(function(e) {
1245
- x(e, n, function() {
1246
- var r = t[Symbol.asyncIterator]();
1247
- x(e, n, function() {
1041
+ return new S(function(e) {
1042
+ A(e, t, function() {
1043
+ var r = n[Symbol.asyncIterator]();
1044
+ A(e, t, function() {
1248
1045
  r.next().then(function(i) {
1249
1046
  i.done ? e.complete() : e.next(i.value);
1250
1047
  });
@@ -1252,210 +1049,299 @@ function Fe(t, n) {
1252
1049
  });
1253
1050
  });
1254
1051
  }
1255
- function Ut(t, n) {
1256
- return Fe(Re(t), n);
1257
- }
1258
- function Mt(t, n) {
1259
- if (t != null) {
1260
- if (Te(t))
1261
- return Ct(t, n);
1262
- if (Ie(t))
1263
- return jt(t, n);
1264
- if (ke(t))
1265
- return Nt(t, n);
1266
- if (Pe(t))
1267
- return Fe(t, n);
1268
- if (je(t))
1269
- return Rt(t, n);
1270
- if (Ue(t))
1271
- return Ut(t, n);
1052
+ function pt(n, t) {
1053
+ return Me(xe(n), t);
1054
+ }
1055
+ function bt(n, t) {
1056
+ if (n != null) {
1057
+ if (we(n))
1058
+ return dt(n, t);
1059
+ if (Se(n))
1060
+ return yt(n, t);
1061
+ if (ge(n))
1062
+ return ht(n, t);
1063
+ if (Ee(n))
1064
+ return Me(n, t);
1065
+ if (Ae(n))
1066
+ return vt(n, t);
1067
+ if (_e(n))
1068
+ return pt(n, t);
1272
1069
  }
1273
- throw Ce(t);
1070
+ throw Oe(n);
1274
1071
  }
1275
- function $t(t, n) {
1276
- return n ? Mt(t, n) : A(t);
1072
+ function Z(n, t) {
1073
+ return t ? bt(n, t) : x(n);
1277
1074
  }
1278
- function Dt() {
1279
- for (var t = [], n = 0; n < arguments.length; n++)
1280
- t[n] = arguments[n];
1281
- var e = _t(t);
1282
- return $t(t, e);
1075
+ function mt() {
1076
+ for (var n = [], t = 0; t < arguments.length; t++)
1077
+ n[t] = arguments[t];
1078
+ var e = me(n);
1079
+ return Z(n, e);
1283
1080
  }
1284
- function Ft(t) {
1285
- return t instanceof Date && !isNaN(t);
1081
+ function St(n) {
1082
+ return n instanceof Date && !isNaN(n);
1286
1083
  }
1287
- function He(t, n) {
1288
- return L(function(e, r) {
1084
+ function F(n, t) {
1085
+ return T(function(e, r) {
1289
1086
  var i = 0;
1290
- e.subscribe(P(r, function(o) {
1291
- r.next(t.call(n, o, i++));
1087
+ e.subscribe(E(r, function(o) {
1088
+ r.next(n.call(t, o, i++));
1292
1089
  }));
1293
1090
  });
1294
1091
  }
1295
- function Ht(t, n, e, r, i, o, u, s) {
1296
- var f = [], a = 0, l = 0, y = !1, m = function() {
1297
- y && !f.length && !a && n.complete();
1298
- }, c = function(h) {
1299
- return a < r ? p(h) : f.push(h);
1300
- }, p = function(h) {
1301
- a++;
1302
- var O = !1;
1303
- A(e(h, l++)).subscribe(P(n, function(w) {
1304
- n.next(w);
1092
+ var gt = Array.isArray;
1093
+ function wt(n, t) {
1094
+ return gt(t) ? n.apply(void 0, R([], L(t))) : n(t);
1095
+ }
1096
+ function Et(n) {
1097
+ return F(function(t) {
1098
+ return wt(n, t);
1099
+ });
1100
+ }
1101
+ var Ot = Array.isArray, It = Object.getPrototypeOf, At = Object.prototype, xt = Object.keys;
1102
+ function _t(n) {
1103
+ if (n.length === 1) {
1104
+ var t = n[0];
1105
+ if (Ot(t))
1106
+ return { args: t, keys: null };
1107
+ if (Tt(t)) {
1108
+ var e = xt(t);
1109
+ return {
1110
+ args: e.map(function(r) {
1111
+ return t[r];
1112
+ }),
1113
+ keys: e
1114
+ };
1115
+ }
1116
+ }
1117
+ return { args: n, keys: null };
1118
+ }
1119
+ function Tt(n) {
1120
+ return n && typeof n == "object" && It(n) === At;
1121
+ }
1122
+ function Ct(n, t) {
1123
+ return n.reduce(function(e, r, i) {
1124
+ return e[r] = t[i], e;
1125
+ }, {});
1126
+ }
1127
+ function Pt() {
1128
+ for (var n = [], t = 0; t < arguments.length; t++)
1129
+ n[t] = arguments[t];
1130
+ var e = me(n), r = it(n), i = _t(n), o = i.args, s = i.keys;
1131
+ if (o.length === 0)
1132
+ return Z([], e);
1133
+ var c = new S(Mt(o, e, s ? function(a) {
1134
+ return Ct(s, a);
1135
+ } : G));
1136
+ return r ? c.pipe(Et(r)) : c;
1137
+ }
1138
+ function Mt(n, t, e) {
1139
+ return e === void 0 && (e = G), function(r) {
1140
+ se(t, function() {
1141
+ for (var i = n.length, o = new Array(i), s = i, c = i, a = function(f) {
1142
+ se(t, function() {
1143
+ var y = Z(n[f], t), b = !1;
1144
+ y.subscribe(E(r, function(l) {
1145
+ o[f] = l, b || (b = !0, c--), c || r.next(e(o.slice()));
1146
+ }, function() {
1147
+ --s || r.complete();
1148
+ }));
1149
+ }, r);
1150
+ }, u = 0; u < i; u++)
1151
+ a(u);
1152
+ }, r);
1153
+ };
1154
+ }
1155
+ function se(n, t, e) {
1156
+ n ? A(e, n, t) : t();
1157
+ }
1158
+ function Lt(n, t, e, r, i, o, s, c) {
1159
+ var a = [], u = 0, f = 0, y = !1, b = function() {
1160
+ y && !a.length && !u && t.complete();
1161
+ }, l = function(d) {
1162
+ return u < r ? v(d) : a.push(d);
1163
+ }, v = function(d) {
1164
+ u++;
1165
+ var g = !1;
1166
+ x(e(d, f++)).subscribe(E(t, function(w) {
1167
+ t.next(w);
1305
1168
  }, function() {
1306
- O = !0;
1169
+ g = !0;
1307
1170
  }, void 0, function() {
1308
- if (O)
1171
+ if (g)
1309
1172
  try {
1310
- a--;
1173
+ u--;
1311
1174
  for (var w = function() {
1312
- var _ = f.shift();
1313
- u || p(_);
1314
- }; f.length && a < r; )
1175
+ var _ = a.shift();
1176
+ s || v(_);
1177
+ }; a.length && u < r; )
1315
1178
  w();
1316
- m();
1179
+ b();
1317
1180
  } catch (_) {
1318
- n.error(_);
1181
+ t.error(_);
1319
1182
  }
1320
1183
  }));
1321
1184
  };
1322
- return t.subscribe(P(n, c, function() {
1323
- y = !0, m();
1185
+ return n.subscribe(E(t, l, function() {
1186
+ y = !0, b();
1324
1187
  })), function() {
1325
1188
  };
1326
1189
  }
1327
- function H(t, n, e) {
1328
- return e === void 0 && (e = 1 / 0), v(n) ? H(function(r, i) {
1329
- return He(function(o, u) {
1330
- return n(r, o, i, u);
1331
- })(A(t(r, i)));
1332
- }, e) : (typeof n == "number" && (e = n), L(function(r, i) {
1333
- return Ht(r, i, t, e);
1190
+ function $(n, t, e) {
1191
+ return e === void 0 && (e = 1 / 0), p(t) ? $(function(r, i) {
1192
+ return F(function(o, s) {
1193
+ return t(r, o, i, s);
1194
+ })(x(n(r, i)));
1195
+ }, e) : (typeof t == "number" && (e = t), T(function(r, i) {
1196
+ return Lt(r, i, n, e);
1334
1197
  }));
1335
1198
  }
1336
- function Gt(t, n, e) {
1337
- t === void 0 && (t = 0), e === void 0 && (e = Et);
1199
+ function Le(n, t, e) {
1200
+ n === void 0 && (n = 0), e === void 0 && (e = nt);
1338
1201
  var r = -1;
1339
- return n != null && (Ae(n) ? e = n : r = n), new b(function(i) {
1340
- var o = Ft(t) ? +t - e.now() : t;
1202
+ return t != null && (pe(t) ? e = t : r = t), new S(function(i) {
1203
+ var o = St(n) ? +n - e.now() : n;
1341
1204
  o < 0 && (o = 0);
1342
- var u = 0;
1205
+ var s = 0;
1343
1206
  return e.schedule(function() {
1344
- i.closed || (i.next(u++), 0 <= r ? this.schedule(void 0, r) : i.complete());
1207
+ i.closed || (i.next(s++), 0 <= r ? this.schedule(void 0, r) : i.complete());
1345
1208
  }, o);
1346
1209
  });
1347
1210
  }
1348
- function Wt(t, n) {
1349
- return v(n) ? H(t, n, 1) : H(t, 1);
1211
+ function Rt(n, t) {
1212
+ return p(t) ? $(n, t, 1) : $(n, 1);
1350
1213
  }
1351
- function qt(t) {
1352
- return t <= 0 ? function() {
1353
- return St;
1354
- } : L(function(n, e) {
1214
+ function kt(n) {
1215
+ return n <= 0 ? function() {
1216
+ return rt;
1217
+ } : T(function(t, e) {
1355
1218
  var r = 0;
1356
- n.subscribe(P(e, function(i) {
1357
- ++r <= t && (e.next(i), t <= r && e.complete());
1219
+ t.subscribe(E(e, function(i) {
1220
+ ++r <= n && (e.next(i), n <= r && e.complete());
1358
1221
  }));
1359
1222
  });
1360
1223
  }
1361
- function Vt(t) {
1362
- return He(function() {
1363
- return t;
1224
+ function jt(n) {
1225
+ return F(function() {
1226
+ return n;
1364
1227
  });
1365
1228
  }
1366
- function Yt(t, n) {
1367
- return H(function(e, r) {
1368
- return A(t(e, r)).pipe(qt(1), Vt(e));
1229
+ function Dt(n, t) {
1230
+ return $(function(e, r) {
1231
+ return x(n(e, r)).pipe(kt(1), jt(e));
1369
1232
  });
1370
1233
  }
1371
- function Bt(t, n) {
1372
- n === void 0 && (n = Le);
1373
- var e = Gt(t, n);
1374
- return Yt(function() {
1234
+ function Ut(n, t) {
1235
+ t === void 0 && (t = ve);
1236
+ var e = Le(n, t);
1237
+ return Dt(function() {
1375
1238
  return e;
1376
1239
  });
1377
1240
  }
1378
- function ue(t) {
1379
- return L(function(n, e) {
1380
- try {
1381
- n.subscribe(e);
1382
- } finally {
1383
- e.add(t);
1384
- }
1241
+ function Nt(n) {
1242
+ var t;
1243
+ t = {
1244
+ count: n
1245
+ };
1246
+ var e = t.count, r = e === void 0 ? 1 / 0 : e, i = t.delay, o = t.resetOnSuccess, s = o === void 0 ? !1 : o;
1247
+ return r <= 0 ? G : T(function(c, a) {
1248
+ var u = 0, f, y = function() {
1249
+ var b = !1;
1250
+ f = c.subscribe(E(a, function(l) {
1251
+ s && (u = 0), a.next(l);
1252
+ }, void 0, function(l) {
1253
+ if (u++ < r) {
1254
+ var v = function() {
1255
+ f ? (f.unsubscribe(), f = null, y()) : b = !0;
1256
+ };
1257
+ if (i != null) {
1258
+ var d = typeof i == "number" ? Le(i) : x(i(l, u)), g = E(a, function() {
1259
+ g.unsubscribe(), v();
1260
+ }, function() {
1261
+ a.complete();
1262
+ });
1263
+ d.subscribe(g);
1264
+ } else
1265
+ v();
1266
+ } else
1267
+ a.error(l);
1268
+ })), b && (f.unsubscribe(), f = null, y());
1269
+ };
1270
+ y();
1385
1271
  });
1386
1272
  }
1387
- function se(t) {
1388
- return L(function(n, e) {
1389
- A(t).subscribe(P(e, function() {
1273
+ function $t(n) {
1274
+ return T(function(t, e) {
1275
+ x(n).subscribe(E(e, function() {
1390
1276
  return e.complete();
1391
- }, B)), !e.closed && n.subscribe(e);
1277
+ }, q)), !e.closed && t.subscribe(e);
1392
1278
  });
1393
1279
  }
1394
- async function Kt(t, n) {
1395
- const e = t.getReader();
1280
+ async function Gt(n, t) {
1281
+ const e = n.getReader();
1396
1282
  let r;
1397
1283
  for (; !(r = await e.read()).done; )
1398
- n(r.value);
1399
- }
1400
- function zt(t) {
1401
- let n, e, r, i = !1;
1402
- return function(u) {
1403
- n === void 0 ? (n = u, e = 0, r = -1) : n = Xt(n, u);
1404
- const s = n.length;
1405
- let f = 0;
1406
- for (; e < s; ) {
1407
- i && (n[e] === 10 && (f = ++e), i = !1);
1408
- let a = -1;
1409
- for (; e < s && a === -1; ++e)
1410
- switch (n[e]) {
1284
+ t(r.value);
1285
+ }
1286
+ function Ft(n) {
1287
+ let t, e, r, i = !1;
1288
+ return function(s) {
1289
+ t === void 0 ? (t = s, e = 0, r = -1) : t = Vt(t, s);
1290
+ const c = t.length;
1291
+ let a = 0;
1292
+ for (; e < c; ) {
1293
+ i && (t[e] === 10 && (a = ++e), i = !1);
1294
+ let u = -1;
1295
+ for (; e < c && u === -1; ++e)
1296
+ switch (t[e]) {
1411
1297
  case 58:
1412
- r === -1 && (r = e - f);
1298
+ r === -1 && (r = e - a);
1413
1299
  break;
1414
1300
  case 13:
1415
1301
  i = !0;
1416
1302
  case 10:
1417
- a = e;
1303
+ u = e;
1418
1304
  break;
1419
1305
  }
1420
- if (a === -1)
1306
+ if (u === -1)
1421
1307
  break;
1422
- t(n.subarray(f, a), r), f = e, r = -1;
1308
+ n(t.subarray(a, u), r), a = e, r = -1;
1423
1309
  }
1424
- f === s ? n = void 0 : f !== 0 && (n = n.subarray(f), e -= f);
1310
+ a === c ? t = void 0 : a !== 0 && (t = t.subarray(a), e -= a);
1425
1311
  };
1426
1312
  }
1427
- function Jt(t, n, e) {
1428
- let r = ae();
1313
+ function Ht(n, t, e) {
1314
+ let r = ue();
1429
1315
  const i = new TextDecoder();
1430
- return function(u, s) {
1431
- if (u.length === 0)
1432
- e == null || e(r), r = ae();
1433
- else if (s > 0) {
1434
- const f = i.decode(u.subarray(0, s)), a = s + (u[s + 1] === 32 ? 2 : 1), l = i.decode(u.subarray(a));
1435
- switch (f) {
1316
+ return function(s, c) {
1317
+ if (s.length === 0)
1318
+ e == null || e(r), r = ue();
1319
+ else if (c > 0) {
1320
+ const a = i.decode(s.subarray(0, c)), u = c + (s[c + 1] === 32 ? 2 : 1), f = i.decode(s.subarray(u));
1321
+ switch (a) {
1436
1322
  case "data":
1437
1323
  r.data = r.data ? r.data + `
1438
- ` + l : l;
1324
+ ` + f : f;
1439
1325
  break;
1440
1326
  case "event":
1441
- r.event = l;
1327
+ r.event = f;
1442
1328
  break;
1443
1329
  case "id":
1444
- t(r.id = l);
1330
+ n(r.id = f);
1445
1331
  break;
1446
1332
  case "retry":
1447
- const y = parseInt(l, 10);
1448
- isNaN(y) || n(r.retry = y);
1333
+ const y = parseInt(f, 10);
1334
+ isNaN(y) || t(r.retry = y);
1449
1335
  break;
1450
1336
  }
1451
1337
  }
1452
1338
  };
1453
1339
  }
1454
- function Xt(t, n) {
1455
- const e = new Uint8Array(t.length + n.length);
1456
- return e.set(t), e.set(n, t.length), e;
1340
+ function Vt(n, t) {
1341
+ const e = new Uint8Array(n.length + t.length);
1342
+ return e.set(n), e.set(t, n.length), e;
1457
1343
  }
1458
- function ae() {
1344
+ function ue() {
1459
1345
  return {
1460
1346
  data: "",
1461
1347
  event: "",
@@ -1463,153 +1349,206 @@ function ae() {
1463
1349
  retry: void 0
1464
1350
  };
1465
1351
  }
1466
- var Qt = function(t, n) {
1352
+ var Bt = function(n, t) {
1467
1353
  var e = {};
1468
- for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && n.indexOf(r) < 0 && (e[r] = t[r]);
1469
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
1470
- for (var i = 0, r = Object.getOwnPropertySymbols(t); i < r.length; i++)
1471
- n.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (e[r[i]] = t[r[i]]);
1354
+ for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && t.indexOf(r) < 0 && (e[r] = n[r]);
1355
+ if (n != null && typeof Object.getOwnPropertySymbols == "function")
1356
+ for (var i = 0, r = Object.getOwnPropertySymbols(n); i < r.length; i++)
1357
+ t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[i]) && (e[r[i]] = n[r[i]]);
1472
1358
  return e;
1473
1359
  };
1474
- const z = "text/event-stream", Zt = 1e3, fe = "last-event-id";
1475
- function en(t, n) {
1476
- var { signal: e, headers: r, onopen: i, onmessage: o, onclose: u, onerror: s, openWhenHidden: f, fetch: a } = n, l = Qt(n, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
1477
- return new Promise((y, m) => {
1478
- const c = Object.assign({}, r);
1479
- c.accept || (c.accept = z);
1480
- let p;
1481
- function h() {
1482
- p.abort(), document.hidden || W();
1360
+ const J = "text/event-stream", Kt = 1e3, ae = "last-event-id";
1361
+ function Yt(n, t) {
1362
+ var { signal: e, headers: r, onopen: i, onmessage: o, onclose: s, onerror: c, openWhenHidden: a, fetch: u } = t, f = Bt(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
1363
+ return new Promise((y, b) => {
1364
+ const l = Object.assign({}, r);
1365
+ l.accept || (l.accept = J);
1366
+ let v;
1367
+ function d() {
1368
+ v.abort(), document.hidden || H();
1483
1369
  }
1484
- f || document.addEventListener("visibilitychange", h);
1485
- let O = Zt, w = 0;
1370
+ a || document.addEventListener("visibilitychange", d);
1371
+ let g = Kt, w = 0;
1486
1372
  function _() {
1487
- document.removeEventListener("visibilitychange", h), window.clearTimeout(w), p.abort();
1373
+ document.removeEventListener("visibilitychange", d), window.clearTimeout(w), v.abort();
1488
1374
  }
1489
1375
  e == null || e.addEventListener("abort", () => {
1490
1376
  _(), y();
1491
1377
  });
1492
- const Ge = a ?? window.fetch, We = i ?? tn;
1493
- async function W() {
1494
- var q;
1495
- p = new AbortController();
1378
+ const ke = u ?? window.fetch, je = i ?? qt;
1379
+ async function H() {
1380
+ var V;
1381
+ v = new AbortController();
1496
1382
  try {
1497
- const j = await Ge(t, Object.assign(Object.assign({}, l), { headers: c, signal: p.signal }));
1498
- await We(j), await Kt(j.body, zt(Jt((g) => {
1499
- g ? c[fe] = g : delete c[fe];
1500
- }, (g) => {
1501
- O = g;
1502
- }, o))), u == null || u(), _(), y();
1383
+ const j = await ke(n, Object.assign(Object.assign({}, f), { headers: l, signal: v.signal }));
1384
+ await je(j), await Gt(j.body, Ft(Ht((I) => {
1385
+ I ? l[ae] = I : delete l[ae];
1386
+ }, (I) => {
1387
+ g = I;
1388
+ }, o))), s == null || s(), _(), y();
1503
1389
  } catch (j) {
1504
- if (!p.signal.aborted)
1390
+ if (!v.signal.aborted)
1505
1391
  try {
1506
- const g = (q = s == null ? void 0 : s(j)) !== null && q !== void 0 ? q : O;
1507
- window.clearTimeout(w), w = window.setTimeout(W, g);
1508
- } catch (g) {
1509
- _(), m(g);
1392
+ const I = (V = c == null ? void 0 : c(j)) !== null && V !== void 0 ? V : g;
1393
+ window.clearTimeout(w), w = window.setTimeout(H, I);
1394
+ } catch (I) {
1395
+ _(), b(I);
1510
1396
  }
1511
1397
  }
1512
1398
  }
1513
- W();
1399
+ H();
1514
1400
  });
1515
1401
  }
1516
- function tn(t) {
1517
- const n = t.headers.get("content-type");
1518
- if (!(n != null && n.startsWith(z)))
1519
- throw new Error(`Expected content-type to be ${z}, Actual: ${n}`);
1402
+ function qt(n) {
1403
+ const t = n.headers.get("content-type");
1404
+ if (!(t != null && t.startsWith(J)))
1405
+ throw new Error(`Expected content-type to be ${J}, Actual: ${t}`);
1520
1406
  }
1521
- function ce(t) {
1522
- const { endpoint: n, webhookToken: e, payload: r } = t;
1523
- return new b((i) => {
1524
- const o = new AbortController();
1525
- return en(n, {
1407
+ function Wt(n) {
1408
+ const { endpoint: t, apiKey: e, payload: r, debugMode: i } = n;
1409
+ return new S((o) => {
1410
+ const s = new AbortController(), c = {
1411
+ "Content-Type": "application/json"
1412
+ };
1413
+ e && (c["X-API-KEY"] = e);
1414
+ const a = new URLSearchParams();
1415
+ i && a.set("is_debug", "true");
1416
+ const u = new URL(t);
1417
+ return a.toString() && (u.search = a.toString()), Yt(u.toString(), {
1526
1418
  method: "POST",
1527
- headers: {
1528
- "X-Asgard-Webhook-Token": e,
1529
- "Content-Type": "application/json"
1530
- },
1419
+ headers: c,
1531
1420
  body: r ? JSON.stringify(r) : void 0,
1532
- signal: o.signal,
1533
- onopen: async (u) => {
1534
- u.ok || (i.error(u), o.abort());
1421
+ signal: s.signal,
1422
+ /**
1423
+ * Allow SSE to work when the page is hidden.
1424
+ * https://github.com/Azure/fetch-event-source/issues/17#issuecomment-1525904929
1425
+ */
1426
+ openWhenHidden: !0,
1427
+ onopen: async (f) => {
1428
+ f.ok || (o.error(f), s.abort());
1535
1429
  },
1536
- onmessage: (u) => {
1537
- i.next(u);
1430
+ onmessage: (f) => {
1431
+ o.next(JSON.parse(f.data));
1538
1432
  },
1539
1433
  onclose: () => {
1540
- i.complete();
1434
+ o.complete();
1541
1435
  },
1542
- onerror: (u) => {
1543
- i.error(u), o.abort();
1436
+ onerror: (f) => {
1437
+ throw o.error(f), s.abort(), f;
1544
1438
  }
1545
1439
  }), () => {
1546
- o.abort();
1440
+ s.abort();
1547
1441
  };
1548
1442
  });
1549
1443
  }
1550
- class rn {
1551
- constructor(n) {
1552
- E(this, "baseUrl");
1553
- E(this, "namespace");
1554
- E(this, "botProviderName");
1555
- E(this, "endpoint");
1556
- E(this, "webhookToken");
1557
- E(this, "eventEmitter");
1558
- E(this, "destroy$", new xe());
1559
- if (!n.baseUrl)
1560
- throw new Error("baseUrl must be required");
1561
- if (!n.namespace)
1562
- throw new Error("namespace must be required");
1563
- if (!n.botProviderName)
1564
- throw new Error("botProviderName must be required");
1565
- if (!n.webhookToken)
1566
- throw new Error("webhookToken must be required");
1567
- this.baseUrl = n.baseUrl, this.namespace = n.namespace, this.botProviderName = n.botProviderName, this.webhookToken = n.webhookToken, this.endpoint = `${this.baseUrl}/generic/ns/${this.namespace}/bot-provider/${this.botProviderName}/message/sse`, this.eventEmitter = new nt();
1444
+ class Jt {
1445
+ constructor() {
1446
+ m(this, "listeners", {});
1568
1447
  }
1569
- on(n, e, r) {
1570
- const i = `${n}:${e}`;
1571
- this.eventEmitter.listeners(i).length > 0 && this.eventEmitter.removeAllListeners(i), this.eventEmitter.on(i, r);
1448
+ on(t, e) {
1449
+ this.listeners = Object.assign({}, this.listeners, {
1450
+ [t]: (this.listeners[t] ?? []).concat(e)
1451
+ });
1572
1452
  }
1573
- setChannel(n, e) {
1574
- var r;
1575
- return (r = e == null ? void 0 : e.onStart) == null || r.call(e), ce({
1576
- endpoint: this.endpoint,
1577
- webhookToken: this.webhookToken,
1578
- payload: Object.assign({ action: C.RESET_CHANNEL }, n)
1579
- }).pipe(
1580
- se(this.destroy$),
1581
- ue(() => {
1582
- var i;
1583
- return (i = e == null ? void 0 : e.onCompleted) == null ? void 0 : i.call(e);
1584
- })
1585
- ).subscribe({
1586
- next: (i) => {
1587
- this.eventEmitter.emit(
1588
- `${C.RESET_CHANNEL}:${i.event}`,
1589
- JSON.parse(i.data)
1453
+ off(t, e) {
1454
+ this.listeners[t] && (this.listeners = Object.assign({}, this.listeners, {
1455
+ [t]: (this.listeners[t] ?? []).filter((r) => r !== e)
1456
+ }));
1457
+ }
1458
+ remove(t) {
1459
+ delete this.listeners[t];
1460
+ }
1461
+ emit(t, ...e) {
1462
+ this.listeners[t] && this.listeners[t].forEach((r) => r(...e));
1463
+ }
1464
+ }
1465
+ class zt {
1466
+ constructor(t) {
1467
+ m(this, "apiKey");
1468
+ m(this, "endpoint");
1469
+ m(this, "debugMode");
1470
+ m(this, "destroy$", new Q());
1471
+ m(this, "sseEmitter", new Jt());
1472
+ m(this, "transformSsePayload");
1473
+ if (!t.endpoint && !t.botProviderEndpoint)
1474
+ throw new Error("Either endpoint or botProviderEndpoint must be provided");
1475
+ if (this.apiKey = t.apiKey, this.debugMode = t.debugMode, this.transformSsePayload = t.transformSsePayload, !t.endpoint && t.botProviderEndpoint) {
1476
+ const e = t.botProviderEndpoint.replace(/\/+$/, "");
1477
+ this.endpoint = `${e}/message/sse`;
1478
+ } else t.endpoint && (this.endpoint = t.endpoint, this.debugMode && console.warn(
1479
+ '[AsgardServiceClient] The "endpoint" option is deprecated and will be removed in the next major version. Please use "botProviderEndpoint" instead. The SSE endpoint will be automatically derived as "${botProviderEndpoint}/message/sse".'
1480
+ ));
1481
+ }
1482
+ on(t, e) {
1483
+ this.sseEmitter.remove(t), this.sseEmitter.on(t, e);
1484
+ }
1485
+ handleEvent(t) {
1486
+ switch (t.eventType) {
1487
+ case h.INIT:
1488
+ this.sseEmitter.emit(
1489
+ h.INIT,
1490
+ t
1590
1491
  );
1591
- }
1592
- });
1492
+ break;
1493
+ case h.PROCESS_START:
1494
+ case h.PROCESS_COMPLETE:
1495
+ this.sseEmitter.emit(
1496
+ h.PROCESS,
1497
+ t
1498
+ );
1499
+ break;
1500
+ case h.MESSAGE_START:
1501
+ case h.MESSAGE_DELTA:
1502
+ case h.MESSAGE_COMPLETE:
1503
+ this.sseEmitter.emit(
1504
+ h.MESSAGE,
1505
+ t
1506
+ );
1507
+ break;
1508
+ case h.TOOL_CALL_START:
1509
+ case h.TOOL_CALL_COMPLETE:
1510
+ this.sseEmitter.emit(
1511
+ h.TOOL_CALL,
1512
+ t
1513
+ );
1514
+ break;
1515
+ case h.DONE:
1516
+ this.sseEmitter.emit(
1517
+ h.DONE,
1518
+ t
1519
+ );
1520
+ break;
1521
+ case h.ERROR:
1522
+ this.sseEmitter.emit(
1523
+ h.ERROR,
1524
+ t
1525
+ );
1526
+ break;
1527
+ }
1593
1528
  }
1594
- sendMessage(n, e) {
1595
- var r;
1596
- return (r = e == null ? void 0 : e.onStart) == null || r.call(e), ce({
1529
+ fetchSse(t, e) {
1530
+ var r, i;
1531
+ (r = e == null ? void 0 : e.onSseStart) == null || r.call(e), Wt({
1532
+ apiKey: this.apiKey,
1597
1533
  endpoint: this.endpoint,
1598
- webhookToken: this.webhookToken,
1599
- payload: Object.assign({ action: C.NONE }, n)
1534
+ debugMode: this.debugMode,
1535
+ payload: ((i = this.transformSsePayload) == null ? void 0 : i.call(this, t)) ?? t
1600
1536
  }).pipe(
1601
- Wt((i) => Dt(i).pipe(Bt((e == null ? void 0 : e.delayTime) ?? 50))),
1602
- se(this.destroy$),
1603
- ue(() => {
1604
- var i;
1605
- return (i = e == null ? void 0 : e.onCompleted) == null ? void 0 : i.call(e);
1606
- })
1537
+ Rt((o) => mt(o).pipe(Ut((e == null ? void 0 : e.delayTime) ?? 50))),
1538
+ $t(this.destroy$),
1539
+ Nt(3)
1607
1540
  ).subscribe({
1608
- next: (i) => {
1609
- this.eventEmitter.emit(
1610
- `${C.NONE}:${i.event}`,
1611
- JSON.parse(i.data)
1612
- );
1541
+ next: (o) => {
1542
+ var s;
1543
+ (s = e == null ? void 0 : e.onSseMessage) == null || s.call(e, o), this.handleEvent(o);
1544
+ },
1545
+ error: (o) => {
1546
+ var s;
1547
+ (s = e == null ? void 0 : e.onSseError) == null || s.call(e, o);
1548
+ },
1549
+ complete: () => {
1550
+ var o;
1551
+ (o = e == null ? void 0 : e.onSseCompleted) == null || o.call(e);
1613
1552
  }
1614
1553
  });
1615
1554
  }
@@ -1617,10 +1556,180 @@ class rn {
1617
1556
  this.destroy$.next(), this.destroy$.complete();
1618
1557
  }
1619
1558
  }
1559
+ class Re {
1560
+ constructor(t) {
1561
+ m(this, "client");
1562
+ m(this, "customChannelId");
1563
+ m(this, "customMessageId");
1564
+ m(this, "isConnecting$");
1565
+ m(this, "conversation$");
1566
+ m(this, "statesObserver");
1567
+ m(this, "statesSubscription");
1568
+ if (!t.client)
1569
+ throw new Error("client must be required");
1570
+ if (!t.customChannelId)
1571
+ throw new Error("customChannelId must be required");
1572
+ this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.isConnecting$ = new re(!1), this.conversation$ = new re(t.conversation), this.statesObserver = t.statesObserver;
1573
+ }
1574
+ static async reset(t, e, r) {
1575
+ const i = new Re(t);
1576
+ try {
1577
+ return i.subscribe(), await i.resetChannel(e, r), i;
1578
+ } catch (o) {
1579
+ throw i.close(), o;
1580
+ }
1581
+ }
1582
+ subscribe() {
1583
+ this.statesSubscription = Pt([
1584
+ this.isConnecting$,
1585
+ this.conversation$
1586
+ ]).pipe(
1587
+ F(([t, e]) => ({
1588
+ isConnecting: t,
1589
+ conversation: e
1590
+ }))
1591
+ ).subscribe(this.statesObserver);
1592
+ }
1593
+ fetchSse(t, e) {
1594
+ return new Promise((r, i) => {
1595
+ this.isConnecting$.next(!0), this.client.fetchSse(t, {
1596
+ onSseStart: e == null ? void 0 : e.onSseStart,
1597
+ onSseMessage: (o) => {
1598
+ var s;
1599
+ (s = e == null ? void 0 : e.onSseMessage) == null || s.call(e, o), this.conversation$.next(this.conversation$.value.onMessage(o));
1600
+ },
1601
+ onSseError: (o) => {
1602
+ var s;
1603
+ (s = e == null ? void 0 : e.onSseError) == null || s.call(e, o), this.isConnecting$.next(!1), i(o);
1604
+ },
1605
+ onSseCompleted: () => {
1606
+ var o;
1607
+ (o = e == null ? void 0 : e.onSseCompleted) == null || o.call(e), this.isConnecting$.next(!1), r();
1608
+ }
1609
+ });
1610
+ });
1611
+ }
1612
+ resetChannel(t, e) {
1613
+ return this.fetchSse(
1614
+ {
1615
+ action: K.RESET_CHANNEL,
1616
+ customChannelId: this.customChannelId,
1617
+ customMessageId: this.customMessageId,
1618
+ text: (t == null ? void 0 : t.text) || "",
1619
+ payload: t == null ? void 0 : t.payload
1620
+ },
1621
+ e
1622
+ );
1623
+ }
1624
+ sendMessage(t, e) {
1625
+ const r = t.text.trim(), i = t.customMessageId ?? crypto.randomUUID();
1626
+ return this.conversation$.next(
1627
+ this.conversation$.value.pushMessage({
1628
+ type: "user",
1629
+ messageId: i,
1630
+ text: r,
1631
+ time: /* @__PURE__ */ new Date()
1632
+ })
1633
+ ), this.fetchSse(
1634
+ {
1635
+ action: K.NONE,
1636
+ customChannelId: this.customChannelId,
1637
+ customMessageId: i,
1638
+ payload: t == null ? void 0 : t.payload,
1639
+ text: r
1640
+ },
1641
+ e
1642
+ );
1643
+ }
1644
+ close() {
1645
+ var t;
1646
+ this.isConnecting$.complete(), this.conversation$.complete(), (t = this.statesSubscription) == null || t.unsubscribe();
1647
+ }
1648
+ }
1649
+ class C {
1650
+ constructor({ messages: t }) {
1651
+ m(this, "messages", null);
1652
+ this.messages = t;
1653
+ }
1654
+ pushMessage(t) {
1655
+ const e = new Map(this.messages);
1656
+ return e.set(t.messageId, t), new C({ messages: e });
1657
+ }
1658
+ onMessage(t) {
1659
+ switch (t.eventType) {
1660
+ case h.MESSAGE_START:
1661
+ return this.onMessageStart(
1662
+ t
1663
+ );
1664
+ case h.MESSAGE_DELTA:
1665
+ return this.onMessageDelta(
1666
+ t
1667
+ );
1668
+ case h.MESSAGE_COMPLETE:
1669
+ return this.onMessageComplete(
1670
+ t
1671
+ );
1672
+ case h.ERROR:
1673
+ return this.onMessageError(t);
1674
+ default:
1675
+ return this;
1676
+ }
1677
+ }
1678
+ onMessageStart(t) {
1679
+ const e = t.fact.messageStart.message, r = new Map(this.messages);
1680
+ return r.set(e.messageId, {
1681
+ type: "bot",
1682
+ eventType: h.MESSAGE_START,
1683
+ isTyping: !0,
1684
+ typingText: "",
1685
+ messageId: e.messageId,
1686
+ message: e,
1687
+ time: /* @__PURE__ */ new Date()
1688
+ }), new C({ messages: r });
1689
+ }
1690
+ onMessageDelta(t) {
1691
+ const e = t.fact.messageDelta.message, r = new Map(this.messages), i = r.get(e.messageId);
1692
+ if ((i == null ? void 0 : i.type) !== "bot") return this;
1693
+ const o = `${(i == null ? void 0 : i.typingText) ?? ""}${e.text}`;
1694
+ return r.set(e.messageId, {
1695
+ type: "bot",
1696
+ eventType: h.MESSAGE_DELTA,
1697
+ isTyping: !0,
1698
+ typingText: o,
1699
+ messageId: e.messageId,
1700
+ message: e,
1701
+ time: /* @__PURE__ */ new Date()
1702
+ }), new C({ messages: r });
1703
+ }
1704
+ onMessageComplete(t) {
1705
+ const e = t.fact.messageComplete.message, r = new Map(this.messages);
1706
+ return r.set(e.messageId, {
1707
+ type: "bot",
1708
+ eventType: h.MESSAGE_COMPLETE,
1709
+ isTyping: !1,
1710
+ typingText: null,
1711
+ messageId: e.messageId,
1712
+ message: e,
1713
+ time: /* @__PURE__ */ new Date()
1714
+ }), new C({ messages: r });
1715
+ }
1716
+ onMessageError(t) {
1717
+ const e = crypto.randomUUID(), r = t.fact.runError.error, i = new Map(this.messages);
1718
+ return i.set(e, {
1719
+ type: "error",
1720
+ eventType: h.ERROR,
1721
+ messageId: e,
1722
+ error: r,
1723
+ time: /* @__PURE__ */ new Date()
1724
+ }), new C({ messages: i });
1725
+ }
1726
+ }
1620
1727
  export {
1621
- rn as AsgardServiceClient,
1622
- Ye as EventType,
1623
- C as FetchSSEAction,
1624
- Be as MessageTemplateType
1728
+ zt as AsgardServiceClient,
1729
+ Re as Channel,
1730
+ C as Conversation,
1731
+ h as EventType,
1732
+ K as FetchSseAction,
1733
+ Ne as MessageTemplateType
1625
1734
  };
1626
1735
  //# sourceMappingURL=index.mjs.map