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