@asgard-js/core 0.3.71 → 0.3.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +648 -668
- package/dist/index.mjs.map +1 -1
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/source-set-client.d.ts +2 -2
- package/dist/lib/source-set-client.d.ts.map +1 -1
- package/dist/lib/sse-pacing.spec.d.ts +2 -0
- package/dist/lib/sse-pacing.spec.d.ts.map +1 -0
- package/dist/types/client.d.ts +6 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/source-set-fs.d.ts +13 -0
- package/dist/types/source-set-fs.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class I extends Error {
|
|
2
2
|
status;
|
|
3
3
|
statusText;
|
|
4
4
|
/**
|
|
@@ -16,20 +16,20 @@ class w extends Error {
|
|
|
16
16
|
super(`HTTP ${t}: ${e}`), this.name = "HttpError", this.status = t, this.statusText = e, this.body = s;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return n instanceof
|
|
19
|
+
function An(n) {
|
|
20
|
+
return n instanceof I;
|
|
21
21
|
}
|
|
22
|
-
class
|
|
22
|
+
class te extends Error {
|
|
23
23
|
/** Which run is holding the channel. */
|
|
24
24
|
runKind;
|
|
25
25
|
constructor(t) {
|
|
26
26
|
super(`Cannot send a message while a "${t}" run is in flight on this channel.`), this.name = "ChannelBusyError", this.runKind = t;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return n instanceof
|
|
29
|
+
function On(n) {
|
|
30
|
+
return n instanceof te;
|
|
31
31
|
}
|
|
32
|
-
class
|
|
32
|
+
class ne extends Error {
|
|
33
33
|
/**
|
|
34
34
|
* The paused batch's process id, as carried by the pending consent prompt.
|
|
35
35
|
*
|
|
@@ -43,71 +43,71 @@ class te extends Error {
|
|
|
43
43
|
super("Cannot send this turn while the channel is awaiting a tool-call consent response."), this.name = "ChannelAwaitingConsentError", this.processId = t;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return n instanceof
|
|
46
|
+
function Pn(n) {
|
|
47
|
+
return n instanceof ne;
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
async function
|
|
49
|
+
var G = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n.NUDGE = "NUDGE", n))(G || {}), d = /* @__PURE__ */ ((n) => (n.INIT = "asgard.run.init", n.PROCESS = "asgard.process", n.PROCESS_START = "asgard.process.start", n.PROCESS_COMPLETE = "asgard.process.complete", n.MESSAGE = "asgard.message", n.MESSAGE_START = "asgard.message.start", n.MESSAGE_DELTA = "asgard.message.delta", n.MESSAGE_COMPLETE = "asgard.message.complete", n.MESSAGE_USER = "asgard.message.user", n.MESSAGE_THINKING_START = "asgard.message.thinking.start", n.MESSAGE_THINKING_DELTA = "asgard.message.thinking.delta", n.MESSAGE_THINKING_COMPLETE = "asgard.message.thinking.complete", n.MESSAGE_CANVAS_START = "asgard.message.canvas.start", n.MESSAGE_CANVAS_DELTA = "asgard.message.canvas.delta", n.MESSAGE_CANVAS_COMPLETE = "asgard.message.canvas.complete", n.TOOL_CALL = "asgard.tool_call", n.TOOL_CALL_START = "asgard.tool_call.start", n.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", n.TOOL_CALL_CONSENT = "asgard.tool_call.consent", n.SUBAGENT_START = "asgard.subagent.start", n.SUBAGENT_COMPLETE = "asgard.subagent.complete", n.CHANNEL_TITLE_UPDATE = "asgard.channel.title.update", n.PROMPT_SUGGESTION = "asgard.prompt_suggestion", n.SANDBOX_LAUNCH = "asgard.sandbox.launch", n.SANDBOX_READY = "asgard.sandbox.ready", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(d || {}), Ye = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(Ye || {}), Te = /* @__PURE__ */ ((n) => (n.TEXT = "TEXT", n.HINT = "HINT", n.BUTTON = "BUTTON", n.IMAGE = "IMAGE", n.VIDEO = "VIDEO", n.AUDIO = "AUDIO", n.LOCATION = "LOCATION", n.CAROUSEL = "CAROUSEL", n.CHART = "CHART", n.TABLE = "TABLE", n.ATTACHMENT = "ATTACHMENT", n.QUESTION = "QUESTION", n.CANVAS = "CANVAS", n))(Te || {});
|
|
50
|
+
async function ze(n, t) {
|
|
51
51
|
const e = n.getReader();
|
|
52
52
|
let s;
|
|
53
53
|
for (; !(s = await e.read()).done; )
|
|
54
54
|
t(s.value);
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function Je(n) {
|
|
57
57
|
let t, e, s, r = !1;
|
|
58
58
|
return function(o) {
|
|
59
|
-
t === void 0 ? (t = o, e = 0, s = -1) : t =
|
|
59
|
+
t === void 0 ? (t = o, e = 0, s = -1) : t = Ze(t, o);
|
|
60
60
|
const a = t.length;
|
|
61
|
-
let
|
|
61
|
+
let u = 0;
|
|
62
62
|
for (; e < a; ) {
|
|
63
|
-
r && (t[e] === 10 && (
|
|
64
|
-
let
|
|
65
|
-
for (; e < a &&
|
|
63
|
+
r && (t[e] === 10 && (u = ++e), r = !1);
|
|
64
|
+
let c = -1;
|
|
65
|
+
for (; e < a && c === -1; ++e)
|
|
66
66
|
switch (t[e]) {
|
|
67
67
|
case 58:
|
|
68
|
-
s === -1 && (s = e -
|
|
68
|
+
s === -1 && (s = e - u);
|
|
69
69
|
break;
|
|
70
70
|
case 13:
|
|
71
71
|
r = !0;
|
|
72
72
|
case 10:
|
|
73
|
-
|
|
73
|
+
c = e;
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
|
-
if (
|
|
76
|
+
if (c === -1)
|
|
77
77
|
break;
|
|
78
|
-
n(t.subarray(
|
|
78
|
+
n(t.subarray(u, c), s), u = e, s = -1;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
u === a ? t = void 0 : u !== 0 && (t = t.subarray(u), e -= u);
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function Qe(n, t, e) {
|
|
84
84
|
let s = le();
|
|
85
85
|
const r = new TextDecoder();
|
|
86
86
|
return function(o, a) {
|
|
87
87
|
if (o.length === 0)
|
|
88
88
|
e?.(s), s = le();
|
|
89
89
|
else if (a > 0) {
|
|
90
|
-
const
|
|
91
|
-
switch (
|
|
90
|
+
const u = r.decode(o.subarray(0, a)), c = a + (o[a + 1] === 32 ? 2 : 1), l = r.decode(o.subarray(c));
|
|
91
|
+
switch (u) {
|
|
92
92
|
case "data":
|
|
93
93
|
s.data = s.data ? s.data + `
|
|
94
|
-
` +
|
|
94
|
+
` + l : l;
|
|
95
95
|
break;
|
|
96
96
|
case "event":
|
|
97
|
-
s.event =
|
|
97
|
+
s.event = l;
|
|
98
98
|
break;
|
|
99
99
|
case "id":
|
|
100
|
-
n(s.id =
|
|
100
|
+
n(s.id = l);
|
|
101
101
|
break;
|
|
102
102
|
case "retry":
|
|
103
|
-
const m = parseInt(
|
|
103
|
+
const m = parseInt(l, 10);
|
|
104
104
|
isNaN(m) || t(s.retry = m);
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function Ze(n, t) {
|
|
111
111
|
const e = new Uint8Array(n.length + t.length);
|
|
112
112
|
return e.set(n), e.set(t, n.length), e;
|
|
113
113
|
}
|
|
@@ -119,7 +119,7 @@ function le() {
|
|
|
119
119
|
retry: void 0
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
var
|
|
122
|
+
var et = function(n, t) {
|
|
123
123
|
var e = {};
|
|
124
124
|
for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && t.indexOf(s) < 0 && (e[s] = n[s]);
|
|
125
125
|
if (n != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -127,94 +127,94 @@ var st = function(n, t) {
|
|
|
127
127
|
t.indexOf(s[r]) < 0 && Object.prototype.propertyIsEnumerable.call(n, s[r]) && (e[s[r]] = n[s[r]]);
|
|
128
128
|
return e;
|
|
129
129
|
};
|
|
130
|
-
const
|
|
130
|
+
const se = "text/event-stream", tt = 1e3, de = "last-event-id";
|
|
131
131
|
function Ce(n, t) {
|
|
132
|
-
var { signal: e, headers: s, onopen: r, onmessage: i, onclose: o, onerror: a, openWhenHidden:
|
|
132
|
+
var { signal: e, headers: s, onopen: r, onmessage: i, onclose: o, onerror: a, openWhenHidden: u, fetch: c } = t, l = et(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
133
133
|
return new Promise((m, v) => {
|
|
134
134
|
const h = Object.assign({}, s);
|
|
135
|
-
h.accept || (h.accept =
|
|
135
|
+
h.accept || (h.accept = se);
|
|
136
136
|
let p;
|
|
137
137
|
function f() {
|
|
138
|
-
p.abort(), document.hidden ||
|
|
138
|
+
p.abort(), document.hidden || j();
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
let
|
|
142
|
-
function
|
|
143
|
-
document.removeEventListener("visibilitychange", f), window.clearTimeout(
|
|
140
|
+
u || document.addEventListener("visibilitychange", f);
|
|
141
|
+
let E = tt, w = 0;
|
|
142
|
+
function F() {
|
|
143
|
+
document.removeEventListener("visibilitychange", f), window.clearTimeout(w), p.abort();
|
|
144
144
|
}
|
|
145
145
|
e?.addEventListener("abort", () => {
|
|
146
|
-
|
|
146
|
+
F(), m();
|
|
147
147
|
});
|
|
148
|
-
const
|
|
149
|
-
async function
|
|
150
|
-
var
|
|
148
|
+
const k = c ?? window.fetch, L = r ?? nt;
|
|
149
|
+
async function j() {
|
|
150
|
+
var $;
|
|
151
151
|
p = new AbortController();
|
|
152
152
|
try {
|
|
153
|
-
const
|
|
154
|
-
await
|
|
155
|
-
|
|
156
|
-
}, (
|
|
157
|
-
|
|
158
|
-
}, i))), o?.(),
|
|
159
|
-
} catch (
|
|
153
|
+
const D = await k(n, Object.assign(Object.assign({}, l), { headers: h, signal: p.signal }));
|
|
154
|
+
await L(D), await ze(D.body, Je(Qe((P) => {
|
|
155
|
+
P ? h[de] = P : delete h[de];
|
|
156
|
+
}, (P) => {
|
|
157
|
+
E = P;
|
|
158
|
+
}, i))), o?.(), F(), m();
|
|
159
|
+
} catch (D) {
|
|
160
160
|
if (!p.signal.aborted)
|
|
161
161
|
try {
|
|
162
|
-
const
|
|
163
|
-
window.clearTimeout(
|
|
164
|
-
} catch (
|
|
165
|
-
|
|
162
|
+
const P = ($ = a?.(D)) !== null && $ !== void 0 ? $ : E;
|
|
163
|
+
window.clearTimeout(w), w = window.setTimeout(j, P);
|
|
164
|
+
} catch (P) {
|
|
165
|
+
F(), v(P);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
j();
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function nt(n) {
|
|
173
173
|
const t = n.headers.get("content-type");
|
|
174
|
-
if (!t?.startsWith(
|
|
175
|
-
throw new Error(`Expected content-type to be ${
|
|
174
|
+
if (!t?.startsWith(se))
|
|
175
|
+
throw new Error(`Expected content-type to be ${se}, Actual: ${t}`);
|
|
176
176
|
}
|
|
177
|
-
var
|
|
178
|
-
return
|
|
177
|
+
var re = function(n, t) {
|
|
178
|
+
return re = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, s) {
|
|
179
179
|
e.__proto__ = s;
|
|
180
180
|
} || function(e, s) {
|
|
181
181
|
for (var r in s) Object.prototype.hasOwnProperty.call(s, r) && (e[r] = s[r]);
|
|
182
|
-
},
|
|
182
|
+
}, re(n, t);
|
|
183
183
|
};
|
|
184
|
-
function
|
|
184
|
+
function O(n, t) {
|
|
185
185
|
if (typeof t != "function" && t !== null)
|
|
186
186
|
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
187
|
-
|
|
187
|
+
re(n, t);
|
|
188
188
|
function e() {
|
|
189
189
|
this.constructor = n;
|
|
190
190
|
}
|
|
191
191
|
n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function st(n, t, e, s) {
|
|
194
194
|
function r(i) {
|
|
195
195
|
return i instanceof e ? i : new e(function(o) {
|
|
196
196
|
o(i);
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
199
|
return new (e || (e = Promise))(function(i, o) {
|
|
200
|
-
function a(
|
|
200
|
+
function a(l) {
|
|
201
201
|
try {
|
|
202
|
-
|
|
202
|
+
c(s.next(l));
|
|
203
203
|
} catch (m) {
|
|
204
204
|
o(m);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function u(l) {
|
|
208
208
|
try {
|
|
209
|
-
|
|
209
|
+
c(s.throw(l));
|
|
210
210
|
} catch (m) {
|
|
211
211
|
o(m);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
|
|
214
|
+
function c(l) {
|
|
215
|
+
l.done ? i(l.value) : r(l.value).then(a, u);
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
c((s = s.apply(n, t || [])).next());
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
function xe(n, t) {
|
|
@@ -225,59 +225,59 @@ function xe(n, t) {
|
|
|
225
225
|
return o.next = a(0), o.throw = a(1), o.return = a(2), typeof Symbol == "function" && (o[Symbol.iterator] = function() {
|
|
226
226
|
return this;
|
|
227
227
|
}), o;
|
|
228
|
-
function a(
|
|
229
|
-
return function(
|
|
230
|
-
return
|
|
228
|
+
function a(c) {
|
|
229
|
+
return function(l) {
|
|
230
|
+
return u([c, l]);
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
function c
|
|
233
|
+
function u(c) {
|
|
234
234
|
if (s) throw new TypeError("Generator is already executing.");
|
|
235
|
-
for (; o && (o = 0,
|
|
236
|
-
if (s = 1, r && (i =
|
|
237
|
-
switch (r = 0, i && (
|
|
235
|
+
for (; o && (o = 0, c[0] && (e = 0)), e; ) try {
|
|
236
|
+
if (s = 1, r && (i = c[0] & 2 ? r.return : c[0] ? r.throw || ((i = r.return) && i.call(r), 0) : r.next) && !(i = i.call(r, c[1])).done) return i;
|
|
237
|
+
switch (r = 0, i && (c = [c[0] & 2, i.value]), c[0]) {
|
|
238
238
|
case 0:
|
|
239
239
|
case 1:
|
|
240
|
-
i =
|
|
240
|
+
i = c;
|
|
241
241
|
break;
|
|
242
242
|
case 4:
|
|
243
|
-
return e.label++, { value:
|
|
243
|
+
return e.label++, { value: c[1], done: !1 };
|
|
244
244
|
case 5:
|
|
245
|
-
e.label++, r =
|
|
245
|
+
e.label++, r = c[1], c = [0];
|
|
246
246
|
continue;
|
|
247
247
|
case 7:
|
|
248
|
-
|
|
248
|
+
c = e.ops.pop(), e.trys.pop();
|
|
249
249
|
continue;
|
|
250
250
|
default:
|
|
251
|
-
if (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (
|
|
251
|
+
if (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (c[0] === 6 || c[0] === 2)) {
|
|
252
252
|
e = 0;
|
|
253
253
|
continue;
|
|
254
254
|
}
|
|
255
|
-
if (
|
|
256
|
-
e.label =
|
|
255
|
+
if (c[0] === 3 && (!i || c[1] > i[0] && c[1] < i[3])) {
|
|
256
|
+
e.label = c[1];
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
259
|
-
if (
|
|
260
|
-
e.label = i[1], i =
|
|
259
|
+
if (c[0] === 6 && e.label < i[1]) {
|
|
260
|
+
e.label = i[1], i = c;
|
|
261
261
|
break;
|
|
262
262
|
}
|
|
263
263
|
if (i && e.label < i[2]) {
|
|
264
|
-
e.label = i[2], e.ops.push(
|
|
264
|
+
e.label = i[2], e.ops.push(c);
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
267
|
i[2] && e.ops.pop(), e.trys.pop();
|
|
268
268
|
continue;
|
|
269
269
|
}
|
|
270
|
-
|
|
271
|
-
} catch (
|
|
272
|
-
|
|
270
|
+
c = t.call(n, e);
|
|
271
|
+
} catch (l) {
|
|
272
|
+
c = [6, l], r = 0;
|
|
273
273
|
} finally {
|
|
274
274
|
s = i = 0;
|
|
275
275
|
}
|
|
276
|
-
if (
|
|
277
|
-
return { value:
|
|
276
|
+
if (c[0] & 5) throw c[1];
|
|
277
|
+
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function U(n) {
|
|
281
281
|
var t = typeof Symbol == "function" && Symbol.iterator, e = t && n[t], s = 0;
|
|
282
282
|
if (e) return e.call(n);
|
|
283
283
|
if (n && typeof n.length == "number") return {
|
|
@@ -287,7 +287,7 @@ function k(n) {
|
|
|
287
287
|
};
|
|
288
288
|
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function B(n, t) {
|
|
291
291
|
var e = typeof Symbol == "function" && n[Symbol.iterator];
|
|
292
292
|
if (!e) return n;
|
|
293
293
|
var s = e.call(n), r, i = [], o;
|
|
@@ -304,15 +304,15 @@ function H(n, t) {
|
|
|
304
304
|
}
|
|
305
305
|
return i;
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function q(n, t, e) {
|
|
308
308
|
if (e || arguments.length === 2) for (var s = 0, r = t.length, i; s < r; s++)
|
|
309
309
|
(i || !(s in t)) && (i || (i = Array.prototype.slice.call(t, 0, s)), i[s] = t[s]);
|
|
310
310
|
return n.concat(i || Array.prototype.slice.call(t));
|
|
311
311
|
}
|
|
312
|
-
function
|
|
313
|
-
return this instanceof
|
|
312
|
+
function H(n) {
|
|
313
|
+
return this instanceof H ? (this.v = n, this) : new H(n);
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function rt(n, t, e) {
|
|
316
316
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
317
317
|
var s = e.apply(n, t || []), r, i = [];
|
|
318
318
|
return r = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", o), r[Symbol.asyncIterator] = function() {
|
|
@@ -325,47 +325,47 @@ function at(n, t, e) {
|
|
|
325
325
|
}
|
|
326
326
|
function a(h, p) {
|
|
327
327
|
s[h] && (r[h] = function(f) {
|
|
328
|
-
return new Promise(function(
|
|
329
|
-
i.push([h, f,
|
|
328
|
+
return new Promise(function(E, w) {
|
|
329
|
+
i.push([h, f, E, w]) > 1 || u(h, f);
|
|
330
330
|
});
|
|
331
331
|
}, p && (r[h] = p(r[h])));
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function u(h, p) {
|
|
334
334
|
try {
|
|
335
|
-
|
|
335
|
+
c(s[h](p));
|
|
336
336
|
} catch (f) {
|
|
337
337
|
v(i[0][3], f);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
function
|
|
341
|
-
h.value instanceof
|
|
340
|
+
function c(h) {
|
|
341
|
+
h.value instanceof H ? Promise.resolve(h.value.v).then(l, m) : v(i[0][2], h);
|
|
342
342
|
}
|
|
343
|
-
function
|
|
344
|
-
|
|
343
|
+
function l(h) {
|
|
344
|
+
u("next", h);
|
|
345
345
|
}
|
|
346
346
|
function m(h) {
|
|
347
|
-
|
|
347
|
+
u("throw", h);
|
|
348
348
|
}
|
|
349
349
|
function v(h, p) {
|
|
350
|
-
h(p), i.shift(), i.length &&
|
|
350
|
+
h(p), i.shift(), i.length && u(i[0][0], i[0][1]);
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function it(n) {
|
|
354
354
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
355
355
|
var t = n[Symbol.asyncIterator], e;
|
|
356
|
-
return t ? t.call(n) : (n = typeof
|
|
356
|
+
return t ? t.call(n) : (n = typeof U == "function" ? U(n) : n[Symbol.iterator](), e = {}, s("next"), s("throw"), s("return"), e[Symbol.asyncIterator] = function() {
|
|
357
357
|
return this;
|
|
358
358
|
}, e);
|
|
359
359
|
function s(i) {
|
|
360
360
|
e[i] = n[i] && function(o) {
|
|
361
|
-
return new Promise(function(a,
|
|
362
|
-
o = n[i](o), r(a,
|
|
361
|
+
return new Promise(function(a, u) {
|
|
362
|
+
o = n[i](o), r(a, u, o.done, o.value);
|
|
363
363
|
});
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
function r(i, o, a,
|
|
367
|
-
Promise.resolve(
|
|
368
|
-
i({ value:
|
|
366
|
+
function r(i, o, a, u) {
|
|
367
|
+
Promise.resolve(u).then(function(c) {
|
|
368
|
+
i({ value: c, done: a });
|
|
369
369
|
}, o);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
@@ -378,7 +378,7 @@ function Ae(n) {
|
|
|
378
378
|
}, e = n(t);
|
|
379
379
|
return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
|
|
380
380
|
}
|
|
381
|
-
var
|
|
381
|
+
var Q = Ae(function(n) {
|
|
382
382
|
return function(e) {
|
|
383
383
|
n(this), this.message = e ? e.length + ` errors occurred during unsubscription:
|
|
384
384
|
` + e.map(function(s, r) {
|
|
@@ -387,13 +387,13 @@ var J = Ae(function(n) {
|
|
|
387
387
|
`) : "", this.name = "UnsubscriptionError", this.errors = e;
|
|
388
388
|
};
|
|
389
389
|
});
|
|
390
|
-
function
|
|
390
|
+
function K(n, t) {
|
|
391
391
|
if (n) {
|
|
392
392
|
var e = n.indexOf(t);
|
|
393
393
|
0 <= e && n.splice(e, 1);
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
var
|
|
396
|
+
var N = (function() {
|
|
397
397
|
function n(t) {
|
|
398
398
|
this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
399
399
|
}
|
|
@@ -405,38 +405,38 @@ var $ = (function() {
|
|
|
405
405
|
if (o)
|
|
406
406
|
if (this._parentage = null, Array.isArray(o))
|
|
407
407
|
try {
|
|
408
|
-
for (var a =
|
|
409
|
-
var
|
|
410
|
-
|
|
408
|
+
for (var a = U(o), u = a.next(); !u.done; u = a.next()) {
|
|
409
|
+
var c = u.value;
|
|
410
|
+
c.remove(this);
|
|
411
411
|
}
|
|
412
412
|
} catch (f) {
|
|
413
413
|
t = { error: f };
|
|
414
414
|
} finally {
|
|
415
415
|
try {
|
|
416
|
-
|
|
416
|
+
u && !u.done && (e = a.return) && e.call(a);
|
|
417
417
|
} finally {
|
|
418
418
|
if (t) throw t.error;
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
else
|
|
422
422
|
o.remove(this);
|
|
423
|
-
var
|
|
424
|
-
if (b(
|
|
423
|
+
var l = this.initialTeardown;
|
|
424
|
+
if (b(l))
|
|
425
425
|
try {
|
|
426
|
-
|
|
426
|
+
l();
|
|
427
427
|
} catch (f) {
|
|
428
|
-
i = f instanceof
|
|
428
|
+
i = f instanceof Q ? f.errors : [f];
|
|
429
429
|
}
|
|
430
430
|
var m = this._finalizers;
|
|
431
431
|
if (m) {
|
|
432
432
|
this._finalizers = null;
|
|
433
433
|
try {
|
|
434
|
-
for (var v =
|
|
434
|
+
for (var v = U(m), h = v.next(); !h.done; h = v.next()) {
|
|
435
435
|
var p = h.value;
|
|
436
436
|
try {
|
|
437
437
|
he(p);
|
|
438
438
|
} catch (f) {
|
|
439
|
-
i = i ?? [], f instanceof
|
|
439
|
+
i = i ?? [], f instanceof Q ? i = q(q([], B(i)), B(f.errors)) : i.push(f);
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
} catch (f) {
|
|
@@ -450,7 +450,7 @@ var $ = (function() {
|
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
if (i)
|
|
453
|
-
throw new
|
|
453
|
+
throw new Q(i);
|
|
454
454
|
}
|
|
455
455
|
}, n.prototype.add = function(t) {
|
|
456
456
|
var e;
|
|
@@ -473,28 +473,28 @@ var $ = (function() {
|
|
|
473
473
|
this._parentage = Array.isArray(e) ? (e.push(t), e) : e ? [e, t] : t;
|
|
474
474
|
}, n.prototype._removeParent = function(t) {
|
|
475
475
|
var e = this._parentage;
|
|
476
|
-
e === t ? this._parentage = null : Array.isArray(e) &&
|
|
476
|
+
e === t ? this._parentage = null : Array.isArray(e) && K(e, t);
|
|
477
477
|
}, n.prototype.remove = function(t) {
|
|
478
478
|
var e = this._finalizers;
|
|
479
|
-
e &&
|
|
479
|
+
e && K(e, t), t instanceof n && t._removeParent(this);
|
|
480
480
|
}, n.EMPTY = (function() {
|
|
481
481
|
var t = new n();
|
|
482
482
|
return t.closed = !0, t;
|
|
483
483
|
})(), n;
|
|
484
|
-
})(), Oe =
|
|
484
|
+
})(), Oe = N.EMPTY;
|
|
485
485
|
function Pe(n) {
|
|
486
|
-
return n instanceof
|
|
486
|
+
return n instanceof N || n && "closed" in n && b(n.remove) && b(n.add) && b(n.unsubscribe);
|
|
487
487
|
}
|
|
488
488
|
function he(n) {
|
|
489
489
|
b(n) ? n() : n.unsubscribe();
|
|
490
490
|
}
|
|
491
|
-
var
|
|
491
|
+
var ot = {
|
|
492
492
|
Promise: void 0
|
|
493
|
-
},
|
|
493
|
+
}, at = {
|
|
494
494
|
setTimeout: function(n, t) {
|
|
495
495
|
for (var e = [], s = 2; s < arguments.length; s++)
|
|
496
496
|
e[s - 2] = arguments[s];
|
|
497
|
-
return setTimeout.apply(void 0,
|
|
497
|
+
return setTimeout.apply(void 0, q([n, t], B(e)));
|
|
498
498
|
},
|
|
499
499
|
clearTimeout: function(n) {
|
|
500
500
|
return clearTimeout(n);
|
|
@@ -502,23 +502,23 @@ var ut = {
|
|
|
502
502
|
delegate: void 0
|
|
503
503
|
};
|
|
504
504
|
function _e(n) {
|
|
505
|
-
|
|
505
|
+
at.setTimeout(function() {
|
|
506
506
|
throw n;
|
|
507
507
|
});
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function ie() {
|
|
510
510
|
}
|
|
511
|
-
function
|
|
511
|
+
function W(n) {
|
|
512
512
|
n();
|
|
513
513
|
}
|
|
514
|
-
var
|
|
515
|
-
|
|
514
|
+
var ae = (function(n) {
|
|
515
|
+
O(t, n);
|
|
516
516
|
function t(e) {
|
|
517
517
|
var s = n.call(this) || this;
|
|
518
|
-
return s.isStopped = !1, e ? (s.destination = e, Pe(e) && e.add(s)) : s.destination =
|
|
518
|
+
return s.isStopped = !1, e ? (s.destination = e, Pe(e) && e.add(s)) : s.destination = lt, s;
|
|
519
519
|
}
|
|
520
520
|
return t.create = function(e, s, r) {
|
|
521
|
-
return new
|
|
521
|
+
return new oe(e, s, r);
|
|
522
522
|
}, t.prototype.next = function(e) {
|
|
523
523
|
this.isStopped || this._next(e);
|
|
524
524
|
}, t.prototype.error = function(e) {
|
|
@@ -542,7 +542,7 @@ var oe = (function(n) {
|
|
|
542
542
|
this.unsubscribe();
|
|
543
543
|
}
|
|
544
544
|
}, t;
|
|
545
|
-
})(
|
|
545
|
+
})(N), ct = (function() {
|
|
546
546
|
function n(t) {
|
|
547
547
|
this.partialObserver = t;
|
|
548
548
|
}
|
|
@@ -552,7 +552,7 @@ var oe = (function(n) {
|
|
|
552
552
|
try {
|
|
553
553
|
e.next(t);
|
|
554
554
|
} catch (s) {
|
|
555
|
-
|
|
555
|
+
V(s);
|
|
556
556
|
}
|
|
557
557
|
}, n.prototype.error = function(t) {
|
|
558
558
|
var e = this.partialObserver;
|
|
@@ -560,50 +560,50 @@ var oe = (function(n) {
|
|
|
560
560
|
try {
|
|
561
561
|
e.error(t);
|
|
562
562
|
} catch (s) {
|
|
563
|
-
|
|
563
|
+
V(s);
|
|
564
564
|
}
|
|
565
565
|
else
|
|
566
|
-
|
|
566
|
+
V(t);
|
|
567
567
|
}, n.prototype.complete = function() {
|
|
568
568
|
var t = this.partialObserver;
|
|
569
569
|
if (t.complete)
|
|
570
570
|
try {
|
|
571
571
|
t.complete();
|
|
572
572
|
} catch (e) {
|
|
573
|
-
|
|
573
|
+
V(e);
|
|
574
574
|
}
|
|
575
575
|
}, n;
|
|
576
|
-
})(),
|
|
577
|
-
|
|
576
|
+
})(), oe = (function(n) {
|
|
577
|
+
O(t, n);
|
|
578
578
|
function t(e, s, r) {
|
|
579
579
|
var i = n.call(this) || this, o;
|
|
580
580
|
return b(e) || !e ? o = {
|
|
581
581
|
next: e ?? void 0,
|
|
582
582
|
error: s ?? void 0,
|
|
583
583
|
complete: r ?? void 0
|
|
584
|
-
} : o = e, i.destination = new
|
|
584
|
+
} : o = e, i.destination = new ct(o), i;
|
|
585
585
|
}
|
|
586
586
|
return t;
|
|
587
|
-
})(
|
|
588
|
-
function
|
|
587
|
+
})(ae);
|
|
588
|
+
function V(n) {
|
|
589
589
|
_e(n);
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function ut(n) {
|
|
592
592
|
throw n;
|
|
593
593
|
}
|
|
594
|
-
var
|
|
594
|
+
var lt = {
|
|
595
595
|
closed: !0,
|
|
596
|
-
next:
|
|
597
|
-
error:
|
|
598
|
-
complete:
|
|
599
|
-
},
|
|
596
|
+
next: ie,
|
|
597
|
+
error: ut,
|
|
598
|
+
complete: ie
|
|
599
|
+
}, ce = (function() {
|
|
600
600
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
601
601
|
})();
|
|
602
|
-
function
|
|
602
|
+
function z(n) {
|
|
603
603
|
return n;
|
|
604
604
|
}
|
|
605
|
-
function
|
|
606
|
-
return n.length === 0 ?
|
|
605
|
+
function dt(n) {
|
|
606
|
+
return n.length === 0 ? z : n.length === 1 ? n[0] : function(e) {
|
|
607
607
|
return n.reduce(function(s, r) {
|
|
608
608
|
return r(s);
|
|
609
609
|
}, e);
|
|
@@ -617,10 +617,10 @@ var y = (function() {
|
|
|
617
617
|
var e = new n();
|
|
618
618
|
return e.source = this, e.operator = t, e;
|
|
619
619
|
}, n.prototype.subscribe = function(t, e, s) {
|
|
620
|
-
var r = this, i =
|
|
621
|
-
return
|
|
622
|
-
var o = r, a = o.operator,
|
|
623
|
-
i.add(a ? a.call(i,
|
|
620
|
+
var r = this, i = ft(t) ? t : new oe(t, e, s);
|
|
621
|
+
return W(function() {
|
|
622
|
+
var o = r, a = o.operator, u = o.source;
|
|
623
|
+
i.add(a ? a.call(i, u) : u ? r._subscribe(i) : r._trySubscribe(i));
|
|
624
624
|
}), i;
|
|
625
625
|
}, n.prototype._trySubscribe = function(t) {
|
|
626
626
|
try {
|
|
@@ -631,12 +631,12 @@ var y = (function() {
|
|
|
631
631
|
}, n.prototype.forEach = function(t, e) {
|
|
632
632
|
var s = this;
|
|
633
633
|
return e = fe(e), new e(function(r, i) {
|
|
634
|
-
var o = new
|
|
634
|
+
var o = new oe({
|
|
635
635
|
next: function(a) {
|
|
636
636
|
try {
|
|
637
637
|
t(a);
|
|
638
|
-
} catch (
|
|
639
|
-
i(
|
|
638
|
+
} catch (u) {
|
|
639
|
+
i(u), o.unsubscribe();
|
|
640
640
|
}
|
|
641
641
|
},
|
|
642
642
|
error: i,
|
|
@@ -647,12 +647,12 @@ var y = (function() {
|
|
|
647
647
|
}, n.prototype._subscribe = function(t) {
|
|
648
648
|
var e;
|
|
649
649
|
return (e = this.source) === null || e === void 0 ? void 0 : e.subscribe(t);
|
|
650
|
-
}, n.prototype[
|
|
650
|
+
}, n.prototype[ce] = function() {
|
|
651
651
|
return this;
|
|
652
652
|
}, n.prototype.pipe = function() {
|
|
653
653
|
for (var t = [], e = 0; e < arguments.length; e++)
|
|
654
654
|
t[e] = arguments[e];
|
|
655
|
-
return
|
|
655
|
+
return dt(t)(this);
|
|
656
656
|
}, n.prototype.toPromise = function(t) {
|
|
657
657
|
var e = this;
|
|
658
658
|
return t = fe(t), new t(function(s, r) {
|
|
@@ -671,20 +671,20 @@ var y = (function() {
|
|
|
671
671
|
})();
|
|
672
672
|
function fe(n) {
|
|
673
673
|
var t;
|
|
674
|
-
return (t = n ??
|
|
674
|
+
return (t = n ?? ot.Promise) !== null && t !== void 0 ? t : Promise;
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function ht(n) {
|
|
677
677
|
return n && b(n.next) && b(n.error) && b(n.complete);
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
return n && n instanceof
|
|
679
|
+
function ft(n) {
|
|
680
|
+
return n && n instanceof ae || ht(n) && Pe(n);
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function pt(n) {
|
|
683
683
|
return b(n?.lift);
|
|
684
684
|
}
|
|
685
685
|
function _(n) {
|
|
686
686
|
return function(t) {
|
|
687
|
-
if (
|
|
687
|
+
if (pt(t))
|
|
688
688
|
return t.lift(function(e) {
|
|
689
689
|
try {
|
|
690
690
|
return n(e, this);
|
|
@@ -695,36 +695,36 @@ function _(n) {
|
|
|
695
695
|
throw new TypeError("Unable to lift unknown Observable type");
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
|
-
function
|
|
699
|
-
return new
|
|
698
|
+
function R(n, t, e, s, r) {
|
|
699
|
+
return new mt(n, t, e, s, r);
|
|
700
700
|
}
|
|
701
|
-
var
|
|
702
|
-
|
|
701
|
+
var mt = (function(n) {
|
|
702
|
+
O(t, n);
|
|
703
703
|
function t(e, s, r, i, o, a) {
|
|
704
|
-
var
|
|
705
|
-
return
|
|
704
|
+
var u = n.call(this, e) || this;
|
|
705
|
+
return u.onFinalize = o, u.shouldUnsubscribe = a, u._next = s ? function(c) {
|
|
706
706
|
try {
|
|
707
|
-
s(
|
|
708
|
-
} catch (
|
|
709
|
-
e.error(
|
|
707
|
+
s(c);
|
|
708
|
+
} catch (l) {
|
|
709
|
+
e.error(l);
|
|
710
710
|
}
|
|
711
|
-
} : n.prototype._next,
|
|
711
|
+
} : n.prototype._next, u._error = i ? function(c) {
|
|
712
712
|
try {
|
|
713
|
-
i(
|
|
714
|
-
} catch (
|
|
715
|
-
e.error(
|
|
713
|
+
i(c);
|
|
714
|
+
} catch (l) {
|
|
715
|
+
e.error(l);
|
|
716
716
|
} finally {
|
|
717
717
|
this.unsubscribe();
|
|
718
718
|
}
|
|
719
|
-
} : n.prototype._error,
|
|
719
|
+
} : n.prototype._error, u._complete = r ? function() {
|
|
720
720
|
try {
|
|
721
721
|
r();
|
|
722
|
-
} catch (
|
|
723
|
-
e.error(
|
|
722
|
+
} catch (c) {
|
|
723
|
+
e.error(c);
|
|
724
724
|
} finally {
|
|
725
725
|
this.unsubscribe();
|
|
726
726
|
}
|
|
727
|
-
} : n.prototype._complete,
|
|
727
|
+
} : n.prototype._complete, u;
|
|
728
728
|
}
|
|
729
729
|
return t.prototype.unsubscribe = function() {
|
|
730
730
|
var e;
|
|
@@ -733,12 +733,12 @@ var vt = (function(n) {
|
|
|
733
733
|
n.prototype.unsubscribe.call(this), !s && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
|
|
734
734
|
}
|
|
735
735
|
}, t;
|
|
736
|
-
})(
|
|
736
|
+
})(ae), gt = Ae(function(n) {
|
|
737
737
|
return function() {
|
|
738
738
|
n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
739
739
|
};
|
|
740
|
-
}),
|
|
741
|
-
|
|
740
|
+
}), ue = (function(n) {
|
|
741
|
+
O(t, n);
|
|
742
742
|
function t() {
|
|
743
743
|
var e = n.call(this) || this;
|
|
744
744
|
return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
|
|
@@ -748,20 +748,20 @@ var vt = (function(n) {
|
|
|
748
748
|
return s.operator = e, s;
|
|
749
749
|
}, t.prototype._throwIfClosed = function() {
|
|
750
750
|
if (this.closed)
|
|
751
|
-
throw new
|
|
751
|
+
throw new gt();
|
|
752
752
|
}, t.prototype.next = function(e) {
|
|
753
753
|
var s = this;
|
|
754
|
-
|
|
754
|
+
W(function() {
|
|
755
755
|
var r, i;
|
|
756
756
|
if (s._throwIfClosed(), !s.isStopped) {
|
|
757
757
|
s.currentObservers || (s.currentObservers = Array.from(s.observers));
|
|
758
758
|
try {
|
|
759
|
-
for (var o =
|
|
760
|
-
var
|
|
761
|
-
|
|
759
|
+
for (var o = U(s.currentObservers), a = o.next(); !a.done; a = o.next()) {
|
|
760
|
+
var u = a.value;
|
|
761
|
+
u.next(e);
|
|
762
762
|
}
|
|
763
|
-
} catch (
|
|
764
|
-
r = { error:
|
|
763
|
+
} catch (c) {
|
|
764
|
+
r = { error: c };
|
|
765
765
|
} finally {
|
|
766
766
|
try {
|
|
767
767
|
a && !a.done && (i = o.return) && i.call(o);
|
|
@@ -773,7 +773,7 @@ var vt = (function(n) {
|
|
|
773
773
|
});
|
|
774
774
|
}, t.prototype.error = function(e) {
|
|
775
775
|
var s = this;
|
|
776
|
-
|
|
776
|
+
W(function() {
|
|
777
777
|
if (s._throwIfClosed(), !s.isStopped) {
|
|
778
778
|
s.hasError = s.isStopped = !0, s.thrownError = e;
|
|
779
779
|
for (var r = s.observers; r.length; )
|
|
@@ -782,7 +782,7 @@ var vt = (function(n) {
|
|
|
782
782
|
});
|
|
783
783
|
}, t.prototype.complete = function() {
|
|
784
784
|
var e = this;
|
|
785
|
-
|
|
785
|
+
W(function() {
|
|
786
786
|
if (e._throwIfClosed(), !e.isStopped) {
|
|
787
787
|
e.isStopped = !0;
|
|
788
788
|
for (var s = e.observers; s.length; )
|
|
@@ -804,8 +804,8 @@ var vt = (function(n) {
|
|
|
804
804
|
return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
|
|
805
805
|
}, t.prototype._innerSubscribe = function(e) {
|
|
806
806
|
var s = this, r = this, i = r.hasError, o = r.isStopped, a = r.observers;
|
|
807
|
-
return i || o ? Oe : (this.currentObservers = null, a.push(e), new
|
|
808
|
-
s.currentObservers = null,
|
|
807
|
+
return i || o ? Oe : (this.currentObservers = null, a.push(e), new N(function() {
|
|
808
|
+
s.currentObservers = null, K(a, e);
|
|
809
809
|
}));
|
|
810
810
|
}, t.prototype._checkFinalizedStatuses = function(e) {
|
|
811
811
|
var s = this, r = s.hasError, i = s.thrownError, o = s.isStopped;
|
|
@@ -817,7 +817,7 @@ var vt = (function(n) {
|
|
|
817
817
|
return new pe(e, s);
|
|
818
818
|
}, t;
|
|
819
819
|
})(y), pe = (function(n) {
|
|
820
|
-
|
|
820
|
+
O(t, n);
|
|
821
821
|
function t(e, s) {
|
|
822
822
|
var r = n.call(this) || this;
|
|
823
823
|
return r.destination = e, r.source = s, r;
|
|
@@ -835,8 +835,8 @@ var vt = (function(n) {
|
|
|
835
835
|
var s, r;
|
|
836
836
|
return (r = (s = this.source) === null || s === void 0 ? void 0 : s.subscribe(e)) !== null && r !== void 0 ? r : Oe;
|
|
837
837
|
}, t;
|
|
838
|
-
})(
|
|
839
|
-
|
|
838
|
+
})(ue), A = (function(n) {
|
|
839
|
+
O(t, n);
|
|
840
840
|
function t(e) {
|
|
841
841
|
var s = n.call(this) || this;
|
|
842
842
|
return s._value = e, s;
|
|
@@ -858,30 +858,30 @@ var vt = (function(n) {
|
|
|
858
858
|
}, t.prototype.next = function(e) {
|
|
859
859
|
n.prototype.next.call(this, this._value = e);
|
|
860
860
|
}, t;
|
|
861
|
-
})(
|
|
861
|
+
})(ue), bt = {
|
|
862
862
|
now: function() {
|
|
863
863
|
return Date.now();
|
|
864
864
|
}
|
|
865
|
-
},
|
|
866
|
-
|
|
865
|
+
}, vt = (function(n) {
|
|
866
|
+
O(t, n);
|
|
867
867
|
function t(e, s) {
|
|
868
868
|
return n.call(this) || this;
|
|
869
869
|
}
|
|
870
870
|
return t.prototype.schedule = function(e, s) {
|
|
871
871
|
return this;
|
|
872
872
|
}, t;
|
|
873
|
-
})(
|
|
873
|
+
})(N), me = {
|
|
874
874
|
setInterval: function(n, t) {
|
|
875
875
|
for (var e = [], s = 2; s < arguments.length; s++)
|
|
876
876
|
e[s - 2] = arguments[s];
|
|
877
|
-
return setInterval.apply(void 0,
|
|
877
|
+
return setInterval.apply(void 0, q([n, t], B(e)));
|
|
878
878
|
},
|
|
879
879
|
clearInterval: function(n) {
|
|
880
880
|
return clearInterval(n);
|
|
881
881
|
},
|
|
882
882
|
delegate: void 0
|
|
883
|
-
},
|
|
884
|
-
|
|
883
|
+
}, St = (function(n) {
|
|
884
|
+
O(t, n);
|
|
885
885
|
function t(e, s) {
|
|
886
886
|
var r = n.call(this, e, s) || this;
|
|
887
887
|
return r.scheduler = e, r.work = s, r.pending = !1, r;
|
|
@@ -919,18 +919,18 @@ var vt = (function(n) {
|
|
|
919
919
|
}, t.prototype.unsubscribe = function() {
|
|
920
920
|
if (!this.closed) {
|
|
921
921
|
var e = this, s = e.id, r = e.scheduler, i = r.actions;
|
|
922
|
-
this.work = this.state = this.scheduler = null, this.pending = !1,
|
|
922
|
+
this.work = this.state = this.scheduler = null, this.pending = !1, K(i, this), s != null && (this.id = this.recycleAsyncId(r, s, null)), this.delay = null, n.prototype.unsubscribe.call(this);
|
|
923
923
|
}
|
|
924
924
|
}, t;
|
|
925
|
-
})(
|
|
925
|
+
})(vt), ge = (function() {
|
|
926
926
|
function n(t, e) {
|
|
927
927
|
e === void 0 && (e = n.now), this.schedulerActionCtor = t, this.now = e;
|
|
928
928
|
}
|
|
929
929
|
return n.prototype.schedule = function(t, e, s) {
|
|
930
930
|
return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(s, e);
|
|
931
|
-
}, n.now =
|
|
932
|
-
})(),
|
|
933
|
-
|
|
931
|
+
}, n.now = bt.now, n;
|
|
932
|
+
})(), yt = (function(n) {
|
|
933
|
+
O(t, n);
|
|
934
934
|
function t(e, s) {
|
|
935
935
|
s === void 0 && (s = ge.now);
|
|
936
936
|
var r = n.call(this, e, s) || this;
|
|
@@ -954,45 +954,43 @@ var vt = (function(n) {
|
|
|
954
954
|
throw r;
|
|
955
955
|
}
|
|
956
956
|
}, t;
|
|
957
|
-
})(ge),
|
|
958
|
-
|
|
959
|
-
});
|
|
960
|
-
function Le(n) {
|
|
957
|
+
})(ge), wt = new yt(St);
|
|
958
|
+
function Et(n) {
|
|
961
959
|
return n && b(n.schedule);
|
|
962
960
|
}
|
|
963
|
-
function
|
|
961
|
+
function Le(n) {
|
|
964
962
|
return n[n.length - 1];
|
|
965
963
|
}
|
|
966
|
-
function
|
|
967
|
-
return b(
|
|
964
|
+
function It(n) {
|
|
965
|
+
return b(Le(n)) ? n.pop() : void 0;
|
|
968
966
|
}
|
|
969
|
-
function
|
|
970
|
-
return Le(
|
|
967
|
+
function Me(n) {
|
|
968
|
+
return Et(Le(n)) ? n.pop() : void 0;
|
|
971
969
|
}
|
|
972
|
-
var
|
|
970
|
+
var Ue = (function(n) {
|
|
973
971
|
return n && typeof n.length == "number" && typeof n != "function";
|
|
974
972
|
});
|
|
975
|
-
function
|
|
973
|
+
function Ne(n) {
|
|
976
974
|
return b(n?.then);
|
|
977
975
|
}
|
|
978
|
-
function
|
|
979
|
-
return b(n[
|
|
976
|
+
function Re(n) {
|
|
977
|
+
return b(n[ce]);
|
|
980
978
|
}
|
|
981
|
-
function
|
|
979
|
+
function ke(n) {
|
|
982
980
|
return Symbol.asyncIterator && b(n?.[Symbol.asyncIterator]);
|
|
983
981
|
}
|
|
984
|
-
function
|
|
982
|
+
function je(n) {
|
|
985
983
|
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.");
|
|
986
984
|
}
|
|
987
|
-
function
|
|
985
|
+
function Tt() {
|
|
988
986
|
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
989
987
|
}
|
|
990
|
-
var
|
|
991
|
-
function
|
|
992
|
-
return b(n?.[
|
|
988
|
+
var $e = Tt();
|
|
989
|
+
function De(n) {
|
|
990
|
+
return b(n?.[$e]);
|
|
993
991
|
}
|
|
994
|
-
function
|
|
995
|
-
return
|
|
992
|
+
function He(n) {
|
|
993
|
+
return rt(this, arguments, function() {
|
|
996
994
|
var e, s, r, i;
|
|
997
995
|
return xe(this, function(o) {
|
|
998
996
|
switch (o.label) {
|
|
@@ -1001,13 +999,13 @@ function Ge(n) {
|
|
|
1001
999
|
case 1:
|
|
1002
1000
|
o.trys.push([1, , 9, 10]), o.label = 2;
|
|
1003
1001
|
case 2:
|
|
1004
|
-
return [4,
|
|
1002
|
+
return [4, H(e.read())];
|
|
1005
1003
|
case 3:
|
|
1006
|
-
return s = o.sent(), r = s.value, i = s.done, i ? [4,
|
|
1004
|
+
return s = o.sent(), r = s.value, i = s.done, i ? [4, H(void 0)] : [3, 5];
|
|
1007
1005
|
case 4:
|
|
1008
1006
|
return [2, o.sent()];
|
|
1009
1007
|
case 5:
|
|
1010
|
-
return [4,
|
|
1008
|
+
return [4, H(r)];
|
|
1011
1009
|
case 6:
|
|
1012
1010
|
return [4, o.sent()];
|
|
1013
1011
|
case 7:
|
|
@@ -1022,44 +1020,44 @@ function Ge(n) {
|
|
|
1022
1020
|
});
|
|
1023
1021
|
});
|
|
1024
1022
|
}
|
|
1025
|
-
function
|
|
1023
|
+
function Fe(n) {
|
|
1026
1024
|
return b(n?.getReader);
|
|
1027
1025
|
}
|
|
1028
|
-
function
|
|
1026
|
+
function J(n) {
|
|
1029
1027
|
if (n instanceof y)
|
|
1030
1028
|
return n;
|
|
1031
1029
|
if (n != null) {
|
|
1032
|
-
if (je(n))
|
|
1033
|
-
return Ot(n);
|
|
1034
1030
|
if (Re(n))
|
|
1035
|
-
return
|
|
1031
|
+
return Ct(n);
|
|
1032
|
+
if (Ue(n))
|
|
1033
|
+
return xt(n);
|
|
1034
|
+
if (Ne(n))
|
|
1035
|
+
return At(n);
|
|
1036
1036
|
if (ke(n))
|
|
1037
|
-
return
|
|
1038
|
-
if (
|
|
1039
|
-
return
|
|
1037
|
+
return Ge(n);
|
|
1038
|
+
if (De(n))
|
|
1039
|
+
return Ot(n);
|
|
1040
1040
|
if (Fe(n))
|
|
1041
|
-
return
|
|
1042
|
-
if (Be(n))
|
|
1043
|
-
return Lt(n);
|
|
1041
|
+
return Pt(n);
|
|
1044
1042
|
}
|
|
1045
|
-
throw
|
|
1043
|
+
throw je(n);
|
|
1046
1044
|
}
|
|
1047
|
-
function
|
|
1045
|
+
function Ct(n) {
|
|
1048
1046
|
return new y(function(t) {
|
|
1049
|
-
var e = n[
|
|
1047
|
+
var e = n[ce]();
|
|
1050
1048
|
if (b(e.subscribe))
|
|
1051
1049
|
return e.subscribe(t);
|
|
1052
1050
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
1053
1051
|
});
|
|
1054
1052
|
}
|
|
1055
|
-
function
|
|
1053
|
+
function xt(n) {
|
|
1056
1054
|
return new y(function(t) {
|
|
1057
1055
|
for (var e = 0; e < n.length && !t.closed; e++)
|
|
1058
1056
|
t.next(n[e]);
|
|
1059
1057
|
t.complete();
|
|
1060
1058
|
});
|
|
1061
1059
|
}
|
|
1062
|
-
function
|
|
1060
|
+
function At(n) {
|
|
1063
1061
|
return new y(function(t) {
|
|
1064
1062
|
n.then(function(e) {
|
|
1065
1063
|
t.closed || (t.next(e), t.complete());
|
|
@@ -1068,11 +1066,11 @@ function _t(n) {
|
|
|
1068
1066
|
}).then(null, _e);
|
|
1069
1067
|
});
|
|
1070
1068
|
}
|
|
1071
|
-
function
|
|
1069
|
+
function Ot(n) {
|
|
1072
1070
|
return new y(function(t) {
|
|
1073
1071
|
var e, s;
|
|
1074
1072
|
try {
|
|
1075
|
-
for (var r =
|
|
1073
|
+
for (var r = U(n), i = r.next(); !i.done; i = r.next()) {
|
|
1076
1074
|
var o = i.value;
|
|
1077
1075
|
if (t.next(o), t.closed)
|
|
1078
1076
|
return;
|
|
@@ -1089,41 +1087,41 @@ function Mt(n) {
|
|
|
1089
1087
|
t.complete();
|
|
1090
1088
|
});
|
|
1091
1089
|
}
|
|
1092
|
-
function
|
|
1090
|
+
function Ge(n) {
|
|
1093
1091
|
return new y(function(t) {
|
|
1094
|
-
|
|
1092
|
+
_t(n, t).catch(function(e) {
|
|
1095
1093
|
return t.error(e);
|
|
1096
1094
|
});
|
|
1097
1095
|
});
|
|
1098
1096
|
}
|
|
1099
|
-
function
|
|
1100
|
-
return
|
|
1097
|
+
function Pt(n) {
|
|
1098
|
+
return Ge(He(n));
|
|
1101
1099
|
}
|
|
1102
|
-
function
|
|
1100
|
+
function _t(n, t) {
|
|
1103
1101
|
var e, s, r, i;
|
|
1104
|
-
return
|
|
1102
|
+
return st(this, void 0, void 0, function() {
|
|
1105
1103
|
var o, a;
|
|
1106
|
-
return xe(this, function(
|
|
1107
|
-
switch (
|
|
1104
|
+
return xe(this, function(u) {
|
|
1105
|
+
switch (u.label) {
|
|
1108
1106
|
case 0:
|
|
1109
|
-
|
|
1107
|
+
u.trys.push([0, 5, 6, 11]), e = it(n), u.label = 1;
|
|
1110
1108
|
case 1:
|
|
1111
1109
|
return [4, e.next()];
|
|
1112
1110
|
case 2:
|
|
1113
|
-
if (s =
|
|
1111
|
+
if (s = u.sent(), !!s.done) return [3, 4];
|
|
1114
1112
|
if (o = s.value, t.next(o), t.closed)
|
|
1115
1113
|
return [2];
|
|
1116
|
-
|
|
1114
|
+
u.label = 3;
|
|
1117
1115
|
case 3:
|
|
1118
1116
|
return [3, 1];
|
|
1119
1117
|
case 4:
|
|
1120
1118
|
return [3, 11];
|
|
1121
1119
|
case 5:
|
|
1122
|
-
return a =
|
|
1120
|
+
return a = u.sent(), r = { error: a }, [3, 11];
|
|
1123
1121
|
case 6:
|
|
1124
|
-
return
|
|
1122
|
+
return u.trys.push([6, , 9, 10]), s && !s.done && (i = e.return) ? [4, i.call(e)] : [3, 8];
|
|
1125
1123
|
case 7:
|
|
1126
|
-
|
|
1124
|
+
u.sent(), u.label = 8;
|
|
1127
1125
|
case 8:
|
|
1128
1126
|
return [3, 10];
|
|
1129
1127
|
case 9:
|
|
@@ -1137,7 +1135,7 @@ function Ut(n, t) {
|
|
|
1137
1135
|
});
|
|
1138
1136
|
});
|
|
1139
1137
|
}
|
|
1140
|
-
function
|
|
1138
|
+
function T(n, t, e, s, r) {
|
|
1141
1139
|
s === void 0 && (s = 0), r === void 0 && (r = !1);
|
|
1142
1140
|
var i = t.schedule(function() {
|
|
1143
1141
|
e(), r ? n.add(this.schedule(null, s)) : this.unsubscribe();
|
|
@@ -1145,37 +1143,37 @@ function O(n, t, e, s, r) {
|
|
|
1145
1143
|
if (n.add(i), !r)
|
|
1146
1144
|
return i;
|
|
1147
1145
|
}
|
|
1148
|
-
function
|
|
1146
|
+
function Be(n, t) {
|
|
1149
1147
|
return t === void 0 && (t = 0), _(function(e, s) {
|
|
1150
|
-
e.subscribe(
|
|
1151
|
-
return
|
|
1148
|
+
e.subscribe(R(s, function(r) {
|
|
1149
|
+
return T(s, n, function() {
|
|
1152
1150
|
return s.next(r);
|
|
1153
1151
|
}, t);
|
|
1154
1152
|
}, function() {
|
|
1155
|
-
return
|
|
1153
|
+
return T(s, n, function() {
|
|
1156
1154
|
return s.complete();
|
|
1157
1155
|
}, t);
|
|
1158
1156
|
}, function(r) {
|
|
1159
|
-
return
|
|
1157
|
+
return T(s, n, function() {
|
|
1160
1158
|
return s.error(r);
|
|
1161
1159
|
}, t);
|
|
1162
1160
|
}));
|
|
1163
1161
|
});
|
|
1164
1162
|
}
|
|
1165
|
-
function
|
|
1163
|
+
function qe(n, t) {
|
|
1166
1164
|
return t === void 0 && (t = 0), _(function(e, s) {
|
|
1167
1165
|
s.add(n.schedule(function() {
|
|
1168
1166
|
return e.subscribe(s);
|
|
1169
1167
|
}, t));
|
|
1170
1168
|
});
|
|
1171
1169
|
}
|
|
1172
|
-
function
|
|
1173
|
-
return
|
|
1170
|
+
function Lt(n, t) {
|
|
1171
|
+
return J(n).pipe(qe(t), Be(t));
|
|
1174
1172
|
}
|
|
1175
|
-
function
|
|
1176
|
-
return
|
|
1173
|
+
function Mt(n, t) {
|
|
1174
|
+
return J(n).pipe(qe(t), Be(t));
|
|
1177
1175
|
}
|
|
1178
|
-
function
|
|
1176
|
+
function Ut(n, t) {
|
|
1179
1177
|
return new y(function(e) {
|
|
1180
1178
|
var s = 0;
|
|
1181
1179
|
return t.schedule(function() {
|
|
@@ -1183,11 +1181,11 @@ function kt(n, t) {
|
|
|
1183
1181
|
});
|
|
1184
1182
|
});
|
|
1185
1183
|
}
|
|
1186
|
-
function
|
|
1184
|
+
function Nt(n, t) {
|
|
1187
1185
|
return new y(function(e) {
|
|
1188
1186
|
var s;
|
|
1189
|
-
return
|
|
1190
|
-
s = n[
|
|
1187
|
+
return T(e, t, function() {
|
|
1188
|
+
s = n[$e](), T(e, t, function() {
|
|
1191
1189
|
var r, i, o;
|
|
1192
1190
|
try {
|
|
1193
1191
|
r = s.next(), i = r.value, o = r.done;
|
|
@@ -1202,13 +1200,13 @@ function jt(n, t) {
|
|
|
1202
1200
|
};
|
|
1203
1201
|
});
|
|
1204
1202
|
}
|
|
1205
|
-
function
|
|
1203
|
+
function Ke(n, t) {
|
|
1206
1204
|
if (!n)
|
|
1207
1205
|
throw new Error("Iterable cannot be null");
|
|
1208
1206
|
return new y(function(e) {
|
|
1209
|
-
|
|
1207
|
+
T(e, t, function() {
|
|
1210
1208
|
var s = n[Symbol.asyncIterator]();
|
|
1211
|
-
|
|
1209
|
+
T(e, t, function() {
|
|
1212
1210
|
s.next().then(function(r) {
|
|
1213
1211
|
r.done ? e.complete() : e.next(r.value);
|
|
1214
1212
|
});
|
|
@@ -1216,63 +1214,54 @@ function We(n, t) {
|
|
|
1216
1214
|
});
|
|
1217
1215
|
});
|
|
1218
1216
|
}
|
|
1219
|
-
function
|
|
1220
|
-
return
|
|
1217
|
+
function Rt(n, t) {
|
|
1218
|
+
return Ke(He(n), t);
|
|
1221
1219
|
}
|
|
1222
|
-
function
|
|
1220
|
+
function kt(n, t) {
|
|
1223
1221
|
if (n != null) {
|
|
1224
|
-
if (je(n))
|
|
1225
|
-
return Nt(n, t);
|
|
1226
1222
|
if (Re(n))
|
|
1227
|
-
return
|
|
1223
|
+
return Lt(n, t);
|
|
1224
|
+
if (Ue(n))
|
|
1225
|
+
return Ut(n, t);
|
|
1226
|
+
if (Ne(n))
|
|
1227
|
+
return Mt(n, t);
|
|
1228
1228
|
if (ke(n))
|
|
1229
|
-
return
|
|
1230
|
-
if (
|
|
1231
|
-
return
|
|
1229
|
+
return Ke(n, t);
|
|
1230
|
+
if (De(n))
|
|
1231
|
+
return Nt(n, t);
|
|
1232
1232
|
if (Fe(n))
|
|
1233
|
-
return
|
|
1234
|
-
if (Be(n))
|
|
1235
|
-
return $t(n, t);
|
|
1233
|
+
return Rt(n, t);
|
|
1236
1234
|
}
|
|
1237
|
-
throw
|
|
1238
|
-
}
|
|
1239
|
-
function ue(n, t) {
|
|
1240
|
-
return t ? Dt(n, t) : N(n);
|
|
1235
|
+
throw je(n);
|
|
1241
1236
|
}
|
|
1242
|
-
function
|
|
1243
|
-
|
|
1244
|
-
n[t] = arguments[t];
|
|
1245
|
-
var e = Ne(n);
|
|
1246
|
-
return ue(n, e);
|
|
1247
|
-
}
|
|
1248
|
-
function Ft(n) {
|
|
1249
|
-
return n instanceof Date && !isNaN(n);
|
|
1237
|
+
function Ve(n, t) {
|
|
1238
|
+
return t ? kt(n, t) : J(n);
|
|
1250
1239
|
}
|
|
1251
|
-
function
|
|
1240
|
+
function Y(n, t) {
|
|
1252
1241
|
return _(function(e, s) {
|
|
1253
1242
|
var r = 0;
|
|
1254
|
-
e.subscribe(
|
|
1243
|
+
e.subscribe(R(s, function(i) {
|
|
1255
1244
|
s.next(n.call(t, i, r++));
|
|
1256
1245
|
}));
|
|
1257
1246
|
});
|
|
1258
1247
|
}
|
|
1259
|
-
var
|
|
1260
|
-
function
|
|
1261
|
-
return
|
|
1248
|
+
var jt = Array.isArray;
|
|
1249
|
+
function $t(n, t) {
|
|
1250
|
+
return jt(t) ? n.apply(void 0, q([], B(t))) : n(t);
|
|
1262
1251
|
}
|
|
1263
|
-
function
|
|
1264
|
-
return
|
|
1265
|
-
return
|
|
1252
|
+
function Dt(n) {
|
|
1253
|
+
return Y(function(t) {
|
|
1254
|
+
return $t(n, t);
|
|
1266
1255
|
});
|
|
1267
1256
|
}
|
|
1268
|
-
var
|
|
1269
|
-
function
|
|
1257
|
+
var Ht = Array.isArray, Ft = Object.getPrototypeOf, Gt = Object.prototype, Bt = Object.keys;
|
|
1258
|
+
function qt(n) {
|
|
1270
1259
|
if (n.length === 1) {
|
|
1271
1260
|
var t = n[0];
|
|
1272
|
-
if (
|
|
1261
|
+
if (Ht(t))
|
|
1273
1262
|
return { args: t, keys: null };
|
|
1274
|
-
if (
|
|
1275
|
-
var e =
|
|
1263
|
+
if (Kt(t)) {
|
|
1264
|
+
var e = Bt(t);
|
|
1276
1265
|
return {
|
|
1277
1266
|
args: e.map(function(s) {
|
|
1278
1267
|
return t[s];
|
|
@@ -1283,141 +1272,114 @@ function Yt(n) {
|
|
|
1283
1272
|
}
|
|
1284
1273
|
return { args: n, keys: null };
|
|
1285
1274
|
}
|
|
1286
|
-
function
|
|
1287
|
-
return n && typeof n == "object" &&
|
|
1275
|
+
function Kt(n) {
|
|
1276
|
+
return n && typeof n == "object" && Ft(n) === Gt;
|
|
1288
1277
|
}
|
|
1289
|
-
function
|
|
1278
|
+
function Vt(n, t) {
|
|
1290
1279
|
return n.reduce(function(e, s, r) {
|
|
1291
1280
|
return e[s] = t[r], e;
|
|
1292
1281
|
}, {});
|
|
1293
1282
|
}
|
|
1294
|
-
function
|
|
1283
|
+
function Wt() {
|
|
1295
1284
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1296
1285
|
n[t] = arguments[t];
|
|
1297
|
-
var e =
|
|
1286
|
+
var e = Me(n), s = It(n), r = qt(n), i = r.args, o = r.keys;
|
|
1298
1287
|
if (i.length === 0)
|
|
1299
|
-
return
|
|
1300
|
-
var a = new y(
|
|
1301
|
-
return
|
|
1302
|
-
} :
|
|
1303
|
-
return s ? a.pipe(
|
|
1304
|
-
}
|
|
1305
|
-
function
|
|
1306
|
-
return e === void 0 && (e =
|
|
1288
|
+
return Ve([], e);
|
|
1289
|
+
var a = new y(Xt(i, e, o ? function(u) {
|
|
1290
|
+
return Vt(o, u);
|
|
1291
|
+
} : z));
|
|
1292
|
+
return s ? a.pipe(Dt(s)) : a;
|
|
1293
|
+
}
|
|
1294
|
+
function Xt(n, t, e) {
|
|
1295
|
+
return e === void 0 && (e = z), function(s) {
|
|
1307
1296
|
be(t, function() {
|
|
1308
|
-
for (var r = n.length, i = new Array(r), o = r, a = r,
|
|
1297
|
+
for (var r = n.length, i = new Array(r), o = r, a = r, u = function(l) {
|
|
1309
1298
|
be(t, function() {
|
|
1310
|
-
var m =
|
|
1311
|
-
m.subscribe(
|
|
1312
|
-
i[
|
|
1299
|
+
var m = Ve(n[l], t), v = !1;
|
|
1300
|
+
m.subscribe(R(s, function(h) {
|
|
1301
|
+
i[l] = h, v || (v = !0, a--), a || s.next(e(i.slice()));
|
|
1313
1302
|
}, function() {
|
|
1314
1303
|
--o || s.complete();
|
|
1315
1304
|
}));
|
|
1316
1305
|
}, s);
|
|
1317
|
-
},
|
|
1318
|
-
c
|
|
1306
|
+
}, c = 0; c < r; c++)
|
|
1307
|
+
u(c);
|
|
1319
1308
|
}, s);
|
|
1320
1309
|
};
|
|
1321
1310
|
}
|
|
1322
1311
|
function be(n, t, e) {
|
|
1323
|
-
n ?
|
|
1324
|
-
}
|
|
1325
|
-
function en(n, t, e, s, r, i, o, a) {
|
|
1326
|
-
var c = [], u = 0, d = 0, m = !1, v = function() {
|
|
1327
|
-
m && !c.length && !u && t.complete();
|
|
1328
|
-
}, h = function(f) {
|
|
1329
|
-
return u < s ? p(f) : c.push(f);
|
|
1330
|
-
}, p = function(f) {
|
|
1331
|
-
u++;
|
|
1332
|
-
var M = !1;
|
|
1333
|
-
N(e(f, d++)).subscribe(P(t, function(E) {
|
|
1334
|
-
t.next(E);
|
|
1335
|
-
}, function() {
|
|
1336
|
-
M = !0;
|
|
1337
|
-
}, void 0, function() {
|
|
1338
|
-
if (M)
|
|
1339
|
-
try {
|
|
1340
|
-
u--;
|
|
1341
|
-
for (var E = function() {
|
|
1342
|
-
var L = c.shift();
|
|
1343
|
-
o || p(L);
|
|
1344
|
-
}; c.length && u < s; )
|
|
1345
|
-
E();
|
|
1346
|
-
v();
|
|
1347
|
-
} catch (L) {
|
|
1348
|
-
t.error(L);
|
|
1349
|
-
}
|
|
1350
|
-
}));
|
|
1351
|
-
};
|
|
1352
|
-
return n.subscribe(P(t, h, function() {
|
|
1353
|
-
m = !0, v();
|
|
1354
|
-
})), function() {
|
|
1355
|
-
};
|
|
1312
|
+
n ? T(e, n, t) : t();
|
|
1356
1313
|
}
|
|
1357
|
-
function
|
|
1358
|
-
return
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
}, e) : (typeof t == "number" && (e = t), _(function(s, r) {
|
|
1363
|
-
return en(s, r, n, e);
|
|
1364
|
-
}));
|
|
1365
|
-
}
|
|
1366
|
-
function tn(n, t, e) {
|
|
1367
|
-
n === void 0 && (n = 0), e === void 0 && (e = Tt);
|
|
1368
|
-
var s = -1;
|
|
1369
|
-
return t != null && (Le(t) ? e = t : s = t), new y(function(r) {
|
|
1370
|
-
var i = Ft(n) ? +n - e.now() : n;
|
|
1371
|
-
i < 0 && (i = 0);
|
|
1372
|
-
var o = 0;
|
|
1373
|
-
return e.schedule(function() {
|
|
1374
|
-
r.closed || (r.next(o++), 0 <= s ? this.schedule(void 0, s) : r.complete());
|
|
1375
|
-
}, i);
|
|
1376
|
-
});
|
|
1377
|
-
}
|
|
1378
|
-
function nn(n, t) {
|
|
1379
|
-
return b(t) ? W(n, t, 1) : W(n, 1);
|
|
1380
|
-
}
|
|
1381
|
-
function sn(n) {
|
|
1382
|
-
return n <= 0 ? function() {
|
|
1383
|
-
return Ct;
|
|
1384
|
-
} : _(function(t, e) {
|
|
1385
|
-
var s = 0;
|
|
1386
|
-
t.subscribe(P(e, function(r) {
|
|
1387
|
-
++s <= n && (e.next(r), n <= s && e.complete());
|
|
1314
|
+
function Yt(n, t) {
|
|
1315
|
+
return _(function(e, s) {
|
|
1316
|
+
var r = 0;
|
|
1317
|
+
e.subscribe(R(s, function(i) {
|
|
1318
|
+
return n.call(t, i, r++) && s.next(i);
|
|
1388
1319
|
}));
|
|
1389
1320
|
});
|
|
1390
1321
|
}
|
|
1391
|
-
function
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1322
|
+
function zt(n) {
|
|
1323
|
+
for (var t, e, s = [], r = 1; r < arguments.length; r++)
|
|
1324
|
+
s[r - 1] = arguments[r];
|
|
1325
|
+
var i = (t = Me(s)) !== null && t !== void 0 ? t : wt, o = (e = s[0]) !== null && e !== void 0 ? e : null, a = s[1] || 1 / 0;
|
|
1326
|
+
return _(function(u, c) {
|
|
1327
|
+
var l = [], m = !1, v = function(f) {
|
|
1328
|
+
var E = f.buffer, w = f.subs;
|
|
1329
|
+
w.unsubscribe(), K(l, f), c.next(E), m && h();
|
|
1330
|
+
}, h = function() {
|
|
1331
|
+
if (l) {
|
|
1332
|
+
var f = new N();
|
|
1333
|
+
c.add(f);
|
|
1334
|
+
var E = [], w = {
|
|
1335
|
+
buffer: E,
|
|
1336
|
+
subs: f
|
|
1337
|
+
};
|
|
1338
|
+
l.push(w), T(f, i, function() {
|
|
1339
|
+
return v(w);
|
|
1340
|
+
}, n);
|
|
1341
|
+
}
|
|
1342
|
+
};
|
|
1343
|
+
o !== null && o >= 0 ? T(c, i, h, o, !0) : m = !0, h();
|
|
1344
|
+
var p = R(c, function(f) {
|
|
1345
|
+
var E, w, F = l.slice();
|
|
1346
|
+
try {
|
|
1347
|
+
for (var k = U(F), L = k.next(); !L.done; L = k.next()) {
|
|
1348
|
+
var j = L.value, $ = j.buffer;
|
|
1349
|
+
$.push(f), a <= $.length && v(j);
|
|
1350
|
+
}
|
|
1351
|
+
} catch (D) {
|
|
1352
|
+
E = { error: D };
|
|
1353
|
+
} finally {
|
|
1354
|
+
try {
|
|
1355
|
+
L && !L.done && (w = k.return) && w.call(k);
|
|
1356
|
+
} finally {
|
|
1357
|
+
if (E) throw E.error;
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
}, function() {
|
|
1361
|
+
for (; l?.length; )
|
|
1362
|
+
c.next(l.shift().buffer);
|
|
1363
|
+
p?.unsubscribe(), c.complete(), c.unsubscribe();
|
|
1364
|
+
}, void 0, function() {
|
|
1365
|
+
return l = null;
|
|
1366
|
+
});
|
|
1367
|
+
u.subscribe(p);
|
|
1406
1368
|
});
|
|
1407
1369
|
}
|
|
1408
|
-
function
|
|
1409
|
-
return t === void 0 && (t =
|
|
1370
|
+
function M(n, t) {
|
|
1371
|
+
return t === void 0 && (t = z), n = n ?? Jt, _(function(e, s) {
|
|
1410
1372
|
var r, i = !0;
|
|
1411
|
-
e.subscribe(
|
|
1373
|
+
e.subscribe(R(s, function(o) {
|
|
1412
1374
|
var a = t(o);
|
|
1413
1375
|
(i || !n(r, a)) && (i = !1, r = a, s.next(o));
|
|
1414
1376
|
}));
|
|
1415
1377
|
});
|
|
1416
1378
|
}
|
|
1417
|
-
function
|
|
1379
|
+
function Jt(n, t) {
|
|
1418
1380
|
return n === t;
|
|
1419
1381
|
}
|
|
1420
|
-
function
|
|
1382
|
+
function Qt(n) {
|
|
1421
1383
|
return _(function(t, e) {
|
|
1422
1384
|
try {
|
|
1423
1385
|
t.subscribe(e);
|
|
@@ -1426,18 +1388,18 @@ function un(n) {
|
|
|
1426
1388
|
}
|
|
1427
1389
|
});
|
|
1428
1390
|
}
|
|
1429
|
-
function
|
|
1391
|
+
function Zt(n) {
|
|
1430
1392
|
return _(function(t, e) {
|
|
1431
|
-
|
|
1393
|
+
J(n).subscribe(R(e, function() {
|
|
1432
1394
|
return e.complete();
|
|
1433
|
-
},
|
|
1395
|
+
}, ie)), !e.closed && t.subscribe(e);
|
|
1434
1396
|
});
|
|
1435
1397
|
}
|
|
1436
1398
|
function ve(n) {
|
|
1437
1399
|
const { endpoint: t, apiKey: e, payload: s, debugMode: r, customHeaders: i } = n, o = n.method ?? "POST";
|
|
1438
1400
|
return new y((a) => {
|
|
1439
|
-
const
|
|
1440
|
-
let
|
|
1401
|
+
const u = new AbortController();
|
|
1402
|
+
let c, l = !1, m = !1;
|
|
1441
1403
|
const v = {
|
|
1442
1404
|
"Content-Type": "application/json",
|
|
1443
1405
|
...i
|
|
@@ -1448,7 +1410,7 @@ function ve(n) {
|
|
|
1448
1410
|
method: o,
|
|
1449
1411
|
headers: v,
|
|
1450
1412
|
body: o === "POST" && s ? JSON.stringify(s) : void 0,
|
|
1451
|
-
signal:
|
|
1413
|
+
signal: u.signal,
|
|
1452
1414
|
/**
|
|
1453
1415
|
* Allow SSE to work when the page is hidden.
|
|
1454
1416
|
* https://github.com/Azure/fetch-event-source/issues/17#issuecomment-1525904929
|
|
@@ -1456,7 +1418,7 @@ function ve(n) {
|
|
|
1456
1418
|
openWhenHidden: !0,
|
|
1457
1419
|
onopen: async (p) => {
|
|
1458
1420
|
if (p.ok)
|
|
1459
|
-
|
|
1421
|
+
c = p.headers.get("X-Trace-Id") ?? void 0;
|
|
1460
1422
|
else {
|
|
1461
1423
|
let f;
|
|
1462
1424
|
try {
|
|
@@ -1468,28 +1430,28 @@ function ve(n) {
|
|
|
1468
1430
|
f = null;
|
|
1469
1431
|
}
|
|
1470
1432
|
}
|
|
1471
|
-
a.error(new
|
|
1433
|
+
a.error(new I(p.status, p.statusText, f)), u.abort();
|
|
1472
1434
|
}
|
|
1473
1435
|
},
|
|
1474
1436
|
onmessage: (p) => {
|
|
1475
|
-
p.id && (
|
|
1437
|
+
p.id && (l = !0);
|
|
1476
1438
|
const f = JSON.parse(p.data);
|
|
1477
|
-
|
|
1439
|
+
c ? f.traceId = c : f.requestId && (f.traceId = f.requestId, c || (c = f.requestId)), a.next(f);
|
|
1478
1440
|
},
|
|
1479
1441
|
onclose: () => {
|
|
1480
1442
|
a.complete();
|
|
1481
1443
|
},
|
|
1482
1444
|
onerror: (p) => {
|
|
1483
1445
|
if (m) throw p;
|
|
1484
|
-
if (!
|
|
1485
|
-
throw a.error(p),
|
|
1446
|
+
if (!l)
|
|
1447
|
+
throw a.error(p), u.abort(), p;
|
|
1486
1448
|
}
|
|
1487
1449
|
}), () => {
|
|
1488
|
-
m = !0,
|
|
1450
|
+
m = !0, u.abort();
|
|
1489
1451
|
};
|
|
1490
1452
|
});
|
|
1491
1453
|
}
|
|
1492
|
-
class
|
|
1454
|
+
class en {
|
|
1493
1455
|
listeners = {};
|
|
1494
1456
|
on(t, e) {
|
|
1495
1457
|
this.listeners = Object.assign({}, this.listeners, {
|
|
@@ -1508,17 +1470,18 @@ class dn {
|
|
|
1508
1470
|
this.listeners[t] && this.listeners[t].forEach((s) => s(...e));
|
|
1509
1471
|
}
|
|
1510
1472
|
}
|
|
1511
|
-
|
|
1473
|
+
const tn = 50;
|
|
1474
|
+
class _n {
|
|
1512
1475
|
apiKey;
|
|
1513
1476
|
endpoint;
|
|
1514
1477
|
botProviderEndpoint;
|
|
1515
1478
|
debugMode;
|
|
1516
|
-
destroy$ = new
|
|
1479
|
+
destroy$ = new ue();
|
|
1517
1480
|
closed = !1;
|
|
1518
1481
|
detached = !1;
|
|
1519
1482
|
detachTimer;
|
|
1520
1483
|
inFlight = 0;
|
|
1521
|
-
sseEmitter = new
|
|
1484
|
+
sseEmitter = new en();
|
|
1522
1485
|
transformSsePayload;
|
|
1523
1486
|
customHeaders;
|
|
1524
1487
|
constructor(t) {
|
|
@@ -1539,33 +1502,33 @@ class Dn {
|
|
|
1539
1502
|
}
|
|
1540
1503
|
handleEvent(t) {
|
|
1541
1504
|
switch (t.eventType) {
|
|
1542
|
-
case
|
|
1543
|
-
this.sseEmitter.emit(
|
|
1505
|
+
case d.INIT:
|
|
1506
|
+
this.sseEmitter.emit(d.INIT, t);
|
|
1544
1507
|
break;
|
|
1545
|
-
case
|
|
1546
|
-
case
|
|
1547
|
-
this.sseEmitter.emit(
|
|
1508
|
+
case d.PROCESS_START:
|
|
1509
|
+
case d.PROCESS_COMPLETE:
|
|
1510
|
+
this.sseEmitter.emit(d.PROCESS, t);
|
|
1548
1511
|
break;
|
|
1549
|
-
case
|
|
1550
|
-
case
|
|
1551
|
-
case
|
|
1552
|
-
this.sseEmitter.emit(
|
|
1512
|
+
case d.MESSAGE_START:
|
|
1513
|
+
case d.MESSAGE_DELTA:
|
|
1514
|
+
case d.MESSAGE_COMPLETE:
|
|
1515
|
+
this.sseEmitter.emit(d.MESSAGE, t);
|
|
1553
1516
|
break;
|
|
1554
|
-
case
|
|
1555
|
-
case
|
|
1556
|
-
this.sseEmitter.emit(
|
|
1517
|
+
case d.TOOL_CALL_START:
|
|
1518
|
+
case d.TOOL_CALL_COMPLETE:
|
|
1519
|
+
this.sseEmitter.emit(d.TOOL_CALL, t);
|
|
1557
1520
|
break;
|
|
1558
|
-
case
|
|
1521
|
+
case d.TOOL_CALL_CONSENT:
|
|
1559
1522
|
this.sseEmitter.emit(
|
|
1560
|
-
|
|
1523
|
+
d.TOOL_CALL_CONSENT,
|
|
1561
1524
|
t
|
|
1562
1525
|
);
|
|
1563
1526
|
break;
|
|
1564
|
-
case
|
|
1565
|
-
this.sseEmitter.emit(
|
|
1527
|
+
case d.DONE:
|
|
1528
|
+
this.sseEmitter.emit(d.DONE, t);
|
|
1566
1529
|
break;
|
|
1567
|
-
case
|
|
1568
|
-
this.sseEmitter.emit(
|
|
1530
|
+
case d.ERROR:
|
|
1531
|
+
this.sseEmitter.emit(d.ERROR, t);
|
|
1569
1532
|
break;
|
|
1570
1533
|
}
|
|
1571
1534
|
}
|
|
@@ -1622,7 +1585,7 @@ class Dn {
|
|
|
1622
1585
|
if (i.status === 404)
|
|
1623
1586
|
return null;
|
|
1624
1587
|
if (!i.ok)
|
|
1625
|
-
throw new
|
|
1588
|
+
throw new I(i.status, i.statusText, await i.text().catch(() => {
|
|
1626
1589
|
}));
|
|
1627
1590
|
const o = await i.json(), a = o.data ?? o;
|
|
1628
1591
|
return {
|
|
@@ -1631,12 +1594,12 @@ class Dn {
|
|
|
1631
1594
|
lastActivityAt: a.lastActivityAt,
|
|
1632
1595
|
// F-019 — whitelist-pass the live-sandbox list (map the five backend fields); `[]` for an old
|
|
1633
1596
|
// backend / a channel with none live. metadata is the sole authority on "who is live".
|
|
1634
|
-
launchedSandboxes: (a.launchedSandboxes ?? []).map((
|
|
1635
|
-
sandboxName:
|
|
1636
|
-
sandboxBlueprintName:
|
|
1637
|
-
workingDirectory:
|
|
1638
|
-
editorServerEnabled:
|
|
1639
|
-
browserEnabled:
|
|
1597
|
+
launchedSandboxes: (a.launchedSandboxes ?? []).map((u) => ({
|
|
1598
|
+
sandboxName: u.sandboxName,
|
|
1599
|
+
sandboxBlueprintName: u.sandboxBlueprintName,
|
|
1600
|
+
workingDirectory: u.workingDirectory,
|
|
1601
|
+
editorServerEnabled: u.editorServerEnabled,
|
|
1602
|
+
browserEnabled: u.browserEnabled
|
|
1640
1603
|
}))
|
|
1641
1604
|
};
|
|
1642
1605
|
}
|
|
@@ -1668,7 +1631,7 @@ class Dn {
|
|
|
1668
1631
|
r.searchParams.set("custom_channel_id", t), e?.requestId && r.searchParams.set("request_id", e.requestId), e?.force && r.searchParams.set("force", "true");
|
|
1669
1632
|
const i = await fetch(r.toString(), { method: "POST", headers: this.apiHeaders() });
|
|
1670
1633
|
if (!(i.ok || i.status === 404))
|
|
1671
|
-
throw new
|
|
1634
|
+
throw new I(i.status, i.statusText, await i.text().catch(() => {
|
|
1672
1635
|
}));
|
|
1673
1636
|
}
|
|
1674
1637
|
runSse(t, e) {
|
|
@@ -1676,14 +1639,31 @@ class Dn {
|
|
|
1676
1639
|
// No RxJS-level retry: re-subscribing would re-POST and the backend would re-dispatch a duplicate
|
|
1677
1640
|
// run. Mid-stream resume is the library's job (native Last-Event-ID reconnect in
|
|
1678
1641
|
// create-sse-observable); a no-cursor failure surfaces via `error` below.
|
|
1679
|
-
|
|
1680
|
-
|
|
1642
|
+
//
|
|
1643
|
+
// **Gate on a window, not on every frame.** This used to be
|
|
1644
|
+
// `concatMap(event => of(event).pipe(delay(delayTime ?? 50)))`. `concatMap` is strictly serial,
|
|
1645
|
+
// so the cost grew with the *number* of frames rather than the amount of data or the backend's
|
|
1646
|
+
// speed — and stream deltas are token-sized. A canvas fragment arrives as hundreds of frames
|
|
1647
|
+
// (measured: a 2.6KB drawing = 372 frames of ~7 characters), which made the SDK alone add
|
|
1648
|
+
// ~19s at 51.7ms per frame before the conversation held the whole fragment. That is precisely
|
|
1649
|
+
// the "stare at a blank card, then it pops in" F-030 exists to avoid.
|
|
1650
|
+
//
|
|
1651
|
+
// `bufferTime` keeps the reason the delay was here — never push hundreds of separate updates
|
|
1652
|
+
// at a consumer, one microtask apart — but the latency it adds is one window total, no matter
|
|
1653
|
+
// how many frames land in it. Frames are still delivered individually and in order below, so
|
|
1654
|
+
// nothing downstream can tell the difference apart from the timing.
|
|
1655
|
+
zt(e?.delayTime ?? tn),
|
|
1656
|
+
// An idle stream still ticks an empty buffer every window; do not wake the consumer for nothing.
|
|
1657
|
+
Yt((s) => s.length > 0),
|
|
1658
|
+
Zt(this.destroy$),
|
|
1681
1659
|
// Settle the run accounting on every termination path — complete, error, AND a user-initiated
|
|
1682
1660
|
// unsubscribe (stop-generation aborts the connection without a terminal event).
|
|
1683
|
-
|
|
1661
|
+
Qt(() => this.onRunSettled())
|
|
1684
1662
|
).subscribe({
|
|
1685
1663
|
next: (s) => {
|
|
1686
|
-
|
|
1664
|
+
if (!this.detached)
|
|
1665
|
+
for (const r of s)
|
|
1666
|
+
e?.onSseMessage?.(r), this.handleEvent(r);
|
|
1687
1667
|
},
|
|
1688
1668
|
error: (s) => {
|
|
1689
1669
|
this.detached || e?.onSseError?.(s);
|
|
@@ -1769,8 +1749,8 @@ class Dn {
|
|
|
1769
1749
|
});
|
|
1770
1750
|
if (!a.ok)
|
|
1771
1751
|
throw new Error(`Channel Home download failed: ${a.status} ${a.statusText}`);
|
|
1772
|
-
const
|
|
1773
|
-
return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename:
|
|
1752
|
+
const u = await a.blob(), c = t.split("/").pop() || "download";
|
|
1753
|
+
return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename: c, size: u.size }), { blob: u, filename: c };
|
|
1774
1754
|
} catch (a) {
|
|
1775
1755
|
throw console.error("[AsgardServiceClient] Channel Home download error:", a), a;
|
|
1776
1756
|
}
|
|
@@ -1791,7 +1771,7 @@ class Dn {
|
|
|
1791
1771
|
this.apiKey && (r["X-API-KEY"] = this.apiKey);
|
|
1792
1772
|
const i = await fetch(s, { method: "POST", headers: r });
|
|
1793
1773
|
if (!i.ok)
|
|
1794
|
-
throw new
|
|
1774
|
+
throw new I(i.status, i.statusText, await i.text().catch(() => {
|
|
1795
1775
|
}));
|
|
1796
1776
|
const o = await i.json(), a = o.data?.openURL ?? o.openURL;
|
|
1797
1777
|
if (!a)
|
|
@@ -1821,7 +1801,7 @@ class Dn {
|
|
|
1821
1801
|
s.searchParams.set("path", e);
|
|
1822
1802
|
const r = await fetch(s.toString(), { method: "GET", headers: this.apiHeaders() });
|
|
1823
1803
|
if (!r.ok)
|
|
1824
|
-
throw new
|
|
1804
|
+
throw new I(r.status, r.statusText, await r.text().catch(() => {
|
|
1825
1805
|
}));
|
|
1826
1806
|
const i = await r.json(), o = i.data ?? i;
|
|
1827
1807
|
return { entries: o.entries ?? [], truncated: o.truncated ?? !1 };
|
|
@@ -1835,7 +1815,7 @@ class Dn {
|
|
|
1835
1815
|
r.searchParams.set("path", e), s?.offsetBytes != null && r.searchParams.set("offset_bytes", String(s.offsetBytes)), s?.limitBytes != null && r.searchParams.set("limit_bytes", String(s.limitBytes));
|
|
1836
1816
|
const i = await fetch(r.toString(), { method: "GET", headers: this.apiHeaders() });
|
|
1837
1817
|
if (!i.ok)
|
|
1838
|
-
throw new
|
|
1818
|
+
throw new I(i.status, i.statusText, await i.text().catch(() => {
|
|
1839
1819
|
}));
|
|
1840
1820
|
const o = await i.blob(), a = i.headers.get("X-Total-Bytes");
|
|
1841
1821
|
return {
|
|
@@ -1860,18 +1840,18 @@ class Dn {
|
|
|
1860
1840
|
signal: r?.signal
|
|
1861
1841
|
});
|
|
1862
1842
|
if (!a.ok)
|
|
1863
|
-
throw new
|
|
1843
|
+
throw new I(a.status, a.statusText, await a.text().catch(() => {
|
|
1864
1844
|
}));
|
|
1865
|
-
const
|
|
1866
|
-
return { bytesWritten: (
|
|
1845
|
+
const u = await a.json();
|
|
1846
|
+
return { bytesWritten: (u.data ?? u).bytesWritten ?? 0 };
|
|
1867
1847
|
}
|
|
1868
1848
|
/** F-021 Cycle 2 — `sandbox://` fs mutation shared request helper (throws `HttpError` on non-OK). */
|
|
1869
1849
|
async sandboxFsRequest(t, e, s, r) {
|
|
1870
1850
|
const i = new URL(`${this.deriveSandboxFsEndpoint(t)}/${e}`);
|
|
1871
|
-
Object.entries(r).forEach(([a,
|
|
1851
|
+
Object.entries(r).forEach(([a, u]) => i.searchParams.set(a, u));
|
|
1872
1852
|
const o = await fetch(i.toString(), { method: s, headers: this.apiHeaders() });
|
|
1873
1853
|
if (!o.ok)
|
|
1874
|
-
throw new
|
|
1854
|
+
throw new I(o.status, o.statusText, await o.text().catch(() => {
|
|
1875
1855
|
}));
|
|
1876
1856
|
return o.json().catch(() => null);
|
|
1877
1857
|
}
|
|
@@ -1881,7 +1861,7 @@ class Dn {
|
|
|
1881
1861
|
s.searchParams.set("path", e);
|
|
1882
1862
|
const r = await fetch(s.toString(), { method: "GET", headers: this.apiHeaders() });
|
|
1883
1863
|
if (!r.ok)
|
|
1884
|
-
throw new
|
|
1864
|
+
throw new I(r.status, r.statusText, await r.text().catch(() => {
|
|
1885
1865
|
}));
|
|
1886
1866
|
const i = await r.json(), o = i.data ?? i;
|
|
1887
1867
|
return {
|
|
@@ -1934,7 +1914,7 @@ class Dn {
|
|
|
1934
1914
|
if (!o.ok) {
|
|
1935
1915
|
const a = await o.text().catch(() => {
|
|
1936
1916
|
});
|
|
1937
|
-
r.error(new
|
|
1917
|
+
r.error(new I(o.status, o.statusText, a)), i.abort();
|
|
1938
1918
|
}
|
|
1939
1919
|
},
|
|
1940
1920
|
onmessage: (o) => {
|
|
@@ -1963,9 +1943,9 @@ class Dn {
|
|
|
1963
1943
|
return !t && this.endpoint && (t = this.endpoint.replace("/message/sse", "")), t ? t.replace(/\/+$/, "") : null;
|
|
1964
1944
|
}
|
|
1965
1945
|
}
|
|
1966
|
-
const
|
|
1967
|
-
function
|
|
1968
|
-
if (n ===
|
|
1946
|
+
const nn = "", sn = /* @__PURE__ */ new Set(["", ".", ".."]);
|
|
1947
|
+
function C(n, t) {
|
|
1948
|
+
if (n === nn) {
|
|
1969
1949
|
if (t?.allowRoot)
|
|
1970
1950
|
return n;
|
|
1971
1951
|
throw new Error(
|
|
@@ -1976,15 +1956,15 @@ function I(n, t) {
|
|
|
1976
1956
|
throw new Error(`SourceSet volume path must be relative, with no leading slash (the root is ""): "${n}".`);
|
|
1977
1957
|
if (n.endsWith("/"))
|
|
1978
1958
|
throw new Error(`SourceSet volume path must not end with a slash: "${n}".`);
|
|
1979
|
-
if (n.split("/").some((e) =>
|
|
1959
|
+
if (n.split("/").some((e) => sn.has(e)))
|
|
1980
1960
|
throw new Error(`SourceSet volume path must not contain empty, "." or ".." segments: "${n}".`);
|
|
1981
1961
|
return n;
|
|
1982
1962
|
}
|
|
1983
|
-
const
|
|
1963
|
+
const We = 1e3, rn = 1e4;
|
|
1984
1964
|
function Se(n) {
|
|
1985
|
-
return Math.min(Math.max(1, Math.floor(n)),
|
|
1965
|
+
return Math.min(Math.max(1, Math.floor(n)), We);
|
|
1986
1966
|
}
|
|
1987
|
-
class
|
|
1967
|
+
class Ln {
|
|
1988
1968
|
endpoint;
|
|
1989
1969
|
apiKey;
|
|
1990
1970
|
customHeaders;
|
|
@@ -1997,18 +1977,18 @@ class Hn {
|
|
|
1997
1977
|
return this.apiKey && (t["X-API-KEY"] = this.apiKey), t;
|
|
1998
1978
|
}
|
|
1999
1979
|
/** Issue one volume request, turning any non-2xx into {@link HttpError} (409 included, see R8). */
|
|
2000
|
-
async request(t, e, s, r) {
|
|
2001
|
-
const
|
|
2002
|
-
Object.entries(s).forEach(([
|
|
2003
|
-
const
|
|
2004
|
-
if (!
|
|
2005
|
-
throw new
|
|
1980
|
+
async request(t, e, s, r, i) {
|
|
1981
|
+
const o = new URL(`${this.endpoint}/${t}`);
|
|
1982
|
+
Object.entries(s).forEach(([u, c]) => o.searchParams.set(u, c));
|
|
1983
|
+
const a = await fetch(o.toString(), { method: e, headers: this.headers(), body: r, signal: i });
|
|
1984
|
+
if (!a.ok)
|
|
1985
|
+
throw new I(a.status, a.statusText, await a.text().catch(() => {
|
|
2006
1986
|
}));
|
|
2007
|
-
return
|
|
1987
|
+
return a;
|
|
2008
1988
|
}
|
|
2009
1989
|
/** One page of a directory (`GET volume/list?path=[&page&page_size]`). `path` may be the root `''`. */
|
|
2010
1990
|
async list(t, e) {
|
|
2011
|
-
const s = { path:
|
|
1991
|
+
const s = { path: C(t, { allowRoot: !0 }) };
|
|
2012
1992
|
e?.page != null && (s.page = String(e.page)), e?.pageSize != null && (s.page_size = String(Se(e.pageSize)));
|
|
2013
1993
|
const i = await (await this.request("list", "GET", s)).json(), o = i.data ?? i;
|
|
2014
1994
|
return {
|
|
@@ -2026,31 +2006,31 @@ class Hn {
|
|
|
2026
2006
|
* directory that looks whole is the failure this exists to prevent.
|
|
2027
2007
|
*/
|
|
2028
2008
|
async listAll(t, e) {
|
|
2029
|
-
const s = Se(e?.pageSize ??
|
|
2030
|
-
let o = 0, a = !0,
|
|
2009
|
+
const s = Se(e?.pageSize ?? We), r = e?.maxEntries ?? rn, i = [];
|
|
2010
|
+
let o = 0, a = !0, u = 0;
|
|
2031
2011
|
for (; ; ) {
|
|
2032
|
-
const
|
|
2033
|
-
if (
|
|
2034
|
-
o =
|
|
2012
|
+
const c = await this.list(t, { page: u, pageSize: s }), l = c.paging;
|
|
2013
|
+
if (l && l.index !== u) {
|
|
2014
|
+
o = l.total, a = !1;
|
|
2035
2015
|
break;
|
|
2036
2016
|
}
|
|
2037
|
-
if (i.push(...
|
|
2038
|
-
a =
|
|
2017
|
+
if (i.push(...c.entries), !l) {
|
|
2018
|
+
a = c.entries.length < s;
|
|
2039
2019
|
break;
|
|
2040
2020
|
}
|
|
2041
|
-
if (o =
|
|
2021
|
+
if (o = l.total, i.length >= o)
|
|
2042
2022
|
break;
|
|
2043
|
-
if (i.length >= r ||
|
|
2023
|
+
if (i.length >= r || c.entries.length === 0) {
|
|
2044
2024
|
a = !1;
|
|
2045
2025
|
break;
|
|
2046
2026
|
}
|
|
2047
|
-
|
|
2027
|
+
u += 1;
|
|
2048
2028
|
}
|
|
2049
2029
|
return { entries: i, total: o, complete: a };
|
|
2050
2030
|
}
|
|
2051
2031
|
/** Stat a path (`GET volume/stat?path=`). A missing path is 200 with `exists: false`, not a 404. */
|
|
2052
2032
|
async stat(t) {
|
|
2053
|
-
const s = await (await this.request("stat", "GET", { path:
|
|
2033
|
+
const s = await (await this.request("stat", "GET", { path: C(t) })).json(), r = s.data ?? s;
|
|
2054
2034
|
return {
|
|
2055
2035
|
exists: r.exists ?? !1,
|
|
2056
2036
|
isDir: r.isDir ?? !1,
|
|
@@ -2062,7 +2042,7 @@ class Hn {
|
|
|
2062
2042
|
}
|
|
2063
2043
|
/** Read a file (`GET volume/file?path=[&offset_bytes&limit_bytes]`) as raw bytes. */
|
|
2064
2044
|
async read(t, e) {
|
|
2065
|
-
const s = { path:
|
|
2045
|
+
const s = { path: C(t) };
|
|
2066
2046
|
e?.offsetBytes != null && (s.offset_bytes = String(e.offsetBytes)), e?.limitBytes != null && (s.limit_bytes = String(e.limitBytes));
|
|
2067
2047
|
const r = await this.request("file", "GET", s), i = await r.blob(), o = r.headers.get("X-Total-Bytes");
|
|
2068
2048
|
return {
|
|
@@ -2076,24 +2056,24 @@ class Hn {
|
|
|
2076
2056
|
* With `createOnly`, an existing path is a 409 rather than an overwrite.
|
|
2077
2057
|
*/
|
|
2078
2058
|
async write(t, e, s) {
|
|
2079
|
-
const r = { path:
|
|
2059
|
+
const r = { path: C(t) };
|
|
2080
2060
|
s?.mode != null && (r.mode = String(s.mode)), s?.createOnly && (r.create_only = "true");
|
|
2081
2061
|
const i = new FormData();
|
|
2082
2062
|
i.append("file", e instanceof Blob ? e : new Blob([e]));
|
|
2083
|
-
const a = await (await this.request("file", "PUT", r, i)).json();
|
|
2063
|
+
const a = await (await this.request("file", "PUT", r, i, s?.signal)).json();
|
|
2084
2064
|
return { bytesWritten: (a.data ?? a).bytesWritten ?? 0 };
|
|
2085
2065
|
}
|
|
2086
2066
|
/** Create a directory and any missing parents (`POST volume/mkdir?path=`). */
|
|
2087
|
-
async mkdir(t) {
|
|
2088
|
-
await this.request("mkdir", "POST", { path:
|
|
2067
|
+
async mkdir(t, e) {
|
|
2068
|
+
await this.request("mkdir", "POST", { path: C(t) }, void 0, e?.signal);
|
|
2089
2069
|
}
|
|
2090
2070
|
/** Delete a file or empty directory (`DELETE volume/item?path=`). */
|
|
2091
2071
|
async remove(t) {
|
|
2092
|
-
await this.request("item", "DELETE", { path:
|
|
2072
|
+
await this.request("item", "DELETE", { path: C(t) });
|
|
2093
2073
|
}
|
|
2094
2074
|
/** Recursively delete a directory (`DELETE volume/all?path=`). The volume root is not a valid target. */
|
|
2095
2075
|
async removeAll(t) {
|
|
2096
|
-
await this.request("all", "DELETE", { path:
|
|
2076
|
+
await this.request("all", "DELETE", { path: C(t) });
|
|
2097
2077
|
}
|
|
2098
2078
|
/** Copy a file or directory tree (`POST volume/copy?src=&dst=[&overwrite]`). */
|
|
2099
2079
|
async copy(t, e, s) {
|
|
@@ -2105,36 +2085,36 @@ class Hn {
|
|
|
2105
2085
|
await this.request("move", "POST", this.copyMoveQuery(t, e, s));
|
|
2106
2086
|
}
|
|
2107
2087
|
copyMoveQuery(t, e, s) {
|
|
2108
|
-
const r = { src:
|
|
2088
|
+
const r = { src: C(t), dst: C(e) };
|
|
2109
2089
|
return s?.overwrite && (r.overwrite = "true"), r;
|
|
2110
2090
|
}
|
|
2111
2091
|
}
|
|
2112
2092
|
const S = [];
|
|
2113
2093
|
for (let n = 0; n < 256; ++n)
|
|
2114
2094
|
S.push((n + 256).toString(16).slice(1));
|
|
2115
|
-
function
|
|
2095
|
+
function on(n, t = 0) {
|
|
2116
2096
|
return (S[n[t + 0]] + S[n[t + 1]] + S[n[t + 2]] + S[n[t + 3]] + "-" + S[n[t + 4]] + S[n[t + 5]] + "-" + S[n[t + 6]] + S[n[t + 7]] + "-" + S[n[t + 8]] + S[n[t + 9]] + "-" + S[n[t + 10]] + S[n[t + 11]] + S[n[t + 12]] + S[n[t + 13]] + S[n[t + 14]] + S[n[t + 15]]).toLowerCase();
|
|
2117
2097
|
}
|
|
2118
|
-
let
|
|
2119
|
-
const
|
|
2120
|
-
function
|
|
2121
|
-
if (!
|
|
2098
|
+
let Z;
|
|
2099
|
+
const an = new Uint8Array(16);
|
|
2100
|
+
function cn() {
|
|
2101
|
+
if (!Z) {
|
|
2122
2102
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
2123
2103
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2124
|
-
|
|
2104
|
+
Z = crypto.getRandomValues.bind(crypto);
|
|
2125
2105
|
}
|
|
2126
|
-
return
|
|
2106
|
+
return Z(an);
|
|
2127
2107
|
}
|
|
2128
|
-
const
|
|
2129
|
-
function
|
|
2108
|
+
const un = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ye = { randomUUID: un };
|
|
2109
|
+
function ln(n, t, e) {
|
|
2130
2110
|
n = n || {};
|
|
2131
|
-
const s = n.random ?? n.rng?.() ??
|
|
2111
|
+
const s = n.random ?? n.rng?.() ?? cn();
|
|
2132
2112
|
if (s.length < 16)
|
|
2133
2113
|
throw new Error("Random bytes length must be >= 16");
|
|
2134
|
-
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128,
|
|
2114
|
+
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, on(s);
|
|
2135
2115
|
}
|
|
2136
|
-
function
|
|
2137
|
-
return ye.randomUUID && !n ? ye.randomUUID() :
|
|
2116
|
+
function Xe(n, t, e) {
|
|
2117
|
+
return ye.randomUUID && !n ? ye.randomUUID() : ln(n);
|
|
2138
2118
|
}
|
|
2139
2119
|
class g {
|
|
2140
2120
|
messages = null;
|
|
@@ -2188,37 +2168,37 @@ class g {
|
|
|
2188
2168
|
}
|
|
2189
2169
|
onMessage(t) {
|
|
2190
2170
|
switch (t.eventType) {
|
|
2191
|
-
case
|
|
2171
|
+
case d.MESSAGE_START:
|
|
2192
2172
|
return this.onMessageStart(t);
|
|
2193
|
-
case
|
|
2173
|
+
case d.MESSAGE_DELTA:
|
|
2194
2174
|
return this.onMessageDelta(t);
|
|
2195
|
-
case
|
|
2175
|
+
case d.MESSAGE_COMPLETE:
|
|
2196
2176
|
return this.onMessageComplete(t);
|
|
2197
|
-
case
|
|
2177
|
+
case d.MESSAGE_USER:
|
|
2198
2178
|
return this.onMessageUser(t);
|
|
2199
|
-
case
|
|
2179
|
+
case d.MESSAGE_THINKING_START:
|
|
2200
2180
|
return this.onThinkingStart(t);
|
|
2201
|
-
case
|
|
2181
|
+
case d.MESSAGE_THINKING_DELTA:
|
|
2202
2182
|
return this.onThinkingDelta(t);
|
|
2203
|
-
case
|
|
2183
|
+
case d.MESSAGE_THINKING_COMPLETE:
|
|
2204
2184
|
return this.onThinkingComplete(t);
|
|
2205
|
-
case
|
|
2185
|
+
case d.MESSAGE_CANVAS_START:
|
|
2206
2186
|
return this.onCanvasStart(t);
|
|
2207
|
-
case
|
|
2187
|
+
case d.MESSAGE_CANVAS_DELTA:
|
|
2208
2188
|
return this.onCanvasDelta(t);
|
|
2209
|
-
case
|
|
2189
|
+
case d.MESSAGE_CANVAS_COMPLETE:
|
|
2210
2190
|
return this.onCanvasComplete(t);
|
|
2211
|
-
case
|
|
2191
|
+
case d.TOOL_CALL_START:
|
|
2212
2192
|
return this.onToolCallStart(t);
|
|
2213
|
-
case
|
|
2193
|
+
case d.TOOL_CALL_COMPLETE:
|
|
2214
2194
|
return this.onToolCallComplete(t);
|
|
2215
|
-
case
|
|
2195
|
+
case d.TOOL_CALL_CONSENT:
|
|
2216
2196
|
return this.onToolCallConsent(t);
|
|
2217
|
-
case
|
|
2197
|
+
case d.SUBAGENT_START:
|
|
2218
2198
|
return this.onSubagentStart(t);
|
|
2219
|
-
case
|
|
2199
|
+
case d.SUBAGENT_COMPLETE:
|
|
2220
2200
|
return this.onSubagentComplete(t);
|
|
2221
|
-
case
|
|
2201
|
+
case d.ERROR:
|
|
2222
2202
|
return this.onMessageError(t);
|
|
2223
2203
|
default:
|
|
2224
2204
|
return this;
|
|
@@ -2264,7 +2244,7 @@ class g {
|
|
|
2264
2244
|
const s = new Map(this.messages);
|
|
2265
2245
|
return s.set(e.messageId, {
|
|
2266
2246
|
type: "bot",
|
|
2267
|
-
eventType:
|
|
2247
|
+
eventType: d.MESSAGE_START,
|
|
2268
2248
|
isTyping: !0,
|
|
2269
2249
|
typingText: "",
|
|
2270
2250
|
messageId: e.messageId,
|
|
@@ -2282,7 +2262,7 @@ class g {
|
|
|
2282
2262
|
const r = s?.type === "bot" ? s : void 0, i = new Map(this.messages);
|
|
2283
2263
|
return i.set(e.messageId, {
|
|
2284
2264
|
type: "bot",
|
|
2285
|
-
eventType:
|
|
2265
|
+
eventType: d.MESSAGE_DELTA,
|
|
2286
2266
|
isTyping: !0,
|
|
2287
2267
|
typingText: `${r?.typingText ?? ""}${e.text}`,
|
|
2288
2268
|
messageId: e.messageId,
|
|
@@ -2298,7 +2278,7 @@ class g {
|
|
|
2298
2278
|
const s = new Map(this.messages), r = s.get(e.messageId);
|
|
2299
2279
|
return s.set(e.messageId, {
|
|
2300
2280
|
type: "bot",
|
|
2301
|
-
eventType:
|
|
2281
|
+
eventType: d.MESSAGE_COMPLETE,
|
|
2302
2282
|
isTyping: !1,
|
|
2303
2283
|
typingText: null,
|
|
2304
2284
|
messageId: e.messageId,
|
|
@@ -2389,10 +2369,10 @@ class g {
|
|
|
2389
2369
|
const s = e.template?.type === Te.CANVAS ? e.template : void 0, r = s?.canvas?.html;
|
|
2390
2370
|
if (!r) {
|
|
2391
2371
|
if (!this.messages?.has(e.messageId)) return this;
|
|
2392
|
-
const
|
|
2393
|
-
return
|
|
2372
|
+
const c = new Map(this.messages);
|
|
2373
|
+
return c.delete(e.messageId), new g({ messages: c, pendingConsent: this.pendingConsent });
|
|
2394
2374
|
}
|
|
2395
|
-
const i = this.messages?.get(e.messageId), o = i?.type === "canvas" ? i : void 0, a = new Map(this.messages),
|
|
2375
|
+
const i = this.messages?.get(e.messageId), o = i?.type === "canvas" ? i : void 0, a = new Map(this.messages), u = {
|
|
2396
2376
|
type: "canvas",
|
|
2397
2377
|
messageId: e.messageId,
|
|
2398
2378
|
// **Replace, never append.** This fragment is authoritative, and a rejoin replays only the
|
|
@@ -2403,7 +2383,7 @@ class g {
|
|
|
2403
2383
|
time: o?.time ?? /* @__PURE__ */ new Date(),
|
|
2404
2384
|
traceId: t.traceId ?? o?.traceId
|
|
2405
2385
|
};
|
|
2406
|
-
return a.set(e.messageId,
|
|
2386
|
+
return a.set(e.messageId, u), new g({ messages: a, pendingConsent: this.pendingConsent });
|
|
2407
2387
|
}
|
|
2408
2388
|
onMessageUser(t) {
|
|
2409
2389
|
const e = t.fact.messageUser;
|
|
@@ -2422,10 +2402,10 @@ class g {
|
|
|
2422
2402
|
return r.set(e.messageId, i), new g({ messages: r, pendingConsent: this.pendingConsent });
|
|
2423
2403
|
}
|
|
2424
2404
|
onMessageError(t) {
|
|
2425
|
-
const e =
|
|
2405
|
+
const e = Xe(), s = t.fact.runError.error, r = new Map(this.messages);
|
|
2426
2406
|
return r.set(e, {
|
|
2427
2407
|
type: "error",
|
|
2428
|
-
eventType:
|
|
2408
|
+
eventType: d.ERROR,
|
|
2429
2409
|
messageId: e,
|
|
2430
2410
|
error: s,
|
|
2431
2411
|
time: /* @__PURE__ */ new Date(),
|
|
@@ -2437,7 +2417,7 @@ class g {
|
|
|
2437
2417
|
if (this.isTerminalToolCall(this.messages?.get(r))) return this;
|
|
2438
2418
|
const i = {
|
|
2439
2419
|
type: "tool-call",
|
|
2440
|
-
eventType:
|
|
2420
|
+
eventType: d.TOOL_CALL_START,
|
|
2441
2421
|
messageId: r,
|
|
2442
2422
|
processId: e.processId,
|
|
2443
2423
|
callSeq: e.callSeq,
|
|
@@ -2458,7 +2438,7 @@ class g {
|
|
|
2458
2438
|
if (i?.type === "tool-call") {
|
|
2459
2439
|
const o = {
|
|
2460
2440
|
...i,
|
|
2461
|
-
eventType:
|
|
2441
|
+
eventType: d.TOOL_CALL_COMPLETE,
|
|
2462
2442
|
result: e.toolCallResult,
|
|
2463
2443
|
isError: e.isError,
|
|
2464
2444
|
sidecar: e.toolUseResultSidecar,
|
|
@@ -2469,7 +2449,7 @@ class g {
|
|
|
2469
2449
|
} else {
|
|
2470
2450
|
const o = {
|
|
2471
2451
|
type: "tool-call",
|
|
2472
|
-
eventType:
|
|
2452
|
+
eventType: d.TOOL_CALL_COMPLETE,
|
|
2473
2453
|
messageId: r,
|
|
2474
2454
|
processId: e.processId,
|
|
2475
2455
|
callSeq: e.callSeq,
|
|
@@ -2524,50 +2504,50 @@ class g {
|
|
|
2524
2504
|
return s.delete(r), s.set(r, i), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2525
2505
|
}
|
|
2526
2506
|
}
|
|
2527
|
-
const
|
|
2528
|
-
function
|
|
2529
|
-
return n.toolsetName === "" &&
|
|
2507
|
+
const dn = /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate"]);
|
|
2508
|
+
function hn(n) {
|
|
2509
|
+
return n.toolsetName === "" && dn.has(n.toolName);
|
|
2530
2510
|
}
|
|
2531
2511
|
function we(n) {
|
|
2532
2512
|
return typeof n == "object" && n !== null ? n : void 0;
|
|
2533
2513
|
}
|
|
2534
|
-
function
|
|
2514
|
+
function x(n) {
|
|
2535
2515
|
return typeof n == "string" ? n : void 0;
|
|
2536
2516
|
}
|
|
2537
|
-
function
|
|
2517
|
+
function fn(n) {
|
|
2538
2518
|
const t = [], e = /* @__PURE__ */ new Map();
|
|
2539
2519
|
for (const s of n) {
|
|
2540
2520
|
const r = s.parameter ?? {}, i = s.sidecar ?? {};
|
|
2541
2521
|
if (s.toolName === "TaskCreate") {
|
|
2542
|
-
const o = we(i.task), a =
|
|
2522
|
+
const o = we(i.task), a = x(o?.id);
|
|
2543
2523
|
if (!a) continue;
|
|
2544
2524
|
e.has(a) || t.push(a), e.set(a, {
|
|
2545
2525
|
id: a,
|
|
2546
|
-
subject:
|
|
2547
|
-
activeForm:
|
|
2548
|
-
description:
|
|
2526
|
+
subject: x(r.subject) || x(o?.subject) || "",
|
|
2527
|
+
activeForm: x(r.activeForm),
|
|
2528
|
+
description: x(r.description),
|
|
2549
2529
|
status: e.get(a)?.status ?? "pending"
|
|
2550
2530
|
// initial status = pending (keep existing on repeat)
|
|
2551
2531
|
});
|
|
2552
2532
|
} else if (s.toolName === "TaskUpdate") {
|
|
2553
|
-
const o = we(i.statusChange), a =
|
|
2554
|
-
if (!a || !
|
|
2555
|
-
const
|
|
2556
|
-
|
|
2533
|
+
const o = we(i.statusChange), a = x(r.taskId) || x(i.taskId), u = x(o?.to) || x(r.status);
|
|
2534
|
+
if (!a || !u) continue;
|
|
2535
|
+
const c = e.get(a);
|
|
2536
|
+
c && e.set(a, { ...c, status: u });
|
|
2557
2537
|
}
|
|
2558
2538
|
}
|
|
2559
2539
|
return t.map((s) => e.get(s));
|
|
2560
2540
|
}
|
|
2561
|
-
function
|
|
2541
|
+
function pn(n) {
|
|
2562
2542
|
return n.toolsetName === "" && n.toolName === "Agent";
|
|
2563
2543
|
}
|
|
2564
|
-
function
|
|
2544
|
+
function mn(n) {
|
|
2565
2545
|
return !!n;
|
|
2566
2546
|
}
|
|
2567
2547
|
function Ee(n) {
|
|
2568
2548
|
n.status !== "running" && (n.status = "running", n.summary = void 0);
|
|
2569
2549
|
}
|
|
2570
|
-
function
|
|
2550
|
+
function gn(n) {
|
|
2571
2551
|
const t = [], e = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = (i) => (e.has(i) || (t.push(i), e.set(i, { status: "running" }), s.set(i, /* @__PURE__ */ new Map())), e.get(i));
|
|
2572
2552
|
for (const i of n)
|
|
2573
2553
|
switch (i.kind) {
|
|
@@ -2608,21 +2588,21 @@ function Cn(n) {
|
|
|
2608
2588
|
tools: Array.from(s.get(i).values())
|
|
2609
2589
|
}));
|
|
2610
2590
|
}
|
|
2611
|
-
function
|
|
2591
|
+
function bn(n) {
|
|
2612
2592
|
return typeof n == "string" ? n : void 0;
|
|
2613
2593
|
}
|
|
2614
|
-
function
|
|
2594
|
+
function vn(n) {
|
|
2615
2595
|
const t = [];
|
|
2616
2596
|
for (const e of n) {
|
|
2617
|
-
if (e.type === "tool-call" &&
|
|
2597
|
+
if (e.type === "tool-call" && pn(e)) {
|
|
2618
2598
|
t.push({
|
|
2619
2599
|
kind: "agentStart",
|
|
2620
2600
|
toolUseId: e.toolUseId ?? e.messageId,
|
|
2621
|
-
description:
|
|
2601
|
+
description: bn(e.parameter.description)
|
|
2622
2602
|
});
|
|
2623
2603
|
continue;
|
|
2624
2604
|
}
|
|
2625
|
-
if (e.type === "tool-call" &&
|
|
2605
|
+
if (e.type === "tool-call" && mn(e.parentToolUseId)) {
|
|
2626
2606
|
const s = e.toolUseId ?? e.messageId;
|
|
2627
2607
|
t.push({
|
|
2628
2608
|
kind: "toolStart",
|
|
@@ -2659,37 +2639,37 @@ function An(n) {
|
|
|
2659
2639
|
}
|
|
2660
2640
|
return t;
|
|
2661
2641
|
}
|
|
2662
|
-
function
|
|
2642
|
+
function Sn(n) {
|
|
2663
2643
|
const t = Array.from(n.messages?.values() ?? []).filter(
|
|
2664
|
-
(e) => e.type === "tool-call" && e.isComplete &&
|
|
2644
|
+
(e) => e.type === "tool-call" && e.isComplete && hn(e)
|
|
2665
2645
|
);
|
|
2666
|
-
return
|
|
2646
|
+
return fn(t);
|
|
2667
2647
|
}
|
|
2668
|
-
function
|
|
2669
|
-
return
|
|
2648
|
+
function yn(n) {
|
|
2649
|
+
return gn(vn(Array.from(n.messages?.values() ?? [])));
|
|
2670
2650
|
}
|
|
2671
|
-
function
|
|
2651
|
+
function wn(n, t) {
|
|
2672
2652
|
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2673
2653
|
const r = t[s];
|
|
2674
2654
|
return e.id === r.id && e.status === r.status && e.subject === r.subject && e.activeForm === r.activeForm && e.description === r.description;
|
|
2675
2655
|
});
|
|
2676
2656
|
}
|
|
2677
|
-
function
|
|
2657
|
+
function En(n, t) {
|
|
2678
2658
|
return n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2679
2659
|
const r = t[s];
|
|
2680
2660
|
return e.toolName === r.toolName && e.toolsetName === r.toolsetName && e.status === r.status && e.reason === r.reason;
|
|
2681
2661
|
});
|
|
2682
2662
|
}
|
|
2683
|
-
function
|
|
2663
|
+
function In(n, t) {
|
|
2684
2664
|
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2685
2665
|
const r = t[s];
|
|
2686
|
-
return e.parentToolUseId === r.parentToolUseId && e.status === r.status && e.subagentType === r.subagentType && e.description === r.description && e.summary === r.summary &&
|
|
2666
|
+
return e.parentToolUseId === r.parentToolUseId && e.status === r.status && e.subagentType === r.subagentType && e.description === r.description && e.summary === r.summary && En(e.tools, r.tools);
|
|
2687
2667
|
});
|
|
2688
2668
|
}
|
|
2689
|
-
function
|
|
2690
|
-
const t = new
|
|
2691
|
-
return s.add(n.pipe(
|
|
2692
|
-
n.pipe(
|
|
2669
|
+
function Tn(n) {
|
|
2670
|
+
const t = new A([]), e = new A([]), s = new N();
|
|
2671
|
+
return s.add(n.pipe(Y(Sn), M(wn)).subscribe(t)), s.add(
|
|
2672
|
+
n.pipe(Y(yn), M(In)).subscribe(e)
|
|
2693
2673
|
), {
|
|
2694
2674
|
tasks$: t.asObservable(),
|
|
2695
2675
|
subagents$: e.asObservable(),
|
|
@@ -2705,11 +2685,11 @@ function Ie(n) {
|
|
|
2705
2685
|
(e, s) => (e.sandboxBlueprintName || e.sandboxName).localeCompare(s.sandboxBlueprintName || s.sandboxName)
|
|
2706
2686
|
);
|
|
2707
2687
|
}
|
|
2708
|
-
const
|
|
2709
|
-
function
|
|
2688
|
+
const ee = { kind: null, stopPhase: "idle" }, Cn = 1e4;
|
|
2689
|
+
function xn(n, t) {
|
|
2710
2690
|
return n.kind === t.kind && n.stopPhase === t.stopPhase && n.requestId === t.requestId;
|
|
2711
2691
|
}
|
|
2712
|
-
class
|
|
2692
|
+
class X {
|
|
2713
2693
|
client;
|
|
2714
2694
|
customChannelId;
|
|
2715
2695
|
customMessageId;
|
|
@@ -2769,9 +2749,9 @@ class K {
|
|
|
2769
2749
|
throw new Error("client must be required");
|
|
2770
2750
|
if (!t.customChannelId)
|
|
2771
2751
|
throw new Error("customChannelId must be required");
|
|
2772
|
-
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.joinRunState = t.runState ?? "IDLE", this.isConnecting$ = new
|
|
2752
|
+
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.joinRunState = t.runState ?? "IDLE", this.isConnecting$ = new A(!1), this.runStatusSubject = new A(ee), this.conversation$ = new A(t.conversation), this.channelTitleSubject = new A(t.channelTitle ?? null), this.promptSuggestionSubject = new A(null), this.sandboxPhaseSubject = new A("idle"), this.launchedSandboxesSubject = new A(
|
|
2773
2753
|
Ie(t.launchedSandboxes ?? [])
|
|
2774
|
-
), this.derivedStores =
|
|
2754
|
+
), this.derivedStores = Tn(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(M()), this.promptSuggestion$ = this.promptSuggestionSubject.pipe(M()), this.sandboxPhase$ = this.sandboxPhaseSubject.pipe(M()), this.launchedSandboxes$ = this.launchedSandboxesSubject.pipe(M()), this.runStatus$ = this.runStatusSubject.pipe(M(xn)), this.statesObserver = t.statesObserver;
|
|
2775
2755
|
}
|
|
2776
2756
|
/** Current Task Check List snapshot (F-013) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2777
2757
|
getTasks() {
|
|
@@ -2853,11 +2833,11 @@ class K {
|
|
|
2853
2833
|
this.channelTitleSubject.next(t);
|
|
2854
2834
|
}
|
|
2855
2835
|
static create(t) {
|
|
2856
|
-
const e = new
|
|
2836
|
+
const e = new X(t);
|
|
2857
2837
|
return e.subscribe(), e;
|
|
2858
2838
|
}
|
|
2859
2839
|
static async reset(t, e, s, r) {
|
|
2860
|
-
const i = new
|
|
2840
|
+
const i = new X(t);
|
|
2861
2841
|
try {
|
|
2862
2842
|
return i.subscribe(), r?.(i), await i.resetChannel(e, s), i;
|
|
2863
2843
|
} catch (o) {
|
|
@@ -2872,7 +2852,7 @@ class K {
|
|
|
2872
2852
|
* "join an existing channel and wipe its history" data-loss bug.
|
|
2873
2853
|
*/
|
|
2874
2854
|
static async restore(t, e, s) {
|
|
2875
|
-
const r = new
|
|
2855
|
+
const r = new X(t);
|
|
2876
2856
|
try {
|
|
2877
2857
|
return r.subscribe(), s?.(r), await r.rejoinChannel(e), r;
|
|
2878
2858
|
} catch (i) {
|
|
@@ -2880,7 +2860,7 @@ class K {
|
|
|
2880
2860
|
}
|
|
2881
2861
|
}
|
|
2882
2862
|
subscribe() {
|
|
2883
|
-
this.statesSubscription =
|
|
2863
|
+
this.statesSubscription = Wt([
|
|
2884
2864
|
this.isConnecting$,
|
|
2885
2865
|
this.conversation$,
|
|
2886
2866
|
this.derivedStores.tasks$,
|
|
@@ -2891,7 +2871,7 @@ class K {
|
|
|
2891
2871
|
this.launchedSandboxes$,
|
|
2892
2872
|
this.runStatus$
|
|
2893
2873
|
]).pipe(
|
|
2894
|
-
|
|
2874
|
+
Y(
|
|
2895
2875
|
([
|
|
2896
2876
|
t,
|
|
2897
2877
|
e,
|
|
@@ -2900,8 +2880,8 @@ class K {
|
|
|
2900
2880
|
i,
|
|
2901
2881
|
o,
|
|
2902
2882
|
a,
|
|
2903
|
-
|
|
2904
|
-
|
|
2883
|
+
u,
|
|
2884
|
+
c
|
|
2905
2885
|
]) => ({
|
|
2906
2886
|
isConnecting: t,
|
|
2907
2887
|
conversation: e,
|
|
@@ -2910,8 +2890,8 @@ class K {
|
|
|
2910
2890
|
channelTitle: i,
|
|
2911
2891
|
promptSuggestion: o,
|
|
2912
2892
|
sandboxPhase: a,
|
|
2913
|
-
launchedSandboxes:
|
|
2914
|
-
runStatus:
|
|
2893
|
+
launchedSandboxes: u,
|
|
2894
|
+
runStatus: c
|
|
2915
2895
|
})
|
|
2916
2896
|
)
|
|
2917
2897
|
).subscribe(this.statesObserver);
|
|
@@ -2937,14 +2917,14 @@ class K {
|
|
|
2937
2917
|
*/
|
|
2938
2918
|
updateSandboxPhase(t) {
|
|
2939
2919
|
switch (t) {
|
|
2940
|
-
case
|
|
2920
|
+
case d.SANDBOX_LAUNCH:
|
|
2941
2921
|
this.sandboxPhaseSubject.next("launching");
|
|
2942
2922
|
break;
|
|
2943
|
-
case
|
|
2923
|
+
case d.SANDBOX_READY:
|
|
2944
2924
|
this.sandboxPhaseSubject.next("ready");
|
|
2945
2925
|
break;
|
|
2946
|
-
case
|
|
2947
|
-
case
|
|
2926
|
+
case d.INIT:
|
|
2927
|
+
case d.ERROR:
|
|
2948
2928
|
this.sandboxPhaseSubject.next("idle");
|
|
2949
2929
|
break;
|
|
2950
2930
|
}
|
|
@@ -2958,11 +2938,11 @@ class K {
|
|
|
2958
2938
|
return {
|
|
2959
2939
|
onSseStart: t?.onSseStart,
|
|
2960
2940
|
onSseMessage: (r) => {
|
|
2961
|
-
if (t?.onSseMessage?.(r), this.captureRequestId(r.requestId), r.eventType ===
|
|
2941
|
+
if (t?.onSseMessage?.(r), this.captureRequestId(r.requestId), r.eventType === d.CHANNEL_TITLE_UPDATE && this.channelTitleSubject.next(
|
|
2962
2942
|
r.fact.channelTitleUpdate.title
|
|
2963
|
-
), r.eventType ===
|
|
2943
|
+
), r.eventType === d.PROMPT_SUGGESTION ? this.promptSuggestionSubject.next(
|
|
2964
2944
|
r.fact.promptSuggestion.suggestion
|
|
2965
|
-
) : r.eventType ===
|
|
2945
|
+
) : r.eventType === d.INIT && this.clearPromptSuggestion(), this.updateSandboxPhase(r.eventType), r.eventType === d.SANDBOX_LAUNCH && this.noteSandboxLaunch(r.fact.sandboxLaunch.sandboxName), this.currentUserMessageId && r.traceId) {
|
|
2966
2946
|
const i = new Map(this.conversation$.value.messages), o = i.get(this.currentUserMessageId);
|
|
2967
2947
|
o && o.type === "user" && (i.set(this.currentUserMessageId, {
|
|
2968
2948
|
...o,
|
|
@@ -2988,7 +2968,7 @@ class K {
|
|
|
2988
2968
|
*/
|
|
2989
2969
|
settleRun() {
|
|
2990
2970
|
const t = this.runStatusSubject.value.stopPhase !== "idle";
|
|
2991
|
-
this.clearForceStopTimer(), this.isConnecting$.next(!1), this.runStatusSubject.next(
|
|
2971
|
+
this.clearForceStopTimer(), this.isConnecting$.next(!1), this.runStatusSubject.next(ee), this.currentUserMessageId = void 0, this.currentRun = void 0, t && this.conversation$.next(this.conversation$.value.settleInFlightMessages());
|
|
2992
2972
|
}
|
|
2993
2973
|
/** Record the backend run id from the first frame that carries one; later frames must not overwrite it. */
|
|
2994
2974
|
captureRequestId(t) {
|
|
@@ -3025,7 +3005,7 @@ class K {
|
|
|
3025
3005
|
return this.fetchSse(
|
|
3026
3006
|
"reset",
|
|
3027
3007
|
{
|
|
3028
|
-
action:
|
|
3008
|
+
action: G.RESET_CHANNEL,
|
|
3029
3009
|
customChannelId: this.customChannelId,
|
|
3030
3010
|
customMessageId: this.customMessageId,
|
|
3031
3011
|
text: t?.text || "",
|
|
@@ -3036,11 +3016,11 @@ class K {
|
|
|
3036
3016
|
}
|
|
3037
3017
|
sendMessage(t, e) {
|
|
3038
3018
|
const s = this.runStatusSubject.value.kind;
|
|
3039
|
-
if (s) return Promise.reject(new
|
|
3019
|
+
if (s) return Promise.reject(new te(s));
|
|
3040
3020
|
const r = this.conversation$.value.pendingConsent;
|
|
3041
|
-
if (r) return Promise.reject(new
|
|
3021
|
+
if (r) return Promise.reject(new ne(r.processId));
|
|
3042
3022
|
this.clearPromptSuggestion();
|
|
3043
|
-
const i = t.text.trim(), o = t.customMessageId ??
|
|
3023
|
+
const i = t.text.trim(), o = t.customMessageId ?? Xe();
|
|
3044
3024
|
return this.currentUserMessageId = o, this.lastSentMessageId = o, this.conversation$.next(
|
|
3045
3025
|
this.conversation$.value.pushMessage({
|
|
3046
3026
|
type: "user",
|
|
@@ -3054,7 +3034,7 @@ class K {
|
|
|
3054
3034
|
), this.fetchSse(
|
|
3055
3035
|
"user",
|
|
3056
3036
|
{
|
|
3057
|
-
action:
|
|
3037
|
+
action: G.NONE,
|
|
3058
3038
|
customChannelId: this.customChannelId,
|
|
3059
3039
|
customMessageId: o,
|
|
3060
3040
|
payload: this.resolvePayload(t?.payload),
|
|
@@ -3069,7 +3049,7 @@ class K {
|
|
|
3069
3049
|
return this.conversation$.next(this.conversation$.value.clearPendingConsent()), this.fetchSse(
|
|
3070
3050
|
"user",
|
|
3071
3051
|
{
|
|
3072
|
-
action:
|
|
3052
|
+
action: G.RESPONSE_TOOL_CALL_CONSENT,
|
|
3073
3053
|
customChannelId: this.customChannelId,
|
|
3074
3054
|
customMessageId: this.lastSentMessageId ?? this.customMessageId,
|
|
3075
3055
|
payload: this.resolvePayload(s),
|
|
@@ -3103,12 +3083,12 @@ class K {
|
|
|
3103
3083
|
*/
|
|
3104
3084
|
nudge(t, e) {
|
|
3105
3085
|
const s = this.runStatusSubject.value.kind;
|
|
3106
|
-
if (s) return Promise.reject(new
|
|
3086
|
+
if (s) return Promise.reject(new te(s));
|
|
3107
3087
|
const r = this.conversation$.value.pendingConsent;
|
|
3108
|
-
return r ? Promise.reject(new
|
|
3088
|
+
return r ? Promise.reject(new ne(r.processId)) : this.fetchSse(
|
|
3109
3089
|
"nudge",
|
|
3110
3090
|
{
|
|
3111
|
-
action:
|
|
3091
|
+
action: G.NUDGE,
|
|
3112
3092
|
customChannelId: this.customChannelId,
|
|
3113
3093
|
customMessageId: this.lastSentMessageId ?? this.customMessageId,
|
|
3114
3094
|
payload: this.resolvePayload(e),
|
|
@@ -3174,7 +3154,7 @@ class K {
|
|
|
3174
3154
|
this.forceStopTimer = void 0;
|
|
3175
3155
|
const t = this.runStatusSubject.value;
|
|
3176
3156
|
t.stopPhase === "stopping" && this.runStatusSubject.next({ ...t, stopPhase: "force-stoppable" });
|
|
3177
|
-
},
|
|
3157
|
+
}, Cn);
|
|
3178
3158
|
}
|
|
3179
3159
|
/**
|
|
3180
3160
|
* Cut the local SSE connection without telling the backend. This is *not* stop-generation (see
|
|
@@ -3185,13 +3165,13 @@ class K {
|
|
|
3185
3165
|
* stream disposed so no reconnect is attempted (F-023 AC10).
|
|
3186
3166
|
*/
|
|
3187
3167
|
abortConnection() {
|
|
3188
|
-
this.currentRun && (this.currentRun.unsubscribe(), this.clearForceStopTimer(), this.currentRun = void 0, this.isConnecting$.next(!1), this.runStatusSubject.next(
|
|
3168
|
+
this.currentRun && (this.currentRun.unsubscribe(), this.clearForceStopTimer(), this.currentRun = void 0, this.isConnecting$.next(!1), this.runStatusSubject.next(ee), this.currentUserMessageId = void 0, this.conversation$.next(this.conversation$.value.settleInFlightMessages()));
|
|
3189
3169
|
}
|
|
3190
3170
|
close() {
|
|
3191
3171
|
this.currentRun?.unsubscribe(), this.currentRun = void 0, this.clearForceStopTimer(), this.isConnecting$.complete(), this.runStatusSubject.complete(), this.conversation$.complete(), this.channelTitleSubject.complete(), this.sandboxPhaseSubject.complete(), this.launchedSandboxesSubject.complete(), this.derivedStores.teardown(), this.statesSubscription?.unsubscribe();
|
|
3192
3172
|
}
|
|
3193
3173
|
}
|
|
3194
|
-
function
|
|
3174
|
+
function Mn(n) {
|
|
3195
3175
|
const t = /^sandbox:\/\/([^/]+)\/([^?#]+)(?:\?([^#]*))?/.exec(n.trim());
|
|
3196
3176
|
if (!t) return null;
|
|
3197
3177
|
const e = decodeURIComponent(t[1]), s = t[2], r = new URLSearchParams(t[3] ?? "");
|
|
@@ -3203,36 +3183,36 @@ function Fn(n) {
|
|
|
3203
3183
|
return null;
|
|
3204
3184
|
}
|
|
3205
3185
|
export {
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3186
|
+
_n as AsgardServiceClient,
|
|
3187
|
+
Ln as AsgardSourceSetClient,
|
|
3188
|
+
X as Channel,
|
|
3189
|
+
ne as ChannelAwaitingConsentError,
|
|
3190
|
+
te as ChannelBusyError,
|
|
3211
3191
|
g as Conversation,
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3192
|
+
d as EventType,
|
|
3193
|
+
G as FetchSseAction,
|
|
3194
|
+
I as HttpError,
|
|
3215
3195
|
Te as MessageTemplateType,
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3196
|
+
rn as SOURCE_SET_DEFAULT_MAX_ENTRIES,
|
|
3197
|
+
We as SOURCE_SET_MAX_PAGE_SIZE,
|
|
3198
|
+
nn as SOURCE_SET_VOLUME_ROOT,
|
|
3199
|
+
Ye as ToolCallConsentResult,
|
|
3200
|
+
C as assertVolumePath,
|
|
3201
|
+
vn as conversationToSubagentEvents,
|
|
3202
|
+
Tn as createDerivedStores,
|
|
3203
|
+
yn as deriveSubagents,
|
|
3204
|
+
Sn as deriveTasks,
|
|
3205
|
+
pn as isAgentTool,
|
|
3206
|
+
Pn as isChannelAwaitingConsentError,
|
|
3207
|
+
On as isChannelBusyError,
|
|
3208
|
+
An as isHttpError,
|
|
3209
|
+
mn as isSubagentChildTool,
|
|
3210
|
+
hn as isTaskTool,
|
|
3231
3211
|
Ie as reconcileLaunched,
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3212
|
+
gn as reduceSubagents,
|
|
3213
|
+
fn as reduceTaskEvents,
|
|
3214
|
+
Mn as resolveSandboxUri,
|
|
3215
|
+
In as subagentsEqual,
|
|
3216
|
+
wn as tasksEqual
|
|
3237
3217
|
};
|
|
3238
3218
|
//# sourceMappingURL=index.mjs.map
|