@asgard-js/core 0.2.36 → 0.2.37

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