@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.
- package/README.md +329 -6
- package/dist/constants/enum.d.ts +12 -3
- package/dist/constants/enum.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1119 -1010
- package/dist/index.mjs.map +1 -1
- package/dist/lib/channel.d.ts +19 -0
- package/dist/lib/channel.d.ts.map +1 -0
- package/dist/lib/client.d.ts +11 -13
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/conversation.d.ts +18 -0
- package/dist/lib/conversation.d.ts.map +1 -0
- package/dist/lib/create-sse-observable.d.ts +7 -6
- package/dist/lib/create-sse-observable.d.ts.map +1 -1
- package/dist/lib/event-emitter.d.ts +8 -0
- package/dist/lib/event-emitter.d.ts.map +1 -0
- package/dist/types/channel.d.ts +42 -0
- package/dist/types/channel.d.ts.map +1 -0
- package/dist/types/client.d.ts +62 -16
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/event-emitter.d.ts +5 -0
- package/dist/types/event-emitter.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/sse-response.d.ts +60 -11
- package/dist/types/sse-response.d.ts.map +1 -1
- package/eslint.config.cjs +22 -0
- package/package.json +13 -1
- package/src/constants/enum.ts +32 -0
- package/src/index.ts +11 -0
- package/src/lib/channel.ts +153 -0
- package/src/lib/client.spec.ts +150 -0
- package/src/lib/client.ts +141 -0
- package/src/lib/conversation.ts +120 -0
- package/src/lib/create-sse-observable.ts +77 -0
- package/src/lib/event-emitter.ts +30 -0
- package/src/types/channel.ts +50 -0
- package/src/types/client.ts +89 -0
- package/src/types/event-emitter.ts +8 -0
- package/src/types/index.ts +4 -0
- package/src/types/sse-response.ts +176 -0
- package/tsconfig.json +13 -0
- package/tsconfig.lib.json +28 -0
- package/tsconfig.spec.json +33 -0
- package/vite.config.ts +80 -0
package/dist/index.mjs
CHANGED
|
@@ -1,754 +1,525 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
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(
|
|
9
|
+
}, Y(n, t);
|
|
239
10
|
};
|
|
240
|
-
function
|
|
241
|
-
if (typeof
|
|
242
|
-
throw new TypeError("Class extends value " + String(
|
|
243
|
-
Y(
|
|
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 =
|
|
16
|
+
this.constructor = n;
|
|
246
17
|
}
|
|
247
|
-
|
|
18
|
+
n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
|
|
248
19
|
}
|
|
249
|
-
function
|
|
20
|
+
function $e(n, t, e, r) {
|
|
250
21
|
function i(o) {
|
|
251
|
-
return o instanceof e ? o : new e(function(
|
|
252
|
-
|
|
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,
|
|
256
|
-
function
|
|
26
|
+
return new (e || (e = Promise))(function(o, s) {
|
|
27
|
+
function c(f) {
|
|
257
28
|
try {
|
|
258
|
-
|
|
29
|
+
u(r.next(f));
|
|
259
30
|
} catch (y) {
|
|
260
|
-
|
|
31
|
+
s(y);
|
|
261
32
|
}
|
|
262
33
|
}
|
|
263
|
-
function f
|
|
34
|
+
function a(f) {
|
|
264
35
|
try {
|
|
265
|
-
|
|
36
|
+
u(r.throw(f));
|
|
266
37
|
} catch (y) {
|
|
267
|
-
|
|
38
|
+
s(y);
|
|
268
39
|
}
|
|
269
40
|
}
|
|
270
|
-
function
|
|
271
|
-
|
|
41
|
+
function u(f) {
|
|
42
|
+
f.done ? o(f.value) : i(f.value).then(c, a);
|
|
272
43
|
}
|
|
273
|
-
|
|
44
|
+
u((r = r.apply(n, t || [])).next());
|
|
274
45
|
});
|
|
275
46
|
}
|
|
276
|
-
function
|
|
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,
|
|
281
|
-
return
|
|
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
|
-
}),
|
|
284
|
-
function
|
|
285
|
-
return function(
|
|
286
|
-
return
|
|
54
|
+
}), s;
|
|
55
|
+
function c(u) {
|
|
56
|
+
return function(f) {
|
|
57
|
+
return a([u, f]);
|
|
287
58
|
};
|
|
288
59
|
}
|
|
289
|
-
function
|
|
60
|
+
function a(u) {
|
|
290
61
|
if (r) throw new TypeError("Generator is already executing.");
|
|
291
|
-
for (;
|
|
292
|
-
if (r = 1, i && (o =
|
|
293
|
-
switch (i = 0, o && (
|
|
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 =
|
|
67
|
+
o = u;
|
|
297
68
|
break;
|
|
298
69
|
case 4:
|
|
299
|
-
return e.label++, { value:
|
|
70
|
+
return e.label++, { value: u[1], done: !1 };
|
|
300
71
|
case 5:
|
|
301
|
-
e.label++, i =
|
|
72
|
+
e.label++, i = u[1], u = [0];
|
|
302
73
|
continue;
|
|
303
74
|
case 7:
|
|
304
|
-
|
|
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]) && (
|
|
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 (
|
|
312
|
-
e.label =
|
|
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 (
|
|
316
|
-
e.label = o[1], o =
|
|
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(
|
|
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
|
-
|
|
327
|
-
} catch (
|
|
328
|
-
|
|
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 (
|
|
333
|
-
return { value:
|
|
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
|
|
337
|
-
var
|
|
338
|
-
if (e) return e.call(
|
|
339
|
-
if (
|
|
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
|
|
112
|
+
return n && r >= n.length && (n = void 0), { value: n && n[r++], done: !n };
|
|
342
113
|
}
|
|
343
114
|
};
|
|
344
|
-
throw new TypeError(
|
|
115
|
+
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
345
116
|
}
|
|
346
|
-
function
|
|
347
|
-
var e = typeof Symbol == "function" &&
|
|
348
|
-
if (!e) return
|
|
349
|
-
var r = e.call(
|
|
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 (; (
|
|
352
|
-
} catch (
|
|
353
|
-
|
|
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 (
|
|
129
|
+
if (s) throw s.error;
|
|
359
130
|
}
|
|
360
131
|
}
|
|
361
132
|
return o;
|
|
362
133
|
}
|
|
363
|
-
function
|
|
364
|
-
if (e || arguments.length === 2) for (var r = 0, i =
|
|
365
|
-
(o || !(r in
|
|
366
|
-
return
|
|
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
|
|
369
|
-
return this instanceof
|
|
139
|
+
function P(n) {
|
|
140
|
+
return this instanceof P ? (this.v = n, this) : new P(n);
|
|
370
141
|
}
|
|
371
|
-
function
|
|
142
|
+
function Ge(n, t, e) {
|
|
372
143
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
373
|
-
var r = e.apply(
|
|
374
|
-
return i = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype),
|
|
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
|
|
378
|
-
return function(
|
|
379
|
-
return Promise.resolve(
|
|
148
|
+
function s(l) {
|
|
149
|
+
return function(v) {
|
|
150
|
+
return Promise.resolve(v).then(l, y);
|
|
380
151
|
};
|
|
381
152
|
}
|
|
382
|
-
function
|
|
383
|
-
r[
|
|
384
|
-
return new Promise(function(
|
|
385
|
-
o.push([
|
|
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
|
-
},
|
|
158
|
+
}, v && (i[l] = v(i[l])));
|
|
388
159
|
}
|
|
389
|
-
function
|
|
160
|
+
function a(l, v) {
|
|
390
161
|
try {
|
|
391
|
-
|
|
392
|
-
} catch (
|
|
393
|
-
|
|
162
|
+
u(r[l](v));
|
|
163
|
+
} catch (d) {
|
|
164
|
+
b(o[0][3], d);
|
|
394
165
|
}
|
|
395
166
|
}
|
|
396
|
-
function
|
|
397
|
-
|
|
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
|
|
400
|
-
|
|
170
|
+
function f(l) {
|
|
171
|
+
a("next", l);
|
|
401
172
|
}
|
|
402
|
-
function y(
|
|
403
|
-
|
|
173
|
+
function y(l) {
|
|
174
|
+
a("throw", l);
|
|
404
175
|
}
|
|
405
|
-
function
|
|
406
|
-
|
|
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
|
|
180
|
+
function Fe(n) {
|
|
410
181
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
411
|
-
var
|
|
412
|
-
return
|
|
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] =
|
|
417
|
-
return new Promise(function(
|
|
418
|
-
|
|
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,
|
|
423
|
-
Promise.resolve(
|
|
424
|
-
o({ value:
|
|
425
|
-
},
|
|
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
|
|
429
|
-
return typeof
|
|
199
|
+
function p(n) {
|
|
200
|
+
return typeof n == "function";
|
|
430
201
|
}
|
|
431
|
-
function
|
|
432
|
-
var
|
|
202
|
+
function fe(n) {
|
|
203
|
+
var t = function(r) {
|
|
433
204
|
Error.call(r), r.stack = new Error().stack;
|
|
434
|
-
}, e = t
|
|
205
|
+
}, e = n(t);
|
|
435
206
|
return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
|
|
436
207
|
}
|
|
437
|
-
var
|
|
208
|
+
var B = fe(function(n) {
|
|
438
209
|
return function(e) {
|
|
439
|
-
|
|
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
|
|
447
|
-
if (
|
|
448
|
-
var e =
|
|
449
|
-
0 <= e &&
|
|
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
|
|
453
|
-
function t
|
|
454
|
-
this.initialTeardown =
|
|
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
|
|
457
|
-
var
|
|
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
|
|
461
|
-
if (
|
|
462
|
-
if (this._parentage = null, Array.isArray(
|
|
231
|
+
var s = this._parentage;
|
|
232
|
+
if (s)
|
|
233
|
+
if (this._parentage = null, Array.isArray(s))
|
|
463
234
|
try {
|
|
464
|
-
for (var
|
|
465
|
-
var
|
|
466
|
-
|
|
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 (
|
|
469
|
-
|
|
239
|
+
} catch (d) {
|
|
240
|
+
t = { error: d };
|
|
470
241
|
} finally {
|
|
471
242
|
try {
|
|
472
|
-
|
|
243
|
+
a && !a.done && (e = c.return) && e.call(c);
|
|
473
244
|
} finally {
|
|
474
|
-
if (
|
|
245
|
+
if (t) throw t.error;
|
|
475
246
|
}
|
|
476
247
|
}
|
|
477
248
|
else
|
|
478
|
-
|
|
479
|
-
var
|
|
480
|
-
if (
|
|
249
|
+
s.remove(this);
|
|
250
|
+
var f = this.initialTeardown;
|
|
251
|
+
if (p(f))
|
|
481
252
|
try {
|
|
482
|
-
|
|
483
|
-
} catch (
|
|
484
|
-
o =
|
|
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
|
|
491
|
-
var
|
|
261
|
+
for (var b = M(y), l = b.next(); !l.done; l = b.next()) {
|
|
262
|
+
var v = l.value;
|
|
492
263
|
try {
|
|
493
|
-
|
|
494
|
-
} catch (
|
|
495
|
-
o = o ?? [],
|
|
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 (
|
|
499
|
-
r = { error:
|
|
269
|
+
} catch (d) {
|
|
270
|
+
r = { error: d };
|
|
500
271
|
} finally {
|
|
501
272
|
try {
|
|
502
|
-
|
|
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
|
|
280
|
+
throw new B(o);
|
|
510
281
|
}
|
|
511
|
-
},
|
|
282
|
+
}, n.prototype.add = function(t) {
|
|
512
283
|
var e;
|
|
513
|
-
if (
|
|
284
|
+
if (t && t !== this)
|
|
514
285
|
if (this.closed)
|
|
515
|
-
|
|
286
|
+
ee(t);
|
|
516
287
|
else {
|
|
517
|
-
if (
|
|
518
|
-
if (
|
|
288
|
+
if (t instanceof n) {
|
|
289
|
+
if (t.closed || t._hasParent(this))
|
|
519
290
|
return;
|
|
520
|
-
|
|
291
|
+
t._addParent(this);
|
|
521
292
|
}
|
|
522
|
-
(this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(
|
|
293
|
+
(this._finalizers = (e = this._finalizers) !== null && e !== void 0 ? e : []).push(t);
|
|
523
294
|
}
|
|
524
|
-
},
|
|
295
|
+
}, n.prototype._hasParent = function(t) {
|
|
525
296
|
var e = this._parentage;
|
|
526
|
-
return e ===
|
|
527
|
-
},
|
|
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(
|
|
530
|
-
},
|
|
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 ===
|
|
533
|
-
},
|
|
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 &&
|
|
536
|
-
},
|
|
537
|
-
var
|
|
538
|
-
return
|
|
539
|
-
}(),
|
|
540
|
-
}(),
|
|
541
|
-
function
|
|
542
|
-
return
|
|
543
|
-
}
|
|
544
|
-
function
|
|
545
|
-
|
|
546
|
-
}
|
|
547
|
-
var
|
|
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
|
-
},
|
|
554
|
-
setTimeout: function(
|
|
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,
|
|
328
|
+
return setTimeout.apply(void 0, R([n, t], L(e)));
|
|
558
329
|
},
|
|
559
|
-
clearTimeout: function(
|
|
560
|
-
var
|
|
561
|
-
return ((
|
|
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
|
|
566
|
-
|
|
567
|
-
throw
|
|
336
|
+
function ye(n) {
|
|
337
|
+
he.setTimeout(function() {
|
|
338
|
+
throw n;
|
|
568
339
|
});
|
|
569
340
|
}
|
|
570
|
-
function
|
|
341
|
+
function q() {
|
|
571
342
|
}
|
|
572
|
-
function
|
|
573
|
-
|
|
343
|
+
function U(n) {
|
|
344
|
+
n();
|
|
574
345
|
}
|
|
575
|
-
var X = function(
|
|
576
|
-
|
|
577
|
-
function
|
|
578
|
-
var r =
|
|
579
|
-
return r.isStopped = !1, e ? (r.destination = e,
|
|
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
|
|
582
|
-
return new
|
|
583
|
-
},
|
|
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
|
-
},
|
|
356
|
+
}, t.prototype.error = function(e) {
|
|
586
357
|
this.isStopped || (this.isStopped = !0, this._error(e));
|
|
587
|
-
},
|
|
358
|
+
}, t.prototype.complete = function() {
|
|
588
359
|
this.isStopped || (this.isStopped = !0, this._complete());
|
|
589
|
-
},
|
|
590
|
-
this.closed || (this.isStopped = !0,
|
|
591
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
370
|
+
}, t.prototype._complete = function() {
|
|
600
371
|
try {
|
|
601
372
|
this.destination.complete();
|
|
602
373
|
} finally {
|
|
603
374
|
this.unsubscribe();
|
|
604
375
|
}
|
|
605
|
-
},
|
|
606
|
-
}(
|
|
607
|
-
function t
|
|
608
|
-
this.partialObserver =
|
|
376
|
+
}, t;
|
|
377
|
+
}(k), Ve = function() {
|
|
378
|
+
function n(t) {
|
|
379
|
+
this.partialObserver = t;
|
|
609
380
|
}
|
|
610
|
-
return
|
|
381
|
+
return n.prototype.next = function(t) {
|
|
611
382
|
var e = this.partialObserver;
|
|
612
383
|
if (e.next)
|
|
613
384
|
try {
|
|
614
|
-
e.next(
|
|
385
|
+
e.next(t);
|
|
615
386
|
} catch (r) {
|
|
616
|
-
|
|
387
|
+
D(r);
|
|
617
388
|
}
|
|
618
|
-
},
|
|
389
|
+
}, n.prototype.error = function(t) {
|
|
619
390
|
var e = this.partialObserver;
|
|
620
391
|
if (e.error)
|
|
621
392
|
try {
|
|
622
|
-
e.error(
|
|
393
|
+
e.error(t);
|
|
623
394
|
} catch (r) {
|
|
624
|
-
|
|
395
|
+
D(r);
|
|
625
396
|
}
|
|
626
397
|
else
|
|
627
|
-
|
|
628
|
-
},
|
|
629
|
-
var
|
|
630
|
-
if (
|
|
398
|
+
D(t);
|
|
399
|
+
}, n.prototype.complete = function() {
|
|
400
|
+
var t = this.partialObserver;
|
|
401
|
+
if (t.complete)
|
|
631
402
|
try {
|
|
632
|
-
|
|
403
|
+
t.complete();
|
|
633
404
|
} catch (e) {
|
|
634
|
-
|
|
405
|
+
D(e);
|
|
635
406
|
}
|
|
636
|
-
},
|
|
637
|
-
}(),
|
|
638
|
-
|
|
639
|
-
function
|
|
640
|
-
var o =
|
|
641
|
-
return
|
|
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
|
-
} :
|
|
416
|
+
} : s = e, o.destination = new Ve(s), o;
|
|
646
417
|
}
|
|
647
|
-
return
|
|
418
|
+
return t;
|
|
648
419
|
}(X);
|
|
649
|
-
function
|
|
650
|
-
|
|
420
|
+
function D(n) {
|
|
421
|
+
ye(n);
|
|
651
422
|
}
|
|
652
|
-
function
|
|
653
|
-
throw
|
|
423
|
+
function Be(n) {
|
|
424
|
+
throw n;
|
|
654
425
|
}
|
|
655
|
-
var
|
|
426
|
+
var Ke = {
|
|
656
427
|
closed: !0,
|
|
657
|
-
next:
|
|
658
|
-
error:
|
|
659
|
-
complete:
|
|
660
|
-
},
|
|
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
|
|
664
|
-
return
|
|
434
|
+
function G(n) {
|
|
435
|
+
return n;
|
|
665
436
|
}
|
|
666
|
-
function
|
|
667
|
-
return
|
|
668
|
-
return
|
|
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
|
|
674
|
-
function t
|
|
675
|
-
|
|
444
|
+
var S = function() {
|
|
445
|
+
function n(t) {
|
|
446
|
+
t && (this._subscribe = t);
|
|
676
447
|
}
|
|
677
|
-
return
|
|
678
|
-
var e = new
|
|
679
|
-
return e.source = this, e.operator =
|
|
680
|
-
},
|
|
681
|
-
var i = this, o =
|
|
682
|
-
return
|
|
683
|
-
var
|
|
684
|
-
o.add(
|
|
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
|
-
},
|
|
457
|
+
}, n.prototype._trySubscribe = function(t) {
|
|
687
458
|
try {
|
|
688
|
-
return this._subscribe(
|
|
459
|
+
return this._subscribe(t);
|
|
689
460
|
} catch (e) {
|
|
690
|
-
|
|
461
|
+
t.error(e);
|
|
691
462
|
}
|
|
692
|
-
},
|
|
463
|
+
}, n.prototype.forEach = function(t, e) {
|
|
693
464
|
var r = this;
|
|
694
|
-
return e =
|
|
695
|
-
var
|
|
696
|
-
next: function(
|
|
465
|
+
return e = te(e), new e(function(i, o) {
|
|
466
|
+
var s = new W({
|
|
467
|
+
next: function(c) {
|
|
697
468
|
try {
|
|
698
|
-
|
|
699
|
-
} catch (
|
|
700
|
-
o(
|
|
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(
|
|
477
|
+
r.subscribe(s);
|
|
707
478
|
});
|
|
708
|
-
},
|
|
479
|
+
}, n.prototype._subscribe = function(t) {
|
|
709
480
|
var e;
|
|
710
|
-
return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(
|
|
711
|
-
},
|
|
481
|
+
return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(t);
|
|
482
|
+
}, n.prototype[z] = function() {
|
|
712
483
|
return this;
|
|
713
|
-
},
|
|
714
|
-
for (var
|
|
715
|
-
|
|
716
|
-
return
|
|
717
|
-
},
|
|
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
|
|
490
|
+
return t = te(t), new t(function(r, i) {
|
|
720
491
|
var o;
|
|
721
|
-
e.subscribe(function(
|
|
722
|
-
return o =
|
|
723
|
-
}, function(
|
|
724
|
-
return i(
|
|
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
|
-
},
|
|
730
|
-
return new t
|
|
731
|
-
},
|
|
500
|
+
}, n.create = function(t) {
|
|
501
|
+
return new n(t);
|
|
502
|
+
}, n;
|
|
732
503
|
}();
|
|
733
|
-
function
|
|
734
|
-
var
|
|
735
|
-
return (
|
|
504
|
+
function te(n) {
|
|
505
|
+
var t;
|
|
506
|
+
return (t = n ?? He.Promise) !== null && t !== void 0 ? t : Promise;
|
|
736
507
|
}
|
|
737
|
-
function
|
|
738
|
-
return
|
|
508
|
+
function qe(n) {
|
|
509
|
+
return n && p(n.next) && p(n.error) && p(n.complete);
|
|
739
510
|
}
|
|
740
|
-
function
|
|
741
|
-
return
|
|
511
|
+
function We(n) {
|
|
512
|
+
return n && n instanceof X || qe(n) && de(n);
|
|
742
513
|
}
|
|
743
|
-
function
|
|
744
|
-
return
|
|
514
|
+
function Je(n) {
|
|
515
|
+
return p(n == null ? void 0 : n.lift);
|
|
745
516
|
}
|
|
746
|
-
function
|
|
747
|
-
return function(
|
|
748
|
-
if (
|
|
749
|
-
return
|
|
517
|
+
function T(n) {
|
|
518
|
+
return function(t) {
|
|
519
|
+
if (Je(t))
|
|
520
|
+
return t.lift(function(e) {
|
|
750
521
|
try {
|
|
751
|
-
return
|
|
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
|
|
760
|
-
return new
|
|
530
|
+
function E(n, t, e, r, i) {
|
|
531
|
+
return new Xe(n, t, e, r, i);
|
|
761
532
|
}
|
|
762
|
-
var
|
|
763
|
-
|
|
764
|
-
function
|
|
765
|
-
var
|
|
766
|
-
return
|
|
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(
|
|
769
|
-
} catch (
|
|
770
|
-
e.error(
|
|
539
|
+
r(u);
|
|
540
|
+
} catch (f) {
|
|
541
|
+
e.error(f);
|
|
771
542
|
}
|
|
772
|
-
} :
|
|
543
|
+
} : n.prototype._next, a._error = o ? function(u) {
|
|
773
544
|
try {
|
|
774
|
-
o(
|
|
775
|
-
} catch (
|
|
776
|
-
e.error(
|
|
545
|
+
o(u);
|
|
546
|
+
} catch (f) {
|
|
547
|
+
e.error(f);
|
|
777
548
|
} finally {
|
|
778
549
|
this.unsubscribe();
|
|
779
550
|
}
|
|
780
|
-
} :
|
|
551
|
+
} : n.prototype._error, a._complete = i ? function() {
|
|
781
552
|
try {
|
|
782
553
|
i();
|
|
783
|
-
} catch (
|
|
784
|
-
e.error(
|
|
554
|
+
} catch (u) {
|
|
555
|
+
e.error(u);
|
|
785
556
|
} finally {
|
|
786
557
|
this.unsubscribe();
|
|
787
558
|
}
|
|
788
|
-
} :
|
|
559
|
+
} : n.prototype._complete, a;
|
|
789
560
|
}
|
|
790
|
-
return
|
|
561
|
+
return t.prototype.unsubscribe = function() {
|
|
791
562
|
var e;
|
|
792
563
|
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
793
564
|
var r = this.closed;
|
|
794
|
-
|
|
565
|
+
n.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
|
|
795
566
|
}
|
|
796
|
-
},
|
|
797
|
-
}(X),
|
|
567
|
+
}, t;
|
|
568
|
+
}(X), ze = fe(function(n) {
|
|
798
569
|
return function() {
|
|
799
|
-
|
|
570
|
+
n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
800
571
|
};
|
|
801
|
-
}),
|
|
802
|
-
|
|
803
|
-
function
|
|
804
|
-
var e =
|
|
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
|
|
808
|
-
var r = new
|
|
578
|
+
return t.prototype.lift = function(e) {
|
|
579
|
+
var r = new ne(this, this);
|
|
809
580
|
return r.operator = e, r;
|
|
810
|
-
},
|
|
581
|
+
}, t.prototype._throwIfClosed = function() {
|
|
811
582
|
if (this.closed)
|
|
812
|
-
throw new
|
|
813
|
-
},
|
|
583
|
+
throw new ze();
|
|
584
|
+
}, t.prototype.next = function(e) {
|
|
814
585
|
var r = this;
|
|
815
|
-
|
|
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
|
|
821
|
-
var
|
|
822
|
-
|
|
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 (
|
|
825
|
-
i = { error:
|
|
595
|
+
} catch (u) {
|
|
596
|
+
i = { error: u };
|
|
826
597
|
} finally {
|
|
827
598
|
try {
|
|
828
|
-
|
|
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
|
-
},
|
|
606
|
+
}, t.prototype.error = function(e) {
|
|
836
607
|
var r = this;
|
|
837
|
-
|
|
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
|
-
},
|
|
615
|
+
}, t.prototype.complete = function() {
|
|
845
616
|
var e = this;
|
|
846
|
-
|
|
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
|
-
},
|
|
624
|
+
}, t.prototype.unsubscribe = function() {
|
|
854
625
|
this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
|
|
855
|
-
}, Object.defineProperty(
|
|
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
|
-
}),
|
|
863
|
-
return this._throwIfClosed(),
|
|
864
|
-
},
|
|
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
|
-
},
|
|
867
|
-
var r = this, i = this, o = i.hasError,
|
|
868
|
-
return o ||
|
|
869
|
-
r.currentObservers = null,
|
|
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
|
-
},
|
|
872
|
-
var r = this, i = r.hasError, o = r.thrownError,
|
|
873
|
-
i ? e.error(o) :
|
|
874
|
-
},
|
|
875
|
-
var e = new
|
|
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
|
-
},
|
|
878
|
-
return new
|
|
879
|
-
},
|
|
880
|
-
}(
|
|
881
|
-
|
|
882
|
-
function
|
|
883
|
-
var i =
|
|
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
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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 :
|
|
898
|
-
},
|
|
899
|
-
}(
|
|
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
|
-
},
|
|
905
|
-
|
|
906
|
-
function
|
|
907
|
-
return
|
|
698
|
+
}, Ze = function(n) {
|
|
699
|
+
O(t, n);
|
|
700
|
+
function t(e, r) {
|
|
701
|
+
return n.call(this) || this;
|
|
908
702
|
}
|
|
909
|
-
return
|
|
703
|
+
return t.prototype.schedule = function(e, r) {
|
|
910
704
|
return this;
|
|
911
|
-
},
|
|
912
|
-
}(
|
|
913
|
-
setInterval: function(
|
|
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,
|
|
710
|
+
return setInterval.apply(void 0, R([n, t], L(e)));
|
|
917
711
|
},
|
|
918
|
-
clearInterval: function(
|
|
919
|
-
return clearInterval(
|
|
712
|
+
clearInterval: function(n) {
|
|
713
|
+
return clearInterval(n);
|
|
920
714
|
},
|
|
921
715
|
delegate: void 0
|
|
922
|
-
},
|
|
923
|
-
|
|
924
|
-
function
|
|
925
|
-
var i =
|
|
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
|
|
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,
|
|
934
|
-
return o != null && (this.id = this.recycleAsyncId(
|
|
935
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
743
|
+
}, t.prototype._execute = function(e, r) {
|
|
950
744
|
var i = !1, o;
|
|
951
745
|
try {
|
|
952
746
|
this.work(e);
|
|
953
|
-
} catch (
|
|
954
|
-
i = !0, o =
|
|
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
|
-
},
|
|
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,
|
|
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
|
-
},
|
|
964
|
-
}(
|
|
965
|
-
function t
|
|
966
|
-
e === void 0 && (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
|
|
969
|
-
return e === void 0 && (e = 0), new this.schedulerActionCtor(this,
|
|
970
|
-
},
|
|
971
|
-
}(),
|
|
972
|
-
|
|
973
|
-
function
|
|
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 =
|
|
769
|
+
var i = n.call(this, e, r) || this;
|
|
976
770
|
return i.actions = [], i._active = !1, i;
|
|
977
771
|
}
|
|
978
|
-
return
|
|
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
|
-
},
|
|
996
|
-
}(oe),
|
|
997
|
-
return
|
|
789
|
+
}, t;
|
|
790
|
+
}(oe), ve = new tt(et), nt = ve, rt = new S(function(n) {
|
|
791
|
+
return n.complete();
|
|
998
792
|
});
|
|
999
|
-
function
|
|
1000
|
-
return
|
|
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
|
|
1003
|
-
return
|
|
799
|
+
function it(n) {
|
|
800
|
+
return p(be(n)) ? n.pop() : void 0;
|
|
1004
801
|
}
|
|
1005
|
-
function
|
|
1006
|
-
return
|
|
802
|
+
function me(n) {
|
|
803
|
+
return pe(be(n)) ? n.pop() : void 0;
|
|
1007
804
|
}
|
|
1008
|
-
var
|
|
1009
|
-
return
|
|
805
|
+
var Se = function(n) {
|
|
806
|
+
return n && typeof n.length == "number" && typeof n != "function";
|
|
1010
807
|
};
|
|
1011
|
-
function
|
|
1012
|
-
return
|
|
808
|
+
function ge(n) {
|
|
809
|
+
return p(n == null ? void 0 : n.then);
|
|
1013
810
|
}
|
|
1014
|
-
function
|
|
1015
|
-
return
|
|
811
|
+
function we(n) {
|
|
812
|
+
return p(n[z]);
|
|
1016
813
|
}
|
|
1017
|
-
function
|
|
1018
|
-
return Symbol.asyncIterator &&
|
|
814
|
+
function Ee(n) {
|
|
815
|
+
return Symbol.asyncIterator && p(n == null ? void 0 : n[Symbol.asyncIterator]);
|
|
1019
816
|
}
|
|
1020
|
-
function
|
|
1021
|
-
return new TypeError("You provided " + (
|
|
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
|
|
820
|
+
function ot() {
|
|
1024
821
|
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
1025
822
|
}
|
|
1026
|
-
var
|
|
1027
|
-
function
|
|
1028
|
-
return
|
|
823
|
+
var Ie = ot();
|
|
824
|
+
function Ae(n) {
|
|
825
|
+
return p(n == null ? void 0 : n[Ie]);
|
|
1029
826
|
}
|
|
1030
|
-
function
|
|
1031
|
-
return
|
|
827
|
+
function xe(n) {
|
|
828
|
+
return Ge(this, arguments, function() {
|
|
1032
829
|
var e, r, i, o;
|
|
1033
|
-
return
|
|
1034
|
-
switch (
|
|
830
|
+
return ce(this, function(s) {
|
|
831
|
+
switch (s.label) {
|
|
1035
832
|
case 0:
|
|
1036
|
-
e =
|
|
833
|
+
e = n.getReader(), s.label = 1;
|
|
1037
834
|
case 1:
|
|
1038
|
-
|
|
835
|
+
s.trys.push([1, , 9, 10]), s.label = 2;
|
|
1039
836
|
case 2:
|
|
1040
|
-
return [4,
|
|
837
|
+
return [4, P(e.read())];
|
|
1041
838
|
case 3:
|
|
1042
|
-
return r =
|
|
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,
|
|
841
|
+
return [2, s.sent()];
|
|
1045
842
|
case 5:
|
|
1046
|
-
return [4,
|
|
843
|
+
return [4, P(i)];
|
|
1047
844
|
case 6:
|
|
1048
|
-
return [4,
|
|
845
|
+
return [4, s.sent()];
|
|
1049
846
|
case 7:
|
|
1050
|
-
return
|
|
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
|
|
1062
|
-
return
|
|
1063
|
-
}
|
|
1064
|
-
function
|
|
1065
|
-
if (
|
|
1066
|
-
return
|
|
1067
|
-
if (
|
|
1068
|
-
if (
|
|
1069
|
-
return
|
|
1070
|
-
if (
|
|
1071
|
-
return
|
|
1072
|
-
if (
|
|
1073
|
-
return
|
|
1074
|
-
if (
|
|
1075
|
-
return
|
|
1076
|
-
if (
|
|
1077
|
-
return
|
|
1078
|
-
if (
|
|
1079
|
-
return
|
|
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
|
|
878
|
+
throw Oe(n);
|
|
1082
879
|
}
|
|
1083
|
-
function
|
|
1084
|
-
return new
|
|
1085
|
-
var e =
|
|
1086
|
-
if (
|
|
1087
|
-
return e.subscribe(
|
|
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
|
|
1092
|
-
return new
|
|
1093
|
-
for (var e = 0; e <
|
|
1094
|
-
|
|
1095
|
-
|
|
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
|
|
1099
|
-
return new
|
|
1100
|
-
|
|
1101
|
-
|
|
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
|
|
1104
|
-
}).then(null,
|
|
900
|
+
return t.error(e);
|
|
901
|
+
}).then(null, ye);
|
|
1105
902
|
});
|
|
1106
903
|
}
|
|
1107
|
-
function
|
|
1108
|
-
return new
|
|
904
|
+
function ct(n) {
|
|
905
|
+
return new S(function(t) {
|
|
1109
906
|
var e, r;
|
|
1110
907
|
try {
|
|
1111
|
-
for (var i =
|
|
1112
|
-
var
|
|
1113
|
-
if (
|
|
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 (
|
|
1117
|
-
e = { error:
|
|
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
|
-
|
|
922
|
+
t.complete();
|
|
1126
923
|
});
|
|
1127
924
|
}
|
|
1128
|
-
function
|
|
1129
|
-
return new
|
|
1130
|
-
|
|
1131
|
-
return
|
|
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
|
|
1136
|
-
return
|
|
932
|
+
function ft(n) {
|
|
933
|
+
return Te(xe(n));
|
|
1137
934
|
}
|
|
1138
|
-
function
|
|
935
|
+
function lt(n, t) {
|
|
1139
936
|
var e, r, i, o;
|
|
1140
|
-
return
|
|
1141
|
-
var
|
|
1142
|
-
return
|
|
1143
|
-
switch (
|
|
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
|
-
|
|
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 =
|
|
1150
|
-
if (
|
|
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
|
-
|
|
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
|
|
955
|
+
return c = a.sent(), i = { error: c }, [3, 11];
|
|
1159
956
|
case 6:
|
|
1160
|
-
return
|
|
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
|
-
|
|
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
|
|
968
|
+
return t.complete(), [2];
|
|
1172
969
|
}
|
|
1173
970
|
});
|
|
1174
971
|
});
|
|
1175
972
|
}
|
|
1176
|
-
function
|
|
973
|
+
function A(n, t, e, r, i) {
|
|
1177
974
|
r === void 0 && (r = 0), i === void 0 && (i = !1);
|
|
1178
|
-
var o =
|
|
1179
|
-
e(), i ?
|
|
975
|
+
var o = t.schedule(function() {
|
|
976
|
+
e(), i ? n.add(this.schedule(null, r)) : this.unsubscribe();
|
|
1180
977
|
}, r);
|
|
1181
|
-
if (
|
|
978
|
+
if (n.add(o), !i)
|
|
1182
979
|
return o;
|
|
1183
980
|
}
|
|
1184
|
-
function
|
|
1185
|
-
return
|
|
1186
|
-
e.subscribe(
|
|
1187
|
-
return
|
|
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
|
-
},
|
|
986
|
+
}, t);
|
|
1190
987
|
}, function() {
|
|
1191
|
-
return
|
|
988
|
+
return A(r, n, function() {
|
|
1192
989
|
return r.complete();
|
|
1193
|
-
},
|
|
990
|
+
}, t);
|
|
1194
991
|
}, function(i) {
|
|
1195
|
-
return
|
|
992
|
+
return A(r, n, function() {
|
|
1196
993
|
return r.error(i);
|
|
1197
|
-
},
|
|
994
|
+
}, t);
|
|
1198
995
|
}));
|
|
1199
996
|
});
|
|
1200
997
|
}
|
|
1201
|
-
function
|
|
1202
|
-
return
|
|
1203
|
-
r.add(
|
|
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
|
-
},
|
|
1002
|
+
}, t));
|
|
1206
1003
|
});
|
|
1207
1004
|
}
|
|
1208
|
-
function
|
|
1209
|
-
return
|
|
1005
|
+
function dt(n, t) {
|
|
1006
|
+
return x(n).pipe(Pe(t), Ce(t));
|
|
1210
1007
|
}
|
|
1211
|
-
function
|
|
1212
|
-
return
|
|
1008
|
+
function ht(n, t) {
|
|
1009
|
+
return x(n).pipe(Pe(t), Ce(t));
|
|
1213
1010
|
}
|
|
1214
|
-
function
|
|
1215
|
-
return new
|
|
1011
|
+
function yt(n, t) {
|
|
1012
|
+
return new S(function(e) {
|
|
1216
1013
|
var r = 0;
|
|
1217
|
-
return
|
|
1218
|
-
r ===
|
|
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
|
|
1223
|
-
return new
|
|
1019
|
+
function vt(n, t) {
|
|
1020
|
+
return new S(function(e) {
|
|
1224
1021
|
var r;
|
|
1225
|
-
return
|
|
1226
|
-
r =
|
|
1227
|
-
var i, o,
|
|
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,
|
|
1230
|
-
} catch (
|
|
1231
|
-
e.error(
|
|
1026
|
+
i = r.next(), o = i.value, s = i.done;
|
|
1027
|
+
} catch (c) {
|
|
1028
|
+
e.error(c);
|
|
1232
1029
|
return;
|
|
1233
1030
|
}
|
|
1234
|
-
|
|
1031
|
+
s ? e.complete() : e.next(o);
|
|
1235
1032
|
}, 0, !0);
|
|
1236
1033
|
}), function() {
|
|
1237
|
-
return
|
|
1034
|
+
return p(r == null ? void 0 : r.return) && r.return();
|
|
1238
1035
|
};
|
|
1239
1036
|
});
|
|
1240
1037
|
}
|
|
1241
|
-
function
|
|
1242
|
-
if (!
|
|
1038
|
+
function Me(n, t) {
|
|
1039
|
+
if (!n)
|
|
1243
1040
|
throw new Error("Iterable cannot be null");
|
|
1244
|
-
return new
|
|
1245
|
-
|
|
1246
|
-
var r =
|
|
1247
|
-
|
|
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
|
|
1256
|
-
return
|
|
1257
|
-
}
|
|
1258
|
-
function
|
|
1259
|
-
if (
|
|
1260
|
-
if (
|
|
1261
|
-
return
|
|
1262
|
-
if (
|
|
1263
|
-
return
|
|
1264
|
-
if (
|
|
1265
|
-
return
|
|
1266
|
-
if (
|
|
1267
|
-
return
|
|
1268
|
-
if (
|
|
1269
|
-
return
|
|
1270
|
-
if (
|
|
1271
|
-
return
|
|
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
|
|
1070
|
+
throw Oe(n);
|
|
1274
1071
|
}
|
|
1275
|
-
function
|
|
1276
|
-
return
|
|
1072
|
+
function Z(n, t) {
|
|
1073
|
+
return t ? bt(n, t) : x(n);
|
|
1277
1074
|
}
|
|
1278
|
-
function
|
|
1279
|
-
for (var
|
|
1280
|
-
t
|
|
1281
|
-
var e =
|
|
1282
|
-
return
|
|
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
|
|
1285
|
-
return
|
|
1081
|
+
function St(n) {
|
|
1082
|
+
return n instanceof Date && !isNaN(n);
|
|
1286
1083
|
}
|
|
1287
|
-
function
|
|
1288
|
-
return
|
|
1084
|
+
function F(n, t) {
|
|
1085
|
+
return T(function(e, r) {
|
|
1289
1086
|
var i = 0;
|
|
1290
|
-
e.subscribe(
|
|
1291
|
-
r.next(
|
|
1087
|
+
e.subscribe(E(r, function(o) {
|
|
1088
|
+
r.next(n.call(t, o, i++));
|
|
1292
1089
|
}));
|
|
1293
1090
|
});
|
|
1294
1091
|
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
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
|
-
|
|
1169
|
+
g = !0;
|
|
1307
1170
|
}, void 0, function() {
|
|
1308
|
-
if (
|
|
1171
|
+
if (g)
|
|
1309
1172
|
try {
|
|
1310
|
-
|
|
1173
|
+
u--;
|
|
1311
1174
|
for (var w = function() {
|
|
1312
|
-
var _ =
|
|
1313
|
-
|
|
1314
|
-
};
|
|
1175
|
+
var _ = a.shift();
|
|
1176
|
+
s || v(_);
|
|
1177
|
+
}; a.length && u < r; )
|
|
1315
1178
|
w();
|
|
1316
|
-
|
|
1179
|
+
b();
|
|
1317
1180
|
} catch (_) {
|
|
1318
|
-
|
|
1181
|
+
t.error(_);
|
|
1319
1182
|
}
|
|
1320
1183
|
}));
|
|
1321
1184
|
};
|
|
1322
|
-
return
|
|
1323
|
-
y = !0,
|
|
1185
|
+
return n.subscribe(E(t, l, function() {
|
|
1186
|
+
y = !0, b();
|
|
1324
1187
|
})), function() {
|
|
1325
1188
|
};
|
|
1326
1189
|
}
|
|
1327
|
-
function
|
|
1328
|
-
return e === void 0 && (e = 1 / 0),
|
|
1329
|
-
return
|
|
1330
|
-
return
|
|
1331
|
-
})(
|
|
1332
|
-
}, e) : (typeof
|
|
1333
|
-
return
|
|
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
|
|
1337
|
-
|
|
1199
|
+
function Le(n, t, e) {
|
|
1200
|
+
n === void 0 && (n = 0), e === void 0 && (e = nt);
|
|
1338
1201
|
var r = -1;
|
|
1339
|
-
return
|
|
1340
|
-
var o =
|
|
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
|
|
1205
|
+
var s = 0;
|
|
1343
1206
|
return e.schedule(function() {
|
|
1344
|
-
i.closed || (i.next(
|
|
1207
|
+
i.closed || (i.next(s++), 0 <= r ? this.schedule(void 0, r) : i.complete());
|
|
1345
1208
|
}, o);
|
|
1346
1209
|
});
|
|
1347
1210
|
}
|
|
1348
|
-
function
|
|
1349
|
-
return
|
|
1211
|
+
function Rt(n, t) {
|
|
1212
|
+
return p(t) ? $(n, t, 1) : $(n, 1);
|
|
1350
1213
|
}
|
|
1351
|
-
function
|
|
1352
|
-
return
|
|
1353
|
-
return
|
|
1354
|
-
} :
|
|
1214
|
+
function kt(n) {
|
|
1215
|
+
return n <= 0 ? function() {
|
|
1216
|
+
return rt;
|
|
1217
|
+
} : T(function(t, e) {
|
|
1355
1218
|
var r = 0;
|
|
1356
|
-
|
|
1357
|
-
++r <=
|
|
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
|
|
1362
|
-
return
|
|
1363
|
-
return
|
|
1224
|
+
function jt(n) {
|
|
1225
|
+
return F(function() {
|
|
1226
|
+
return n;
|
|
1364
1227
|
});
|
|
1365
1228
|
}
|
|
1366
|
-
function
|
|
1367
|
-
return
|
|
1368
|
-
return
|
|
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
|
|
1372
|
-
|
|
1373
|
-
var e =
|
|
1374
|
-
return
|
|
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
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
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
|
|
1388
|
-
return
|
|
1389
|
-
|
|
1273
|
+
function $t(n) {
|
|
1274
|
+
return T(function(t, e) {
|
|
1275
|
+
x(n).subscribe(E(e, function() {
|
|
1390
1276
|
return e.complete();
|
|
1391
|
-
},
|
|
1277
|
+
}, q)), !e.closed && t.subscribe(e);
|
|
1392
1278
|
});
|
|
1393
1279
|
}
|
|
1394
|
-
async function
|
|
1395
|
-
const e =
|
|
1280
|
+
async function Gt(n, t) {
|
|
1281
|
+
const e = n.getReader();
|
|
1396
1282
|
let r;
|
|
1397
1283
|
for (; !(r = await e.read()).done; )
|
|
1398
|
-
|
|
1399
|
-
}
|
|
1400
|
-
function
|
|
1401
|
-
let
|
|
1402
|
-
return function(
|
|
1403
|
-
|
|
1404
|
-
const
|
|
1405
|
-
let
|
|
1406
|
-
for (; e <
|
|
1407
|
-
i && (
|
|
1408
|
-
let
|
|
1409
|
-
for (; e <
|
|
1410
|
-
switch (
|
|
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 -
|
|
1298
|
+
r === -1 && (r = e - a);
|
|
1413
1299
|
break;
|
|
1414
1300
|
case 13:
|
|
1415
1301
|
i = !0;
|
|
1416
1302
|
case 10:
|
|
1417
|
-
|
|
1303
|
+
u = e;
|
|
1418
1304
|
break;
|
|
1419
1305
|
}
|
|
1420
|
-
if (
|
|
1306
|
+
if (u === -1)
|
|
1421
1307
|
break;
|
|
1422
|
-
t
|
|
1308
|
+
n(t.subarray(a, u), r), a = e, r = -1;
|
|
1423
1309
|
}
|
|
1424
|
-
|
|
1310
|
+
a === c ? t = void 0 : a !== 0 && (t = t.subarray(a), e -= a);
|
|
1425
1311
|
};
|
|
1426
1312
|
}
|
|
1427
|
-
function
|
|
1428
|
-
let r =
|
|
1313
|
+
function Ht(n, t, e) {
|
|
1314
|
+
let r = ue();
|
|
1429
1315
|
const i = new TextDecoder();
|
|
1430
|
-
return function(
|
|
1431
|
-
if (
|
|
1432
|
-
e == null || e(r), r =
|
|
1433
|
-
else if (
|
|
1434
|
-
const
|
|
1435
|
-
switch (
|
|
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
|
-
` +
|
|
1324
|
+
` + f : f;
|
|
1439
1325
|
break;
|
|
1440
1326
|
case "event":
|
|
1441
|
-
r.event =
|
|
1327
|
+
r.event = f;
|
|
1442
1328
|
break;
|
|
1443
1329
|
case "id":
|
|
1444
|
-
|
|
1330
|
+
n(r.id = f);
|
|
1445
1331
|
break;
|
|
1446
1332
|
case "retry":
|
|
1447
|
-
const y = parseInt(
|
|
1448
|
-
isNaN(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
|
|
1455
|
-
const e = new Uint8Array(
|
|
1456
|
-
return e.set(
|
|
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
|
|
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
|
|
1352
|
+
var Bt = function(n, t) {
|
|
1467
1353
|
var e = {};
|
|
1468
|
-
for (var r in
|
|
1469
|
-
if (
|
|
1470
|
-
for (var i = 0, r = Object.getOwnPropertySymbols(
|
|
1471
|
-
|
|
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
|
|
1475
|
-
function
|
|
1476
|
-
var { signal: e, headers: r, onopen: i, onmessage: o, onclose:
|
|
1477
|
-
return new Promise((y,
|
|
1478
|
-
const
|
|
1479
|
-
|
|
1480
|
-
let
|
|
1481
|
-
function
|
|
1482
|
-
|
|
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
|
-
|
|
1485
|
-
let
|
|
1370
|
+
a || document.addEventListener("visibilitychange", d);
|
|
1371
|
+
let g = Kt, w = 0;
|
|
1486
1372
|
function _() {
|
|
1487
|
-
document.removeEventListener("visibilitychange",
|
|
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
|
|
1493
|
-
async function
|
|
1494
|
-
var
|
|
1495
|
-
|
|
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
|
|
1498
|
-
await
|
|
1499
|
-
|
|
1500
|
-
}, (
|
|
1501
|
-
|
|
1502
|
-
}, o))),
|
|
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 (!
|
|
1390
|
+
if (!v.signal.aborted)
|
|
1505
1391
|
try {
|
|
1506
|
-
const
|
|
1507
|
-
window.clearTimeout(w), w = window.setTimeout(
|
|
1508
|
-
} catch (
|
|
1509
|
-
_(),
|
|
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
|
-
|
|
1399
|
+
H();
|
|
1514
1400
|
});
|
|
1515
1401
|
}
|
|
1516
|
-
function
|
|
1517
|
-
const
|
|
1518
|
-
if (!(
|
|
1519
|
-
throw new Error(`Expected content-type to be ${
|
|
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
|
|
1522
|
-
const { endpoint:
|
|
1523
|
-
return new
|
|
1524
|
-
const
|
|
1525
|
-
|
|
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:
|
|
1533
|
-
|
|
1534
|
-
|
|
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: (
|
|
1537
|
-
|
|
1430
|
+
onmessage: (f) => {
|
|
1431
|
+
o.next(JSON.parse(f.data));
|
|
1538
1432
|
},
|
|
1539
1433
|
onclose: () => {
|
|
1540
|
-
|
|
1434
|
+
o.complete();
|
|
1541
1435
|
},
|
|
1542
|
-
onerror: (
|
|
1543
|
-
|
|
1436
|
+
onerror: (f) => {
|
|
1437
|
+
throw o.error(f), s.abort(), f;
|
|
1544
1438
|
}
|
|
1545
1439
|
}), () => {
|
|
1546
|
-
|
|
1440
|
+
s.abort();
|
|
1547
1441
|
};
|
|
1548
1442
|
});
|
|
1549
1443
|
}
|
|
1550
|
-
class
|
|
1551
|
-
constructor(
|
|
1552
|
-
|
|
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(
|
|
1570
|
-
|
|
1571
|
-
|
|
1448
|
+
on(t, e) {
|
|
1449
|
+
this.listeners = Object.assign({}, this.listeners, {
|
|
1450
|
+
[t]: (this.listeners[t] ?? []).concat(e)
|
|
1451
|
+
});
|
|
1572
1452
|
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
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
|
-
|
|
1595
|
-
var r;
|
|
1596
|
-
|
|
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
|
-
|
|
1599
|
-
payload:
|
|
1534
|
+
debugMode: this.debugMode,
|
|
1535
|
+
payload: ((i = this.transformSsePayload) == null ? void 0 : i.call(this, t)) ?? t
|
|
1600
1536
|
}).pipe(
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
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: (
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
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
|
-
|
|
1622
|
-
|
|
1623
|
-
C as
|
|
1624
|
-
|
|
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
|