@asgard-js/core 0.3.65 → 0.3.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -0
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +887 -736
- package/dist/index.mjs.map +1 -1
- package/dist/lib/source-set-client.d.ts +53 -0
- package/dist/lib/source-set-client.d.ts.map +1 -0
- package/dist/lib/source-set-client.spec.d.ts +2 -0
- package/dist/lib/source-set-client.spec.d.ts.map +1 -0
- package/dist/lib/source-set-path.d.ts +13 -0
- package/dist/lib/source-set-path.d.ts.map +1 -0
- package/dist/lib/source-set-path.spec.d.ts +2 -0
- package/dist/lib/source-set-path.spec.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/source-set-fs.d.ts +130 -0
- package/dist/types/source-set-fs.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -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
|
|
19
|
+
function kn(n) {
|
|
20
20
|
return n instanceof w;
|
|
21
21
|
}
|
|
22
|
-
class
|
|
22
|
+
class ee 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 jn(n) {
|
|
30
|
+
return n instanceof ee;
|
|
31
31
|
}
|
|
32
|
-
class
|
|
32
|
+
class te extends Error {
|
|
33
33
|
/**
|
|
34
34
|
* The paused batch's process id, as carried by the pending consent prompt.
|
|
35
35
|
*
|
|
@@ -43,20 +43,20 @@ class ee 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 $n(n) {
|
|
47
|
+
return n instanceof te;
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
async function
|
|
49
|
+
var D = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n.NUDGE = "NUDGE", n))(D || {}), l = /* @__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))(l || {}), Qe = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(Qe || {}), 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 et(n) {
|
|
57
57
|
let t, e, s, r = !1;
|
|
58
|
-
return function(
|
|
59
|
-
t === void 0 ? (t =
|
|
58
|
+
return function(o) {
|
|
59
|
+
t === void 0 ? (t = o, e = 0, s = -1) : t = nt(t, o);
|
|
60
60
|
const a = t.length;
|
|
61
61
|
let c = 0;
|
|
62
62
|
for (; e < a; ) {
|
|
@@ -80,38 +80,38 @@ function Je(n) {
|
|
|
80
80
|
c === a ? t = void 0 : c !== 0 && (t = t.subarray(c), e -= c);
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
let s =
|
|
83
|
+
function tt(n, t, e) {
|
|
84
|
+
let s = le();
|
|
85
85
|
const r = new TextDecoder();
|
|
86
|
-
return function(
|
|
87
|
-
if (
|
|
88
|
-
e?.(s), s =
|
|
86
|
+
return function(o, a) {
|
|
87
|
+
if (o.length === 0)
|
|
88
|
+
e?.(s), s = le();
|
|
89
89
|
else if (a > 0) {
|
|
90
|
-
const c = r.decode(
|
|
90
|
+
const c = r.decode(o.subarray(0, a)), u = a + (o[a + 1] === 32 ? 2 : 1), d = r.decode(o.subarray(u));
|
|
91
91
|
switch (c) {
|
|
92
92
|
case "data":
|
|
93
93
|
s.data = s.data ? s.data + `
|
|
94
|
-
` +
|
|
94
|
+
` + d : d;
|
|
95
95
|
break;
|
|
96
96
|
case "event":
|
|
97
|
-
s.event =
|
|
97
|
+
s.event = d;
|
|
98
98
|
break;
|
|
99
99
|
case "id":
|
|
100
|
-
n(s.id =
|
|
100
|
+
n(s.id = d);
|
|
101
101
|
break;
|
|
102
102
|
case "retry":
|
|
103
|
-
const m = parseInt(
|
|
103
|
+
const m = parseInt(d, 10);
|
|
104
104
|
isNaN(m) || t(s.retry = m);
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function nt(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
|
}
|
|
114
|
-
function
|
|
114
|
+
function le() {
|
|
115
115
|
return {
|
|
116
116
|
data: "",
|
|
117
117
|
event: "",
|
|
@@ -119,7 +119,7 @@ function ue() {
|
|
|
119
119
|
retry: void 0
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
var
|
|
122
|
+
var st = 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,117 +127,117 @@ var et = 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
|
|
131
|
-
function
|
|
132
|
-
var { signal: e, headers: s, onopen: r, onmessage:
|
|
130
|
+
const ne = "text/event-stream", rt = 1e3, de = "last-event-id";
|
|
131
|
+
function Ce(n, t) {
|
|
132
|
+
var { signal: e, headers: s, onopen: r, onmessage: i, onclose: o, onerror: a, openWhenHidden: c, fetch: u } = t, d = st(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
133
133
|
return new Promise((m, v) => {
|
|
134
|
-
const
|
|
135
|
-
|
|
134
|
+
const h = Object.assign({}, s);
|
|
135
|
+
h.accept || (h.accept = ne);
|
|
136
136
|
let p;
|
|
137
137
|
function f() {
|
|
138
|
-
p.abort(), document.hidden ||
|
|
138
|
+
p.abort(), document.hidden || Y();
|
|
139
139
|
}
|
|
140
140
|
c || document.addEventListener("visibilitychange", f);
|
|
141
|
-
let
|
|
141
|
+
let M = rt, E = 0;
|
|
142
142
|
function L() {
|
|
143
|
-
document.removeEventListener("visibilitychange", f), window.clearTimeout(
|
|
143
|
+
document.removeEventListener("visibilitychange", f), window.clearTimeout(E), p.abort();
|
|
144
144
|
}
|
|
145
145
|
e?.addEventListener("abort", () => {
|
|
146
146
|
L(), m();
|
|
147
147
|
});
|
|
148
|
-
const
|
|
149
|
-
async function
|
|
150
|
-
var
|
|
148
|
+
const ze = u ?? window.fetch, Je = r ?? it;
|
|
149
|
+
async function Y() {
|
|
150
|
+
var z;
|
|
151
151
|
p = new AbortController();
|
|
152
152
|
try {
|
|
153
|
-
const
|
|
154
|
-
await
|
|
155
|
-
|
|
156
|
-
}, (
|
|
157
|
-
|
|
158
|
-
},
|
|
159
|
-
} catch (
|
|
153
|
+
const G = await ze(n, Object.assign(Object.assign({}, d), { headers: h, signal: p.signal }));
|
|
154
|
+
await Je(G), await Ze(G.body, et(tt((A) => {
|
|
155
|
+
A ? h[de] = A : delete h[de];
|
|
156
|
+
}, (A) => {
|
|
157
|
+
M = A;
|
|
158
|
+
}, i))), o?.(), L(), m();
|
|
159
|
+
} catch (G) {
|
|
160
160
|
if (!p.signal.aborted)
|
|
161
161
|
try {
|
|
162
|
-
const
|
|
163
|
-
window.clearTimeout(
|
|
164
|
-
} catch (
|
|
165
|
-
L(), v(
|
|
162
|
+
const A = (z = a?.(G)) !== null && z !== void 0 ? z : M;
|
|
163
|
+
window.clearTimeout(E), E = window.setTimeout(Y, A);
|
|
164
|
+
} catch (A) {
|
|
165
|
+
L(), v(A);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
Y();
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function it(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(ne))
|
|
175
|
+
throw new Error(`Expected content-type to be ${ne}, Actual: ${t}`);
|
|
176
176
|
}
|
|
177
|
-
var
|
|
178
|
-
return
|
|
177
|
+
var se = function(n, t) {
|
|
178
|
+
return se = 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
|
+
}, se(n, t);
|
|
183
183
|
};
|
|
184
|
-
function
|
|
184
|
+
function x(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
|
+
se(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
|
|
194
|
-
function r(
|
|
195
|
-
return
|
|
196
|
-
i
|
|
193
|
+
function ot(n, t, e, s) {
|
|
194
|
+
function r(i) {
|
|
195
|
+
return i instanceof e ? i : new e(function(o) {
|
|
196
|
+
o(i);
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
return new (e || (e = Promise))(function(
|
|
200
|
-
function a(
|
|
199
|
+
return new (e || (e = Promise))(function(i, o) {
|
|
200
|
+
function a(d) {
|
|
201
201
|
try {
|
|
202
|
-
u(s.next(
|
|
202
|
+
u(s.next(d));
|
|
203
203
|
} catch (m) {
|
|
204
|
-
|
|
204
|
+
o(m);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function c(
|
|
207
|
+
function c(d) {
|
|
208
208
|
try {
|
|
209
|
-
u(s.throw(
|
|
209
|
+
u(s.throw(d));
|
|
210
210
|
} catch (m) {
|
|
211
|
-
|
|
211
|
+
o(m);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
function u(
|
|
215
|
-
|
|
214
|
+
function u(d) {
|
|
215
|
+
d.done ? i(d.value) : r(d.value).then(a, c);
|
|
216
216
|
}
|
|
217
217
|
u((s = s.apply(n, t || [])).next());
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function xe(n, t) {
|
|
221
221
|
var e = { label: 0, sent: function() {
|
|
222
|
-
if (
|
|
223
|
-
return
|
|
224
|
-
}, trys: [], ops: [] }, s, r,
|
|
225
|
-
return
|
|
222
|
+
if (i[0] & 1) throw i[1];
|
|
223
|
+
return i[1];
|
|
224
|
+
}, trys: [], ops: [] }, s, r, i, o = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
|
|
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
228
|
function a(u) {
|
|
229
|
-
return function(
|
|
230
|
-
return c([u,
|
|
229
|
+
return function(d) {
|
|
230
|
+
return c([u, d]);
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
function c(u) {
|
|
234
234
|
if (s) throw new TypeError("Generator is already executing.");
|
|
235
|
-
for (;
|
|
236
|
-
if (s = 1, r && (
|
|
237
|
-
switch (r = 0,
|
|
235
|
+
for (; o && (o = 0, u[0] && (e = 0)), e; ) try {
|
|
236
|
+
if (s = 1, r && (i = u[0] & 2 ? r.return : u[0] ? r.throw || ((i = r.return) && i.call(r), 0) : r.next) && !(i = i.call(r, u[1])).done) return i;
|
|
237
|
+
switch (r = 0, i && (u = [u[0] & 2, i.value]), u[0]) {
|
|
238
238
|
case 0:
|
|
239
239
|
case 1:
|
|
240
|
-
|
|
240
|
+
i = u;
|
|
241
241
|
break;
|
|
242
242
|
case 4:
|
|
243
243
|
return e.label++, { value: u[1], done: !1 };
|
|
@@ -248,30 +248,30 @@ function Te(n, t) {
|
|
|
248
248
|
u = e.ops.pop(), e.trys.pop();
|
|
249
249
|
continue;
|
|
250
250
|
default:
|
|
251
|
-
if (
|
|
251
|
+
if (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (u[0] === 6 || u[0] === 2)) {
|
|
252
252
|
e = 0;
|
|
253
253
|
continue;
|
|
254
254
|
}
|
|
255
|
-
if (u[0] === 3 && (!
|
|
255
|
+
if (u[0] === 3 && (!i || u[1] > i[0] && u[1] < i[3])) {
|
|
256
256
|
e.label = u[1];
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
259
|
-
if (u[0] === 6 && e.label <
|
|
260
|
-
e.label =
|
|
259
|
+
if (u[0] === 6 && e.label < i[1]) {
|
|
260
|
+
e.label = i[1], i = u;
|
|
261
261
|
break;
|
|
262
262
|
}
|
|
263
|
-
if (
|
|
264
|
-
e.label =
|
|
263
|
+
if (i && e.label < i[2]) {
|
|
264
|
+
e.label = i[2], e.ops.push(u);
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
|
-
|
|
267
|
+
i[2] && e.ops.pop(), e.trys.pop();
|
|
268
268
|
continue;
|
|
269
269
|
}
|
|
270
270
|
u = t.call(n, e);
|
|
271
|
-
} catch (
|
|
272
|
-
u = [6,
|
|
271
|
+
} catch (d) {
|
|
272
|
+
u = [6, d], r = 0;
|
|
273
273
|
} finally {
|
|
274
|
-
s =
|
|
274
|
+
s = i = 0;
|
|
275
275
|
}
|
|
276
276
|
if (u[0] & 5) throw u[1];
|
|
277
277
|
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
@@ -287,98 +287,98 @@ 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 H(n, t) {
|
|
291
291
|
var e = typeof Symbol == "function" && n[Symbol.iterator];
|
|
292
292
|
if (!e) return n;
|
|
293
|
-
var s = e.call(n), r,
|
|
293
|
+
var s = e.call(n), r, i = [], o;
|
|
294
294
|
try {
|
|
295
|
-
for (; (t === void 0 || t-- > 0) && !(r = s.next()).done; )
|
|
295
|
+
for (; (t === void 0 || t-- > 0) && !(r = s.next()).done; ) i.push(r.value);
|
|
296
296
|
} catch (a) {
|
|
297
|
-
|
|
297
|
+
o = { error: a };
|
|
298
298
|
} finally {
|
|
299
299
|
try {
|
|
300
300
|
r && !r.done && (e = s.return) && e.call(s);
|
|
301
301
|
} finally {
|
|
302
|
-
if (
|
|
302
|
+
if (o) throw o.error;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
return
|
|
305
|
+
return i;
|
|
306
306
|
}
|
|
307
307
|
function F(n, t, e) {
|
|
308
|
-
if (e || arguments.length === 2) for (var s = 0, r = t.length,
|
|
309
|
-
(
|
|
310
|
-
return n.concat(
|
|
308
|
+
if (e || arguments.length === 2) for (var s = 0, r = t.length, i; s < r; s++)
|
|
309
|
+
(i || !(s in t)) && (i || (i = Array.prototype.slice.call(t, 0, s)), i[s] = t[s]);
|
|
310
|
+
return n.concat(i || Array.prototype.slice.call(t));
|
|
311
311
|
}
|
|
312
|
-
function
|
|
313
|
-
return this instanceof
|
|
312
|
+
function R(n) {
|
|
313
|
+
return this instanceof R ? (this.v = n, this) : new R(n);
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function at(n, t, e) {
|
|
316
316
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
317
|
-
var s = e.apply(n, t || []), r,
|
|
318
|
-
return r = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return",
|
|
317
|
+
var s = e.apply(n, t || []), r, i = [];
|
|
318
|
+
return r = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", o), r[Symbol.asyncIterator] = function() {
|
|
319
319
|
return this;
|
|
320
320
|
}, r;
|
|
321
|
-
function
|
|
321
|
+
function o(h) {
|
|
322
322
|
return function(p) {
|
|
323
|
-
return Promise.resolve(p).then(
|
|
323
|
+
return Promise.resolve(p).then(h, m);
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
|
-
function a(
|
|
327
|
-
s[
|
|
328
|
-
return new Promise(function(
|
|
329
|
-
|
|
326
|
+
function a(h, p) {
|
|
327
|
+
s[h] && (r[h] = function(f) {
|
|
328
|
+
return new Promise(function(M, E) {
|
|
329
|
+
i.push([h, f, M, E]) > 1 || c(h, f);
|
|
330
330
|
});
|
|
331
|
-
}, p && (r[
|
|
331
|
+
}, p && (r[h] = p(r[h])));
|
|
332
332
|
}
|
|
333
|
-
function c(
|
|
333
|
+
function c(h, p) {
|
|
334
334
|
try {
|
|
335
|
-
u(s[
|
|
335
|
+
u(s[h](p));
|
|
336
336
|
} catch (f) {
|
|
337
|
-
v(
|
|
337
|
+
v(i[0][3], f);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
function u(
|
|
341
|
-
|
|
340
|
+
function u(h) {
|
|
341
|
+
h.value instanceof R ? Promise.resolve(h.value.v).then(d, m) : v(i[0][2], h);
|
|
342
342
|
}
|
|
343
|
-
function h
|
|
344
|
-
c("next",
|
|
343
|
+
function d(h) {
|
|
344
|
+
c("next", h);
|
|
345
345
|
}
|
|
346
|
-
function m(
|
|
347
|
-
c("throw",
|
|
346
|
+
function m(h) {
|
|
347
|
+
c("throw", h);
|
|
348
348
|
}
|
|
349
|
-
function v(
|
|
350
|
-
|
|
349
|
+
function v(h, p) {
|
|
350
|
+
h(p), i.shift(), i.length && c(i[0][0], i[0][1]);
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function ct(n) {
|
|
354
354
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
355
355
|
var t = n[Symbol.asyncIterator], e;
|
|
356
356
|
return t ? t.call(n) : (n = typeof k == "function" ? k(n) : n[Symbol.iterator](), e = {}, s("next"), s("throw"), s("return"), e[Symbol.asyncIterator] = function() {
|
|
357
357
|
return this;
|
|
358
358
|
}, e);
|
|
359
|
-
function s(
|
|
360
|
-
e[
|
|
359
|
+
function s(i) {
|
|
360
|
+
e[i] = n[i] && function(o) {
|
|
361
361
|
return new Promise(function(a, c) {
|
|
362
|
-
|
|
362
|
+
o = n[i](o), r(a, c, o.done, o.value);
|
|
363
363
|
});
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
function r(
|
|
366
|
+
function r(i, o, a, c) {
|
|
367
367
|
Promise.resolve(c).then(function(u) {
|
|
368
|
-
|
|
369
|
-
},
|
|
368
|
+
i({ value: u, done: a });
|
|
369
|
+
}, o);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
function b(n) {
|
|
373
373
|
return typeof n == "function";
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function Ae(n) {
|
|
376
376
|
var t = function(s) {
|
|
377
377
|
Error.call(s), s.stack = new Error().stack;
|
|
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 J = 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,25 +387,25 @@ var z = Ce(function(n) {
|
|
|
387
387
|
`) : "", this.name = "UnsubscriptionError", this.errors = e;
|
|
388
388
|
};
|
|
389
389
|
});
|
|
390
|
-
function
|
|
390
|
+
function V(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 $ = (function() {
|
|
397
397
|
function n(t) {
|
|
398
398
|
this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
|
|
399
399
|
}
|
|
400
400
|
return n.prototype.unsubscribe = function() {
|
|
401
|
-
var t, e, s, r,
|
|
401
|
+
var t, e, s, r, i;
|
|
402
402
|
if (!this.closed) {
|
|
403
403
|
this.closed = !0;
|
|
404
|
-
var
|
|
405
|
-
if (
|
|
406
|
-
if (this._parentage = null, Array.isArray(
|
|
404
|
+
var o = this._parentage;
|
|
405
|
+
if (o)
|
|
406
|
+
if (this._parentage = null, Array.isArray(o))
|
|
407
407
|
try {
|
|
408
|
-
for (var a = k(
|
|
408
|
+
for (var a = k(o), c = a.next(); !c.done; c = a.next()) {
|
|
409
409
|
var u = c.value;
|
|
410
410
|
u.remove(this);
|
|
411
411
|
}
|
|
@@ -419,44 +419,44 @@ var j = (function() {
|
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
else
|
|
422
|
-
|
|
423
|
-
var
|
|
424
|
-
if (b(
|
|
422
|
+
o.remove(this);
|
|
423
|
+
var d = this.initialTeardown;
|
|
424
|
+
if (b(d))
|
|
425
425
|
try {
|
|
426
|
-
|
|
426
|
+
d();
|
|
427
427
|
} catch (f) {
|
|
428
|
-
|
|
428
|
+
i = f instanceof J ? 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 = k(m),
|
|
435
|
-
var p =
|
|
434
|
+
for (var v = k(m), h = v.next(); !h.done; h = v.next()) {
|
|
435
|
+
var p = h.value;
|
|
436
436
|
try {
|
|
437
|
-
|
|
437
|
+
he(p);
|
|
438
438
|
} catch (f) {
|
|
439
|
-
|
|
439
|
+
i = i ?? [], f instanceof J ? i = F(F([], H(i)), H(f.errors)) : i.push(f);
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
} catch (f) {
|
|
443
443
|
s = { error: f };
|
|
444
444
|
} finally {
|
|
445
445
|
try {
|
|
446
|
-
|
|
446
|
+
h && !h.done && (r = v.return) && r.call(v);
|
|
447
447
|
} finally {
|
|
448
448
|
if (s) throw s.error;
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
if (
|
|
453
|
-
throw new
|
|
452
|
+
if (i)
|
|
453
|
+
throw new J(i);
|
|
454
454
|
}
|
|
455
455
|
}, n.prototype.add = function(t) {
|
|
456
456
|
var e;
|
|
457
457
|
if (t && t !== this)
|
|
458
458
|
if (this.closed)
|
|
459
|
-
|
|
459
|
+
he(t);
|
|
460
460
|
else {
|
|
461
461
|
if (t instanceof n) {
|
|
462
462
|
if (t.closed || t._hasParent(this))
|
|
@@ -473,52 +473,52 @@ var j = (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) && V(e, t);
|
|
477
477
|
}, n.prototype.remove = function(t) {
|
|
478
478
|
var e = this._finalizers;
|
|
479
|
-
e &&
|
|
479
|
+
e && V(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
|
-
})(),
|
|
485
|
-
function
|
|
486
|
-
return n instanceof
|
|
484
|
+
})(), Oe = $.EMPTY;
|
|
485
|
+
function Pe(n) {
|
|
486
|
+
return n instanceof $ || n && "closed" in n && b(n.remove) && b(n.add) && b(n.unsubscribe);
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function he(n) {
|
|
489
489
|
b(n) ? n() : n.unsubscribe();
|
|
490
490
|
}
|
|
491
|
-
var
|
|
491
|
+
var ut = {
|
|
492
492
|
Promise: void 0
|
|
493
|
-
},
|
|
493
|
+
}, lt = {
|
|
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, F([n, t],
|
|
497
|
+
return setTimeout.apply(void 0, F([n, t], H(e)));
|
|
498
498
|
},
|
|
499
499
|
clearTimeout: function(n) {
|
|
500
500
|
return clearTimeout(n);
|
|
501
501
|
},
|
|
502
502
|
delegate: void 0
|
|
503
503
|
};
|
|
504
|
-
function
|
|
505
|
-
|
|
504
|
+
function _e(n) {
|
|
505
|
+
lt.setTimeout(function() {
|
|
506
506
|
throw n;
|
|
507
507
|
});
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function re() {
|
|
510
510
|
}
|
|
511
|
-
function
|
|
511
|
+
function q(n) {
|
|
512
512
|
n();
|
|
513
513
|
}
|
|
514
514
|
var oe = (function(n) {
|
|
515
|
-
|
|
515
|
+
x(t, n);
|
|
516
516
|
function t(e) {
|
|
517
517
|
var s = n.call(this) || this;
|
|
518
|
-
return s.isStopped = !1, e ? (s.destination = e,
|
|
518
|
+
return s.isStopped = !1, e ? (s.destination = e, Pe(e) && e.add(s)) : s.destination = ft, s;
|
|
519
519
|
}
|
|
520
520
|
return t.create = function(e, s, r) {
|
|
521
|
-
return new
|
|
521
|
+
return new ie(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
|
+
})($), dt = (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
|
+
B(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
|
+
B(s);
|
|
564
564
|
}
|
|
565
565
|
else
|
|
566
|
-
|
|
566
|
+
B(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
|
+
B(e);
|
|
574
574
|
}
|
|
575
575
|
}, n;
|
|
576
|
-
})(),
|
|
577
|
-
|
|
576
|
+
})(), ie = (function(n) {
|
|
577
|
+
x(t, n);
|
|
578
578
|
function t(e, s, r) {
|
|
579
|
-
var
|
|
580
|
-
return b(e) || !e ?
|
|
579
|
+
var i = n.call(this) || this, o;
|
|
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
|
-
} :
|
|
584
|
+
} : o = e, i.destination = new dt(o), i;
|
|
585
585
|
}
|
|
586
586
|
return t;
|
|
587
587
|
})(oe);
|
|
588
|
-
function
|
|
589
|
-
|
|
588
|
+
function B(n) {
|
|
589
|
+
_e(n);
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function ht(n) {
|
|
592
592
|
throw n;
|
|
593
593
|
}
|
|
594
|
-
var
|
|
594
|
+
var ft = {
|
|
595
595
|
closed: !0,
|
|
596
|
-
next:
|
|
597
|
-
error:
|
|
598
|
-
complete:
|
|
599
|
-
},
|
|
596
|
+
next: re,
|
|
597
|
+
error: ht,
|
|
598
|
+
complete: re
|
|
599
|
+
}, ae = (function() {
|
|
600
600
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
601
601
|
})();
|
|
602
|
-
function
|
|
602
|
+
function X(n) {
|
|
603
603
|
return n;
|
|
604
604
|
}
|
|
605
|
-
function
|
|
606
|
-
return n.length === 0 ?
|
|
605
|
+
function pt(n) {
|
|
606
|
+
return n.length === 0 ? X : n.length === 1 ? n[0] : function(e) {
|
|
607
607
|
return n.reduce(function(s, r) {
|
|
608
608
|
return r(s);
|
|
609
609
|
}, e);
|
|
@@ -617,11 +617,11 @@ 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,
|
|
621
|
-
return
|
|
622
|
-
var
|
|
623
|
-
|
|
624
|
-
}),
|
|
620
|
+
var r = this, i = gt(t) ? t : new ie(t, e, s);
|
|
621
|
+
return q(function() {
|
|
622
|
+
var o = r, a = o.operator, c = o.source;
|
|
623
|
+
i.add(a ? a.call(i, c) : c ? r._subscribe(i) : r._trySubscribe(i));
|
|
624
|
+
}), i;
|
|
625
625
|
}, n.prototype._trySubscribe = function(t) {
|
|
626
626
|
try {
|
|
627
627
|
return this._subscribe(t);
|
|
@@ -630,61 +630,61 @@ var y = (function() {
|
|
|
630
630
|
}
|
|
631
631
|
}, n.prototype.forEach = function(t, e) {
|
|
632
632
|
var s = this;
|
|
633
|
-
return e =
|
|
634
|
-
var
|
|
633
|
+
return e = fe(e), new e(function(r, i) {
|
|
634
|
+
var o = new ie({
|
|
635
635
|
next: function(a) {
|
|
636
636
|
try {
|
|
637
637
|
t(a);
|
|
638
638
|
} catch (c) {
|
|
639
|
-
|
|
639
|
+
i(c), o.unsubscribe();
|
|
640
640
|
}
|
|
641
641
|
},
|
|
642
|
-
error:
|
|
642
|
+
error: i,
|
|
643
643
|
complete: r
|
|
644
644
|
});
|
|
645
|
-
s.subscribe(
|
|
645
|
+
s.subscribe(o);
|
|
646
646
|
});
|
|
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[ae] = 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 pt(t)(this);
|
|
656
656
|
}, n.prototype.toPromise = function(t) {
|
|
657
657
|
var e = this;
|
|
658
|
-
return t =
|
|
659
|
-
var
|
|
660
|
-
e.subscribe(function(
|
|
661
|
-
return
|
|
662
|
-
}, function(
|
|
663
|
-
return r(
|
|
658
|
+
return t = fe(t), new t(function(s, r) {
|
|
659
|
+
var i;
|
|
660
|
+
e.subscribe(function(o) {
|
|
661
|
+
return i = o;
|
|
662
|
+
}, function(o) {
|
|
663
|
+
return r(o);
|
|
664
664
|
}, function() {
|
|
665
|
-
return s(
|
|
665
|
+
return s(i);
|
|
666
666
|
});
|
|
667
667
|
});
|
|
668
668
|
}, n.create = function(t) {
|
|
669
669
|
return new n(t);
|
|
670
670
|
}, n;
|
|
671
671
|
})();
|
|
672
|
-
function
|
|
672
|
+
function fe(n) {
|
|
673
673
|
var t;
|
|
674
|
-
return (t = n ??
|
|
674
|
+
return (t = n ?? ut.Promise) !== null && t !== void 0 ? t : Promise;
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function mt(n) {
|
|
677
677
|
return n && b(n.next) && b(n.error) && b(n.complete);
|
|
678
678
|
}
|
|
679
|
-
function
|
|
680
|
-
return n && n instanceof oe ||
|
|
679
|
+
function gt(n) {
|
|
680
|
+
return n && n instanceof oe || mt(n) && Pe(n);
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function bt(n) {
|
|
683
683
|
return b(n?.lift);
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function _(n) {
|
|
686
686
|
return function(t) {
|
|
687
|
-
if (
|
|
687
|
+
if (bt(t))
|
|
688
688
|
return t.lift(function(e) {
|
|
689
689
|
try {
|
|
690
690
|
return n(e, this);
|
|
@@ -695,24 +695,24 @@ function P(n) {
|
|
|
695
695
|
throw new TypeError("Unable to lift unknown Observable type");
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
|
-
function
|
|
699
|
-
return new
|
|
698
|
+
function P(n, t, e, s, r) {
|
|
699
|
+
return new vt(n, t, e, s, r);
|
|
700
700
|
}
|
|
701
|
-
var
|
|
702
|
-
|
|
703
|
-
function t(e, s, r,
|
|
701
|
+
var vt = (function(n) {
|
|
702
|
+
x(t, n);
|
|
703
|
+
function t(e, s, r, i, o, a) {
|
|
704
704
|
var c = n.call(this, e) || this;
|
|
705
|
-
return c.onFinalize =
|
|
705
|
+
return c.onFinalize = o, c.shouldUnsubscribe = a, c._next = s ? function(u) {
|
|
706
706
|
try {
|
|
707
707
|
s(u);
|
|
708
|
-
} catch (
|
|
709
|
-
e.error(
|
|
708
|
+
} catch (d) {
|
|
709
|
+
e.error(d);
|
|
710
710
|
}
|
|
711
|
-
} : n.prototype._next, c._error =
|
|
711
|
+
} : n.prototype._next, c._error = i ? function(u) {
|
|
712
712
|
try {
|
|
713
|
-
|
|
714
|
-
} catch (
|
|
715
|
-
e.error(
|
|
713
|
+
i(u);
|
|
714
|
+
} catch (d) {
|
|
715
|
+
e.error(d);
|
|
716
716
|
} finally {
|
|
717
717
|
this.unsubscribe();
|
|
718
718
|
}
|
|
@@ -733,30 +733,30 @@ var mt = (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
|
-
})(oe),
|
|
736
|
+
})(oe), St = Ae(function(n) {
|
|
737
737
|
return function() {
|
|
738
738
|
n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
739
739
|
};
|
|
740
|
-
}),
|
|
741
|
-
|
|
740
|
+
}), ce = (function(n) {
|
|
741
|
+
x(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;
|
|
745
745
|
}
|
|
746
746
|
return t.prototype.lift = function(e) {
|
|
747
|
-
var s = new
|
|
747
|
+
var s = new pe(this, this);
|
|
748
748
|
return s.operator = e, s;
|
|
749
749
|
}, t.prototype._throwIfClosed = function() {
|
|
750
750
|
if (this.closed)
|
|
751
|
-
throw new
|
|
751
|
+
throw new St();
|
|
752
752
|
}, t.prototype.next = function(e) {
|
|
753
753
|
var s = this;
|
|
754
|
-
|
|
755
|
-
var r,
|
|
754
|
+
q(function() {
|
|
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
|
|
759
|
+
for (var o = k(s.currentObservers), a = o.next(); !a.done; a = o.next()) {
|
|
760
760
|
var c = a.value;
|
|
761
761
|
c.next(e);
|
|
762
762
|
}
|
|
@@ -764,7 +764,7 @@ var mt = (function(n) {
|
|
|
764
764
|
r = { error: u };
|
|
765
765
|
} finally {
|
|
766
766
|
try {
|
|
767
|
-
a && !a.done && (
|
|
767
|
+
a && !a.done && (i = o.return) && i.call(o);
|
|
768
768
|
} finally {
|
|
769
769
|
if (r) throw r.error;
|
|
770
770
|
}
|
|
@@ -773,7 +773,7 @@ var mt = (function(n) {
|
|
|
773
773
|
});
|
|
774
774
|
}, t.prototype.error = function(e) {
|
|
775
775
|
var s = this;
|
|
776
|
-
|
|
776
|
+
q(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 mt = (function(n) {
|
|
|
782
782
|
});
|
|
783
783
|
}, t.prototype.complete = function() {
|
|
784
784
|
var e = this;
|
|
785
|
-
|
|
785
|
+
q(function() {
|
|
786
786
|
if (e._throwIfClosed(), !e.isStopped) {
|
|
787
787
|
e.isStopped = !0;
|
|
788
788
|
for (var s = e.observers; s.length; )
|
|
@@ -803,21 +803,21 @@ var mt = (function(n) {
|
|
|
803
803
|
}, t.prototype._subscribe = function(e) {
|
|
804
804
|
return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
|
|
805
805
|
}, t.prototype._innerSubscribe = function(e) {
|
|
806
|
-
var s = this, r = this,
|
|
807
|
-
return
|
|
808
|
-
s.currentObservers = null,
|
|
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 $(function() {
|
|
808
|
+
s.currentObservers = null, V(a, e);
|
|
809
809
|
}));
|
|
810
810
|
}, t.prototype._checkFinalizedStatuses = function(e) {
|
|
811
|
-
var s = this, r = s.hasError,
|
|
812
|
-
r ? e.error(
|
|
811
|
+
var s = this, r = s.hasError, i = s.thrownError, o = s.isStopped;
|
|
812
|
+
r ? e.error(i) : o && e.complete();
|
|
813
813
|
}, t.prototype.asObservable = function() {
|
|
814
814
|
var e = new y();
|
|
815
815
|
return e.source = this, e;
|
|
816
816
|
}, t.create = function(e, s) {
|
|
817
|
-
return new
|
|
817
|
+
return new pe(e, s);
|
|
818
818
|
}, t;
|
|
819
|
-
})(y),
|
|
820
|
-
|
|
819
|
+
})(y), pe = (function(n) {
|
|
820
|
+
x(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;
|
|
@@ -833,10 +833,10 @@ var mt = (function(n) {
|
|
|
833
833
|
(s = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || s === void 0 || s.call(e);
|
|
834
834
|
}, t.prototype._subscribe = function(e) {
|
|
835
835
|
var s, r;
|
|
836
|
-
return (r = (s = this.source) === null || s === void 0 ? void 0 : s.subscribe(e)) !== null && r !== void 0 ? r :
|
|
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
|
+
})(ce), C = (function(n) {
|
|
839
|
+
x(t, n);
|
|
840
840
|
function t(e) {
|
|
841
841
|
var s = n.call(this) || this;
|
|
842
842
|
return s._value = e, s;
|
|
@@ -851,37 +851,37 @@ var mt = (function(n) {
|
|
|
851
851
|
var s = n.prototype._subscribe.call(this, e);
|
|
852
852
|
return !s.closed && e.next(this._value), s;
|
|
853
853
|
}, t.prototype.getValue = function() {
|
|
854
|
-
var e = this, s = e.hasError, r = e.thrownError,
|
|
854
|
+
var e = this, s = e.hasError, r = e.thrownError, i = e._value;
|
|
855
855
|
if (s)
|
|
856
856
|
throw r;
|
|
857
|
-
return this._throwIfClosed(),
|
|
857
|
+
return this._throwIfClosed(), i;
|
|
858
858
|
}, t.prototype.next = function(e) {
|
|
859
859
|
n.prototype.next.call(this, this._value = e);
|
|
860
860
|
}, t;
|
|
861
|
-
})(
|
|
861
|
+
})(ce), yt = {
|
|
862
862
|
now: function() {
|
|
863
863
|
return Date.now();
|
|
864
864
|
}
|
|
865
|
-
},
|
|
866
|
-
|
|
865
|
+
}, wt = (function(n) {
|
|
866
|
+
x(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
|
+
})($), 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, F([n, t],
|
|
877
|
+
return setInterval.apply(void 0, F([n, t], H(e)));
|
|
878
878
|
},
|
|
879
879
|
clearInterval: function(n) {
|
|
880
880
|
return clearInterval(n);
|
|
881
881
|
},
|
|
882
882
|
delegate: void 0
|
|
883
|
-
},
|
|
884
|
-
|
|
883
|
+
}, Et = (function(n) {
|
|
884
|
+
x(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;
|
|
@@ -891,14 +891,14 @@ var mt = (function(n) {
|
|
|
891
891
|
if (s === void 0 && (s = 0), this.closed)
|
|
892
892
|
return this;
|
|
893
893
|
this.state = e;
|
|
894
|
-
var
|
|
895
|
-
return
|
|
894
|
+
var i = this.id, o = this.scheduler;
|
|
895
|
+
return i != null && (this.id = this.recycleAsyncId(o, i, s)), this.pending = !0, this.delay = s, this.id = (r = this.id) !== null && r !== void 0 ? r : this.requestAsyncId(o, this.id, s), this;
|
|
896
896
|
}, t.prototype.requestAsyncId = function(e, s, r) {
|
|
897
|
-
return r === void 0 && (r = 0),
|
|
897
|
+
return r === void 0 && (r = 0), me.setInterval(e.flush.bind(e, this), r);
|
|
898
898
|
}, t.prototype.recycleAsyncId = function(e, s, r) {
|
|
899
899
|
if (r === void 0 && (r = 0), r != null && this.delay === r && this.pending === !1)
|
|
900
900
|
return s;
|
|
901
|
-
s != null &&
|
|
901
|
+
s != null && me.clearInterval(s);
|
|
902
902
|
}, t.prototype.execute = function(e, s) {
|
|
903
903
|
if (this.closed)
|
|
904
904
|
return new Error("executing a cancelled action");
|
|
@@ -908,31 +908,31 @@ var mt = (function(n) {
|
|
|
908
908
|
return r;
|
|
909
909
|
this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
|
|
910
910
|
}, t.prototype._execute = function(e, s) {
|
|
911
|
-
var r = !1,
|
|
911
|
+
var r = !1, i;
|
|
912
912
|
try {
|
|
913
913
|
this.work(e);
|
|
914
|
-
} catch (
|
|
915
|
-
r = !0,
|
|
914
|
+
} catch (o) {
|
|
915
|
+
r = !0, i = o || new Error("Scheduled action threw falsy error");
|
|
916
916
|
}
|
|
917
917
|
if (r)
|
|
918
|
-
return this.unsubscribe(),
|
|
918
|
+
return this.unsubscribe(), i;
|
|
919
919
|
}, t.prototype.unsubscribe = function() {
|
|
920
920
|
if (!this.closed) {
|
|
921
|
-
var e = this, s = e.id, r = e.scheduler,
|
|
922
|
-
this.work = this.state = this.scheduler = null, this.pending = !1,
|
|
921
|
+
var e = this, s = e.id, r = e.scheduler, i = r.actions;
|
|
922
|
+
this.work = this.state = this.scheduler = null, this.pending = !1, V(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
|
+
})(wt), 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 = yt.now, n;
|
|
932
|
+
})(), It = (function(n) {
|
|
933
|
+
x(t, n);
|
|
934
934
|
function t(e, s) {
|
|
935
|
-
s === void 0 && (s =
|
|
935
|
+
s === void 0 && (s = ge.now);
|
|
936
936
|
var r = n.call(this, e, s) || this;
|
|
937
937
|
return r.actions = [], r._active = !1, r;
|
|
938
938
|
}
|
|
@@ -954,64 +954,64 @@ var mt = (function(n) {
|
|
|
954
954
|
throw r;
|
|
955
955
|
}
|
|
956
956
|
}, t;
|
|
957
|
-
})(
|
|
957
|
+
})(ge), Me = new It(Et), Tt = Me, Ct = new y(function(n) {
|
|
958
958
|
return n.complete();
|
|
959
959
|
});
|
|
960
|
-
function
|
|
960
|
+
function Le(n) {
|
|
961
961
|
return n && b(n.schedule);
|
|
962
962
|
}
|
|
963
|
-
function
|
|
963
|
+
function Ue(n) {
|
|
964
964
|
return n[n.length - 1];
|
|
965
965
|
}
|
|
966
|
-
function
|
|
967
|
-
return b(
|
|
966
|
+
function xt(n) {
|
|
967
|
+
return b(Ue(n)) ? n.pop() : void 0;
|
|
968
968
|
}
|
|
969
|
-
function
|
|
970
|
-
return
|
|
969
|
+
function Ne(n) {
|
|
970
|
+
return Le(Ue(n)) ? n.pop() : void 0;
|
|
971
971
|
}
|
|
972
|
-
var
|
|
972
|
+
var Re = (function(n) {
|
|
973
973
|
return n && typeof n.length == "number" && typeof n != "function";
|
|
974
974
|
});
|
|
975
|
-
function
|
|
975
|
+
function ke(n) {
|
|
976
976
|
return b(n?.then);
|
|
977
977
|
}
|
|
978
|
-
function
|
|
979
|
-
return b(n[
|
|
978
|
+
function je(n) {
|
|
979
|
+
return b(n[ae]);
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function $e(n) {
|
|
982
982
|
return Symbol.asyncIterator && b(n?.[Symbol.asyncIterator]);
|
|
983
983
|
}
|
|
984
|
-
function
|
|
984
|
+
function De(n) {
|
|
985
985
|
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
986
|
}
|
|
987
|
-
function
|
|
987
|
+
function At() {
|
|
988
988
|
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
|
|
989
989
|
}
|
|
990
|
-
var
|
|
991
|
-
function De(n) {
|
|
992
|
-
return b(n?.[$e]);
|
|
993
|
-
}
|
|
990
|
+
var He = At();
|
|
994
991
|
function Fe(n) {
|
|
995
|
-
return
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
992
|
+
return b(n?.[He]);
|
|
993
|
+
}
|
|
994
|
+
function Ge(n) {
|
|
995
|
+
return at(this, arguments, function() {
|
|
996
|
+
var e, s, r, i;
|
|
997
|
+
return xe(this, function(o) {
|
|
998
|
+
switch (o.label) {
|
|
999
999
|
case 0:
|
|
1000
|
-
e = n.getReader(),
|
|
1000
|
+
e = n.getReader(), o.label = 1;
|
|
1001
1001
|
case 1:
|
|
1002
|
-
|
|
1002
|
+
o.trys.push([1, , 9, 10]), o.label = 2;
|
|
1003
1003
|
case 2:
|
|
1004
|
-
return [4,
|
|
1004
|
+
return [4, R(e.read())];
|
|
1005
1005
|
case 3:
|
|
1006
|
-
return s =
|
|
1006
|
+
return s = o.sent(), r = s.value, i = s.done, i ? [4, R(void 0)] : [3, 5];
|
|
1007
1007
|
case 4:
|
|
1008
|
-
return [2,
|
|
1008
|
+
return [2, o.sent()];
|
|
1009
1009
|
case 5:
|
|
1010
|
-
return [4,
|
|
1010
|
+
return [4, R(r)];
|
|
1011
1011
|
case 6:
|
|
1012
|
-
return [4,
|
|
1012
|
+
return [4, o.sent()];
|
|
1013
1013
|
case 7:
|
|
1014
|
-
return
|
|
1014
|
+
return o.sent(), [3, 2];
|
|
1015
1015
|
case 8:
|
|
1016
1016
|
return [3, 10];
|
|
1017
1017
|
case 9:
|
|
@@ -1022,66 +1022,66 @@ function Fe(n) {
|
|
|
1022
1022
|
});
|
|
1023
1023
|
});
|
|
1024
1024
|
}
|
|
1025
|
-
function
|
|
1025
|
+
function Be(n) {
|
|
1026
1026
|
return b(n?.getReader);
|
|
1027
1027
|
}
|
|
1028
|
-
function
|
|
1028
|
+
function N(n) {
|
|
1029
1029
|
if (n instanceof y)
|
|
1030
1030
|
return n;
|
|
1031
1031
|
if (n != null) {
|
|
1032
|
-
if (
|
|
1033
|
-
return Ct(n);
|
|
1034
|
-
if (Ue(n))
|
|
1035
|
-
return xt(n);
|
|
1036
|
-
if (Ne(n))
|
|
1037
|
-
return At(n);
|
|
1038
|
-
if (Re(n))
|
|
1039
|
-
return Ge(n);
|
|
1040
|
-
if (De(n))
|
|
1032
|
+
if (je(n))
|
|
1041
1033
|
return Ot(n);
|
|
1042
|
-
if (
|
|
1034
|
+
if (Re(n))
|
|
1043
1035
|
return Pt(n);
|
|
1036
|
+
if (ke(n))
|
|
1037
|
+
return _t(n);
|
|
1038
|
+
if ($e(n))
|
|
1039
|
+
return qe(n);
|
|
1040
|
+
if (Fe(n))
|
|
1041
|
+
return Mt(n);
|
|
1042
|
+
if (Be(n))
|
|
1043
|
+
return Lt(n);
|
|
1044
1044
|
}
|
|
1045
|
-
throw
|
|
1045
|
+
throw De(n);
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1047
|
+
function Ot(n) {
|
|
1048
1048
|
return new y(function(t) {
|
|
1049
|
-
var e = n[
|
|
1049
|
+
var e = n[ae]();
|
|
1050
1050
|
if (b(e.subscribe))
|
|
1051
1051
|
return e.subscribe(t);
|
|
1052
1052
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
1053
1053
|
});
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function Pt(n) {
|
|
1056
1056
|
return new y(function(t) {
|
|
1057
1057
|
for (var e = 0; e < n.length && !t.closed; e++)
|
|
1058
1058
|
t.next(n[e]);
|
|
1059
1059
|
t.complete();
|
|
1060
1060
|
});
|
|
1061
1061
|
}
|
|
1062
|
-
function
|
|
1062
|
+
function _t(n) {
|
|
1063
1063
|
return new y(function(t) {
|
|
1064
1064
|
n.then(function(e) {
|
|
1065
1065
|
t.closed || (t.next(e), t.complete());
|
|
1066
1066
|
}, function(e) {
|
|
1067
1067
|
return t.error(e);
|
|
1068
|
-
}).then(null,
|
|
1068
|
+
}).then(null, _e);
|
|
1069
1069
|
});
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1071
|
+
function Mt(n) {
|
|
1072
1072
|
return new y(function(t) {
|
|
1073
1073
|
var e, s;
|
|
1074
1074
|
try {
|
|
1075
|
-
for (var r = k(n),
|
|
1076
|
-
var
|
|
1077
|
-
if (t.next(
|
|
1075
|
+
for (var r = k(n), i = r.next(); !i.done; i = r.next()) {
|
|
1076
|
+
var o = i.value;
|
|
1077
|
+
if (t.next(o), t.closed)
|
|
1078
1078
|
return;
|
|
1079
1079
|
}
|
|
1080
1080
|
} catch (a) {
|
|
1081
1081
|
e = { error: a };
|
|
1082
1082
|
} finally {
|
|
1083
1083
|
try {
|
|
1084
|
-
|
|
1084
|
+
i && !i.done && (s = r.return) && s.call(r);
|
|
1085
1085
|
} finally {
|
|
1086
1086
|
if (e) throw e.error;
|
|
1087
1087
|
}
|
|
@@ -1089,29 +1089,29 @@ function Ot(n) {
|
|
|
1089
1089
|
t.complete();
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function qe(n) {
|
|
1093
1093
|
return new y(function(t) {
|
|
1094
|
-
|
|
1094
|
+
Ut(n, t).catch(function(e) {
|
|
1095
1095
|
return t.error(e);
|
|
1096
1096
|
});
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1100
|
-
return Ge(
|
|
1099
|
+
function Lt(n) {
|
|
1100
|
+
return qe(Ge(n));
|
|
1101
1101
|
}
|
|
1102
|
-
function
|
|
1103
|
-
var e, s, r,
|
|
1104
|
-
return
|
|
1105
|
-
var
|
|
1106
|
-
return
|
|
1102
|
+
function Ut(n, t) {
|
|
1103
|
+
var e, s, r, i;
|
|
1104
|
+
return ot(this, void 0, void 0, function() {
|
|
1105
|
+
var o, a;
|
|
1106
|
+
return xe(this, function(c) {
|
|
1107
1107
|
switch (c.label) {
|
|
1108
1108
|
case 0:
|
|
1109
|
-
c.trys.push([0, 5, 6, 11]), e =
|
|
1109
|
+
c.trys.push([0, 5, 6, 11]), e = ct(n), c.label = 1;
|
|
1110
1110
|
case 1:
|
|
1111
1111
|
return [4, e.next()];
|
|
1112
1112
|
case 2:
|
|
1113
1113
|
if (s = c.sent(), !!s.done) return [3, 4];
|
|
1114
|
-
if (
|
|
1114
|
+
if (o = s.value, t.next(o), t.closed)
|
|
1115
1115
|
return [2];
|
|
1116
1116
|
c.label = 3;
|
|
1117
1117
|
case 3:
|
|
@@ -1121,7 +1121,7 @@ function _t(n, t) {
|
|
|
1121
1121
|
case 5:
|
|
1122
1122
|
return a = c.sent(), r = { error: a }, [3, 11];
|
|
1123
1123
|
case 6:
|
|
1124
|
-
return c.trys.push([6, , 9, 10]), s && !s.done && (
|
|
1124
|
+
return c.trys.push([6, , 9, 10]), s && !s.done && (i = e.return) ? [4, i.call(e)] : [3, 8];
|
|
1125
1125
|
case 7:
|
|
1126
1126
|
c.sent(), c.label = 8;
|
|
1127
1127
|
case 8:
|
|
@@ -1137,45 +1137,45 @@ function _t(n, t) {
|
|
|
1137
1137
|
});
|
|
1138
1138
|
});
|
|
1139
1139
|
}
|
|
1140
|
-
function
|
|
1140
|
+
function O(n, t, e, s, r) {
|
|
1141
1141
|
s === void 0 && (s = 0), r === void 0 && (r = !1);
|
|
1142
|
-
var
|
|
1142
|
+
var i = t.schedule(function() {
|
|
1143
1143
|
e(), r ? n.add(this.schedule(null, s)) : this.unsubscribe();
|
|
1144
1144
|
}, s);
|
|
1145
|
-
if (n.add(
|
|
1146
|
-
return
|
|
1145
|
+
if (n.add(i), !r)
|
|
1146
|
+
return i;
|
|
1147
1147
|
}
|
|
1148
|
-
function
|
|
1149
|
-
return t === void 0 && (t = 0),
|
|
1150
|
-
e.subscribe(
|
|
1151
|
-
return
|
|
1148
|
+
function Ke(n, t) {
|
|
1149
|
+
return t === void 0 && (t = 0), _(function(e, s) {
|
|
1150
|
+
e.subscribe(P(s, function(r) {
|
|
1151
|
+
return O(s, n, function() {
|
|
1152
1152
|
return s.next(r);
|
|
1153
1153
|
}, t);
|
|
1154
1154
|
}, function() {
|
|
1155
|
-
return
|
|
1155
|
+
return O(s, n, function() {
|
|
1156
1156
|
return s.complete();
|
|
1157
1157
|
}, t);
|
|
1158
1158
|
}, function(r) {
|
|
1159
|
-
return
|
|
1159
|
+
return O(s, n, function() {
|
|
1160
1160
|
return s.error(r);
|
|
1161
1161
|
}, t);
|
|
1162
1162
|
}));
|
|
1163
1163
|
});
|
|
1164
1164
|
}
|
|
1165
|
-
function
|
|
1166
|
-
return t === void 0 && (t = 0),
|
|
1165
|
+
function Ve(n, t) {
|
|
1166
|
+
return t === void 0 && (t = 0), _(function(e, s) {
|
|
1167
1167
|
s.add(n.schedule(function() {
|
|
1168
1168
|
return e.subscribe(s);
|
|
1169
1169
|
}, t));
|
|
1170
1170
|
});
|
|
1171
1171
|
}
|
|
1172
|
-
function
|
|
1173
|
-
return
|
|
1172
|
+
function Nt(n, t) {
|
|
1173
|
+
return N(n).pipe(Ve(t), Ke(t));
|
|
1174
1174
|
}
|
|
1175
|
-
function
|
|
1176
|
-
return
|
|
1175
|
+
function Rt(n, t) {
|
|
1176
|
+
return N(n).pipe(Ve(t), Ke(t));
|
|
1177
1177
|
}
|
|
1178
|
-
function
|
|
1178
|
+
function kt(n, t) {
|
|
1179
1179
|
return new y(function(e) {
|
|
1180
1180
|
var s = 0;
|
|
1181
1181
|
return t.schedule(function() {
|
|
@@ -1183,32 +1183,32 @@ function Ut(n, t) {
|
|
|
1183
1183
|
});
|
|
1184
1184
|
});
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1186
|
+
function jt(n, t) {
|
|
1187
1187
|
return new y(function(e) {
|
|
1188
1188
|
var s;
|
|
1189
|
-
return
|
|
1190
|
-
s = n[
|
|
1191
|
-
var r,
|
|
1189
|
+
return O(e, t, function() {
|
|
1190
|
+
s = n[He](), O(e, t, function() {
|
|
1191
|
+
var r, i, o;
|
|
1192
1192
|
try {
|
|
1193
|
-
r = s.next(),
|
|
1193
|
+
r = s.next(), i = r.value, o = r.done;
|
|
1194
1194
|
} catch (a) {
|
|
1195
1195
|
e.error(a);
|
|
1196
1196
|
return;
|
|
1197
1197
|
}
|
|
1198
|
-
|
|
1198
|
+
o ? e.complete() : e.next(i);
|
|
1199
1199
|
}, 0, !0);
|
|
1200
1200
|
}), function() {
|
|
1201
1201
|
return b(s?.return) && s.return();
|
|
1202
1202
|
};
|
|
1203
1203
|
});
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1205
|
+
function We(n, t) {
|
|
1206
1206
|
if (!n)
|
|
1207
1207
|
throw new Error("Iterable cannot be null");
|
|
1208
1208
|
return new y(function(e) {
|
|
1209
|
-
|
|
1209
|
+
O(e, t, function() {
|
|
1210
1210
|
var s = n[Symbol.asyncIterator]();
|
|
1211
|
-
|
|
1211
|
+
O(e, t, function() {
|
|
1212
1212
|
s.next().then(function(r) {
|
|
1213
1213
|
r.done ? e.complete() : e.next(r.value);
|
|
1214
1214
|
});
|
|
@@ -1216,63 +1216,63 @@ function Ke(n, t) {
|
|
|
1216
1216
|
});
|
|
1217
1217
|
});
|
|
1218
1218
|
}
|
|
1219
|
-
function
|
|
1220
|
-
return
|
|
1219
|
+
function $t(n, t) {
|
|
1220
|
+
return We(Ge(n), t);
|
|
1221
1221
|
}
|
|
1222
|
-
function
|
|
1222
|
+
function Dt(n, t) {
|
|
1223
1223
|
if (n != null) {
|
|
1224
|
-
if (
|
|
1225
|
-
return Lt(n, t);
|
|
1226
|
-
if (Ue(n))
|
|
1227
|
-
return Ut(n, t);
|
|
1228
|
-
if (Ne(n))
|
|
1229
|
-
return Mt(n, t);
|
|
1230
|
-
if (Re(n))
|
|
1231
|
-
return Ke(n, t);
|
|
1232
|
-
if (De(n))
|
|
1224
|
+
if (je(n))
|
|
1233
1225
|
return Nt(n, t);
|
|
1234
|
-
if (
|
|
1226
|
+
if (Re(n))
|
|
1235
1227
|
return kt(n, t);
|
|
1228
|
+
if (ke(n))
|
|
1229
|
+
return Rt(n, t);
|
|
1230
|
+
if ($e(n))
|
|
1231
|
+
return We(n, t);
|
|
1232
|
+
if (Fe(n))
|
|
1233
|
+
return jt(n, t);
|
|
1234
|
+
if (Be(n))
|
|
1235
|
+
return $t(n, t);
|
|
1236
1236
|
}
|
|
1237
|
-
throw
|
|
1237
|
+
throw De(n);
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1240
|
-
return t ?
|
|
1239
|
+
function ue(n, t) {
|
|
1240
|
+
return t ? Dt(n, t) : N(n);
|
|
1241
1241
|
}
|
|
1242
|
-
function
|
|
1242
|
+
function Ht() {
|
|
1243
1243
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1244
1244
|
n[t] = arguments[t];
|
|
1245
|
-
var e =
|
|
1246
|
-
return
|
|
1245
|
+
var e = Ne(n);
|
|
1246
|
+
return ue(n, e);
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1248
|
+
function Ft(n) {
|
|
1249
1249
|
return n instanceof Date && !isNaN(n);
|
|
1250
1250
|
}
|
|
1251
|
-
function
|
|
1252
|
-
return
|
|
1251
|
+
function j(n, t) {
|
|
1252
|
+
return _(function(e, s) {
|
|
1253
1253
|
var r = 0;
|
|
1254
|
-
e.subscribe(
|
|
1255
|
-
s.next(n.call(t,
|
|
1254
|
+
e.subscribe(P(s, function(i) {
|
|
1255
|
+
s.next(n.call(t, i, r++));
|
|
1256
1256
|
}));
|
|
1257
1257
|
});
|
|
1258
1258
|
}
|
|
1259
|
-
var
|
|
1260
|
-
function
|
|
1261
|
-
return
|
|
1259
|
+
var Gt = Array.isArray;
|
|
1260
|
+
function Bt(n, t) {
|
|
1261
|
+
return Gt(t) ? n.apply(void 0, F([], H(t))) : n(t);
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1264
|
-
return
|
|
1265
|
-
return
|
|
1263
|
+
function qt(n) {
|
|
1264
|
+
return j(function(t) {
|
|
1265
|
+
return Bt(n, t);
|
|
1266
1266
|
});
|
|
1267
1267
|
}
|
|
1268
|
-
var
|
|
1269
|
-
function
|
|
1268
|
+
var Kt = Array.isArray, Vt = Object.getPrototypeOf, Wt = Object.prototype, Xt = Object.keys;
|
|
1269
|
+
function Yt(n) {
|
|
1270
1270
|
if (n.length === 1) {
|
|
1271
1271
|
var t = n[0];
|
|
1272
|
-
if (
|
|
1272
|
+
if (Kt(t))
|
|
1273
1273
|
return { args: t, keys: null };
|
|
1274
|
-
if (
|
|
1275
|
-
var e =
|
|
1274
|
+
if (zt(t)) {
|
|
1275
|
+
var e = Xt(t);
|
|
1276
1276
|
return {
|
|
1277
1277
|
args: e.map(function(s) {
|
|
1278
1278
|
return t[s];
|
|
@@ -1283,35 +1283,35 @@ function Vt(n) {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
return { args: n, keys: null };
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1287
|
-
return n && typeof n == "object" &&
|
|
1286
|
+
function zt(n) {
|
|
1287
|
+
return n && typeof n == "object" && Vt(n) === Wt;
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1289
|
+
function Jt(n, t) {
|
|
1290
1290
|
return n.reduce(function(e, s, r) {
|
|
1291
1291
|
return e[s] = t[r], e;
|
|
1292
1292
|
}, {});
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1294
|
+
function Qt() {
|
|
1295
1295
|
for (var n = [], t = 0; t < arguments.length; t++)
|
|
1296
1296
|
n[t] = arguments[t];
|
|
1297
|
-
var e =
|
|
1298
|
-
if (
|
|
1299
|
-
return
|
|
1300
|
-
var a = new y(
|
|
1301
|
-
return
|
|
1302
|
-
} :
|
|
1303
|
-
return s ? a.pipe(
|
|
1304
|
-
}
|
|
1305
|
-
function
|
|
1306
|
-
return e === void 0 && (e =
|
|
1307
|
-
|
|
1308
|
-
for (var r = n.length,
|
|
1309
|
-
|
|
1310
|
-
var m =
|
|
1311
|
-
m.subscribe(
|
|
1312
|
-
|
|
1297
|
+
var e = Ne(n), s = xt(n), r = Yt(n), i = r.args, o = r.keys;
|
|
1298
|
+
if (i.length === 0)
|
|
1299
|
+
return ue([], e);
|
|
1300
|
+
var a = new y(Zt(i, e, o ? function(c) {
|
|
1301
|
+
return Jt(o, c);
|
|
1302
|
+
} : X));
|
|
1303
|
+
return s ? a.pipe(qt(s)) : a;
|
|
1304
|
+
}
|
|
1305
|
+
function Zt(n, t, e) {
|
|
1306
|
+
return e === void 0 && (e = X), function(s) {
|
|
1307
|
+
be(t, function() {
|
|
1308
|
+
for (var r = n.length, i = new Array(r), o = r, a = r, c = function(d) {
|
|
1309
|
+
be(t, function() {
|
|
1310
|
+
var m = ue(n[d], t), v = !1;
|
|
1311
|
+
m.subscribe(P(s, function(h) {
|
|
1312
|
+
i[d] = h, v || (v = !0, a--), a || s.next(e(i.slice()));
|
|
1313
1313
|
}, function() {
|
|
1314
|
-
--
|
|
1314
|
+
--o || s.complete();
|
|
1315
1315
|
}));
|
|
1316
1316
|
}, s);
|
|
1317
1317
|
}, u = 0; u < r; u++)
|
|
@@ -1319,106 +1319,106 @@ function zt(n, t, e) {
|
|
|
1319
1319
|
}, s);
|
|
1320
1320
|
};
|
|
1321
1321
|
}
|
|
1322
|
-
function
|
|
1323
|
-
n ?
|
|
1322
|
+
function be(n, t, e) {
|
|
1323
|
+
n ? O(e, n, t) : t();
|
|
1324
1324
|
}
|
|
1325
|
-
function
|
|
1326
|
-
var c = [], u = 0,
|
|
1325
|
+
function en(n, t, e, s, r, i, o, a) {
|
|
1326
|
+
var c = [], u = 0, d = 0, m = !1, v = function() {
|
|
1327
1327
|
m && !c.length && !u && t.complete();
|
|
1328
|
-
},
|
|
1328
|
+
}, h = function(f) {
|
|
1329
1329
|
return u < s ? p(f) : c.push(f);
|
|
1330
1330
|
}, p = function(f) {
|
|
1331
1331
|
u++;
|
|
1332
|
-
var
|
|
1333
|
-
|
|
1334
|
-
t.next(
|
|
1332
|
+
var M = !1;
|
|
1333
|
+
N(e(f, d++)).subscribe(P(t, function(E) {
|
|
1334
|
+
t.next(E);
|
|
1335
1335
|
}, function() {
|
|
1336
|
-
|
|
1336
|
+
M = !0;
|
|
1337
1337
|
}, void 0, function() {
|
|
1338
|
-
if (
|
|
1338
|
+
if (M)
|
|
1339
1339
|
try {
|
|
1340
1340
|
u--;
|
|
1341
|
-
for (var
|
|
1341
|
+
for (var E = function() {
|
|
1342
1342
|
var L = c.shift();
|
|
1343
|
-
|
|
1343
|
+
o || p(L);
|
|
1344
1344
|
}; c.length && u < s; )
|
|
1345
|
-
|
|
1345
|
+
E();
|
|
1346
1346
|
v();
|
|
1347
1347
|
} catch (L) {
|
|
1348
1348
|
t.error(L);
|
|
1349
1349
|
}
|
|
1350
1350
|
}));
|
|
1351
1351
|
};
|
|
1352
|
-
return n.subscribe(
|
|
1352
|
+
return n.subscribe(P(t, h, function() {
|
|
1353
1353
|
m = !0, v();
|
|
1354
1354
|
})), function() {
|
|
1355
1355
|
};
|
|
1356
1356
|
}
|
|
1357
|
-
function
|
|
1358
|
-
return e === void 0 && (e = 1 / 0), b(t) ?
|
|
1359
|
-
return
|
|
1360
|
-
return t(s,
|
|
1361
|
-
})(
|
|
1362
|
-
}, e) : (typeof t == "number" && (e = t),
|
|
1363
|
-
return
|
|
1357
|
+
function W(n, t, e) {
|
|
1358
|
+
return e === void 0 && (e = 1 / 0), b(t) ? W(function(s, r) {
|
|
1359
|
+
return j(function(i, o) {
|
|
1360
|
+
return t(s, i, r, o);
|
|
1361
|
+
})(N(n(s, r)));
|
|
1362
|
+
}, e) : (typeof t == "number" && (e = t), _(function(s, r) {
|
|
1363
|
+
return en(s, r, n, e);
|
|
1364
1364
|
}));
|
|
1365
1365
|
}
|
|
1366
|
-
function
|
|
1367
|
-
n === void 0 && (n = 0), e === void 0 && (e =
|
|
1366
|
+
function tn(n, t, e) {
|
|
1367
|
+
n === void 0 && (n = 0), e === void 0 && (e = Tt);
|
|
1368
1368
|
var s = -1;
|
|
1369
|
-
return t != null && (
|
|
1370
|
-
var
|
|
1371
|
-
|
|
1372
|
-
var
|
|
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
1373
|
return e.schedule(function() {
|
|
1374
|
-
r.closed || (r.next(
|
|
1375
|
-
},
|
|
1374
|
+
r.closed || (r.next(o++), 0 <= s ? this.schedule(void 0, s) : r.complete());
|
|
1375
|
+
}, i);
|
|
1376
1376
|
});
|
|
1377
1377
|
}
|
|
1378
|
-
function
|
|
1379
|
-
return b(t) ?
|
|
1378
|
+
function nn(n, t) {
|
|
1379
|
+
return b(t) ? W(n, t, 1) : W(n, 1);
|
|
1380
1380
|
}
|
|
1381
|
-
function
|
|
1381
|
+
function sn(n) {
|
|
1382
1382
|
return n <= 0 ? function() {
|
|
1383
|
-
return
|
|
1384
|
-
} :
|
|
1383
|
+
return Ct;
|
|
1384
|
+
} : _(function(t, e) {
|
|
1385
1385
|
var s = 0;
|
|
1386
|
-
t.subscribe(
|
|
1386
|
+
t.subscribe(P(e, function(r) {
|
|
1387
1387
|
++s <= n && (e.next(r), n <= s && e.complete());
|
|
1388
1388
|
}));
|
|
1389
1389
|
});
|
|
1390
1390
|
}
|
|
1391
|
-
function
|
|
1392
|
-
return
|
|
1391
|
+
function rn(n) {
|
|
1392
|
+
return j(function() {
|
|
1393
1393
|
return n;
|
|
1394
1394
|
});
|
|
1395
1395
|
}
|
|
1396
|
-
function
|
|
1397
|
-
return
|
|
1398
|
-
return
|
|
1396
|
+
function on(n, t) {
|
|
1397
|
+
return W(function(e, s) {
|
|
1398
|
+
return N(n(e, s)).pipe(sn(1), rn(e));
|
|
1399
1399
|
});
|
|
1400
1400
|
}
|
|
1401
|
-
function
|
|
1402
|
-
t === void 0 && (t =
|
|
1403
|
-
var e =
|
|
1404
|
-
return
|
|
1401
|
+
function an(n, t) {
|
|
1402
|
+
t === void 0 && (t = Me);
|
|
1403
|
+
var e = tn(n, t);
|
|
1404
|
+
return on(function() {
|
|
1405
1405
|
return e;
|
|
1406
1406
|
});
|
|
1407
1407
|
}
|
|
1408
|
-
function
|
|
1409
|
-
return t === void 0 && (t =
|
|
1410
|
-
var r,
|
|
1411
|
-
e.subscribe(
|
|
1412
|
-
var a = t(
|
|
1413
|
-
(
|
|
1408
|
+
function U(n, t) {
|
|
1409
|
+
return t === void 0 && (t = X), n = n ?? cn, _(function(e, s) {
|
|
1410
|
+
var r, i = !0;
|
|
1411
|
+
e.subscribe(P(s, function(o) {
|
|
1412
|
+
var a = t(o);
|
|
1413
|
+
(i || !n(r, a)) && (i = !1, r = a, s.next(o));
|
|
1414
1414
|
}));
|
|
1415
1415
|
});
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1417
|
+
function cn(n, t) {
|
|
1418
1418
|
return n === t;
|
|
1419
1419
|
}
|
|
1420
|
-
function
|
|
1421
|
-
return
|
|
1420
|
+
function un(n) {
|
|
1421
|
+
return _(function(t, e) {
|
|
1422
1422
|
try {
|
|
1423
1423
|
t.subscribe(e);
|
|
1424
1424
|
} finally {
|
|
@@ -1426,28 +1426,28 @@ function on(n) {
|
|
|
1426
1426
|
}
|
|
1427
1427
|
});
|
|
1428
1428
|
}
|
|
1429
|
-
function
|
|
1430
|
-
return
|
|
1431
|
-
|
|
1429
|
+
function ln(n) {
|
|
1430
|
+
return _(function(t, e) {
|
|
1431
|
+
N(n).subscribe(P(e, function() {
|
|
1432
1432
|
return e.complete();
|
|
1433
|
-
},
|
|
1433
|
+
}, re)), !e.closed && t.subscribe(e);
|
|
1434
1434
|
});
|
|
1435
1435
|
}
|
|
1436
|
-
function
|
|
1437
|
-
const { endpoint: t, apiKey: e, payload: s, debugMode: r, customHeaders:
|
|
1436
|
+
function ve(n) {
|
|
1437
|
+
const { endpoint: t, apiKey: e, payload: s, debugMode: r, customHeaders: i } = n, o = n.method ?? "POST";
|
|
1438
1438
|
return new y((a) => {
|
|
1439
1439
|
const c = new AbortController();
|
|
1440
|
-
let u,
|
|
1440
|
+
let u, d = !1, m = !1;
|
|
1441
1441
|
const v = {
|
|
1442
1442
|
"Content-Type": "application/json",
|
|
1443
|
-
...
|
|
1443
|
+
...i
|
|
1444
1444
|
};
|
|
1445
1445
|
e && (v["X-API-KEY"] = e);
|
|
1446
|
-
const
|
|
1447
|
-
return r &&
|
|
1448
|
-
method:
|
|
1446
|
+
const h = new URL(t);
|
|
1447
|
+
return r && h.searchParams.set("is_debug", "true"), Ce(h.toString(), {
|
|
1448
|
+
method: o,
|
|
1449
1449
|
headers: v,
|
|
1450
|
-
body:
|
|
1450
|
+
body: o === "POST" && s ? JSON.stringify(s) : void 0,
|
|
1451
1451
|
signal: c.signal,
|
|
1452
1452
|
/**
|
|
1453
1453
|
* Allow SSE to work when the page is hidden.
|
|
@@ -1472,7 +1472,7 @@ function be(n) {
|
|
|
1472
1472
|
}
|
|
1473
1473
|
},
|
|
1474
1474
|
onmessage: (p) => {
|
|
1475
|
-
p.id && (
|
|
1475
|
+
p.id && (d = !0);
|
|
1476
1476
|
const f = JSON.parse(p.data);
|
|
1477
1477
|
u ? f.traceId = u : f.requestId && (f.traceId = f.requestId, u || (u = f.requestId)), a.next(f);
|
|
1478
1478
|
},
|
|
@@ -1481,7 +1481,7 @@ function be(n) {
|
|
|
1481
1481
|
},
|
|
1482
1482
|
onerror: (p) => {
|
|
1483
1483
|
if (m) throw p;
|
|
1484
|
-
if (!
|
|
1484
|
+
if (!d)
|
|
1485
1485
|
throw a.error(p), c.abort(), p;
|
|
1486
1486
|
}
|
|
1487
1487
|
}), () => {
|
|
@@ -1489,7 +1489,7 @@ function be(n) {
|
|
|
1489
1489
|
};
|
|
1490
1490
|
});
|
|
1491
1491
|
}
|
|
1492
|
-
class
|
|
1492
|
+
class dn {
|
|
1493
1493
|
listeners = {};
|
|
1494
1494
|
on(t, e) {
|
|
1495
1495
|
this.listeners = Object.assign({}, this.listeners, {
|
|
@@ -1508,17 +1508,17 @@ class cn {
|
|
|
1508
1508
|
this.listeners[t] && this.listeners[t].forEach((s) => s(...e));
|
|
1509
1509
|
}
|
|
1510
1510
|
}
|
|
1511
|
-
class
|
|
1511
|
+
class Dn {
|
|
1512
1512
|
apiKey;
|
|
1513
1513
|
endpoint;
|
|
1514
1514
|
botProviderEndpoint;
|
|
1515
1515
|
debugMode;
|
|
1516
|
-
destroy$ = new
|
|
1516
|
+
destroy$ = new ce();
|
|
1517
1517
|
closed = !1;
|
|
1518
1518
|
detached = !1;
|
|
1519
1519
|
detachTimer;
|
|
1520
1520
|
inFlight = 0;
|
|
1521
|
-
sseEmitter = new
|
|
1521
|
+
sseEmitter = new dn();
|
|
1522
1522
|
transformSsePayload;
|
|
1523
1523
|
customHeaders;
|
|
1524
1524
|
constructor(t) {
|
|
@@ -1571,7 +1571,7 @@ class Un {
|
|
|
1571
1571
|
}
|
|
1572
1572
|
fetchSse(t, e) {
|
|
1573
1573
|
return e?.onSseStart?.(), this.inFlight += 1, this.runSse(
|
|
1574
|
-
|
|
1574
|
+
ve({
|
|
1575
1575
|
apiKey: this.apiKey,
|
|
1576
1576
|
endpoint: this.endpoint,
|
|
1577
1577
|
debugMode: this.debugMode,
|
|
@@ -1590,7 +1590,7 @@ class Un {
|
|
|
1590
1590
|
e?.onSseStart?.(), this.inFlight += 1;
|
|
1591
1591
|
const s = new URL(this.endpoint);
|
|
1592
1592
|
return s.searchParams.set("custom_channel_id", t), this.runSse(
|
|
1593
|
-
|
|
1593
|
+
ve({
|
|
1594
1594
|
apiKey: this.apiKey,
|
|
1595
1595
|
endpoint: s.toString(),
|
|
1596
1596
|
debugMode: this.debugMode,
|
|
@@ -1618,13 +1618,13 @@ class Un {
|
|
|
1618
1618
|
s.searchParams.set("custom_channel_id", t);
|
|
1619
1619
|
const r = { ...this.customHeaders };
|
|
1620
1620
|
this.apiKey && (r["X-API-KEY"] = this.apiKey);
|
|
1621
|
-
const
|
|
1622
|
-
if (
|
|
1621
|
+
const i = await fetch(s.toString(), { method: "GET", headers: r });
|
|
1622
|
+
if (i.status === 404)
|
|
1623
1623
|
return null;
|
|
1624
|
-
if (!
|
|
1625
|
-
throw new w(
|
|
1624
|
+
if (!i.ok)
|
|
1625
|
+
throw new w(i.status, i.statusText, await i.text().catch(() => {
|
|
1626
1626
|
}));
|
|
1627
|
-
const
|
|
1627
|
+
const o = await i.json(), a = o.data ?? o;
|
|
1628
1628
|
return {
|
|
1629
1629
|
title: a.title ?? null,
|
|
1630
1630
|
runState: a.runState ?? "IDLE",
|
|
@@ -1666,9 +1666,9 @@ class Un {
|
|
|
1666
1666
|
throw new Error("Unable to derive channel suspend endpoint. Please provide botProviderEndpoint in config.");
|
|
1667
1667
|
const r = new URL(s);
|
|
1668
1668
|
r.searchParams.set("custom_channel_id", t), e?.requestId && r.searchParams.set("request_id", e.requestId), e?.force && r.searchParams.set("force", "true");
|
|
1669
|
-
const
|
|
1670
|
-
if (!(
|
|
1671
|
-
throw new w(
|
|
1669
|
+
const i = await fetch(r.toString(), { method: "POST", headers: this.apiHeaders() });
|
|
1670
|
+
if (!(i.ok || i.status === 404))
|
|
1671
|
+
throw new w(i.status, i.statusText, await i.text().catch(() => {
|
|
1672
1672
|
}));
|
|
1673
1673
|
}
|
|
1674
1674
|
runSse(t, e) {
|
|
@@ -1676,11 +1676,11 @@ class Un {
|
|
|
1676
1676
|
// No RxJS-level retry: re-subscribing would re-POST and the backend would re-dispatch a duplicate
|
|
1677
1677
|
// run. Mid-stream resume is the library's job (native Last-Event-ID reconnect in
|
|
1678
1678
|
// create-sse-observable); a no-cursor failure surfaces via `error` below.
|
|
1679
|
-
|
|
1680
|
-
|
|
1679
|
+
nn((s) => Ht(s).pipe(an(e?.delayTime ?? 50))),
|
|
1680
|
+
ln(this.destroy$),
|
|
1681
1681
|
// Settle the run accounting on every termination path — complete, error, AND a user-initiated
|
|
1682
1682
|
// unsubscribe (stop-generation aborts the connection without a terminal event).
|
|
1683
|
-
|
|
1683
|
+
un(() => this.onRunSettled())
|
|
1684
1684
|
).subscribe({
|
|
1685
1685
|
next: (s) => {
|
|
1686
1686
|
this.detached || (e?.onSseMessage?.(s), this.handleEvent(s));
|
|
@@ -1732,22 +1732,22 @@ class Un {
|
|
|
1732
1732
|
throw new Error("Unable to derive blob endpoint. Please provide botProviderEndpoint in config.");
|
|
1733
1733
|
const r = new FormData();
|
|
1734
1734
|
r.append("file", t), r.append("customChannelId", e);
|
|
1735
|
-
const
|
|
1735
|
+
const i = {
|
|
1736
1736
|
...this.customHeaders
|
|
1737
1737
|
};
|
|
1738
|
-
this.apiKey && (
|
|
1738
|
+
this.apiKey && (i["X-API-KEY"] = this.apiKey);
|
|
1739
1739
|
try {
|
|
1740
|
-
const
|
|
1740
|
+
const o = await fetch(s, {
|
|
1741
1741
|
method: "POST",
|
|
1742
|
-
headers:
|
|
1742
|
+
headers: i,
|
|
1743
1743
|
body: r
|
|
1744
1744
|
});
|
|
1745
|
-
if (!
|
|
1746
|
-
throw new Error(`Upload failed: ${
|
|
1747
|
-
const a = await
|
|
1745
|
+
if (!o.ok)
|
|
1746
|
+
throw new Error(`Upload failed: ${o.status} ${o.statusText}`);
|
|
1747
|
+
const a = await o.json();
|
|
1748
1748
|
return this.debugMode && console.log("[AsgardServiceClient] File upload response:", a), a;
|
|
1749
|
-
} catch (
|
|
1750
|
-
throw console.error("[AsgardServiceClient] File upload error:",
|
|
1749
|
+
} catch (o) {
|
|
1750
|
+
throw console.error("[AsgardServiceClient] File upload error:", o), o;
|
|
1751
1751
|
}
|
|
1752
1752
|
}
|
|
1753
1753
|
/**
|
|
@@ -1758,14 +1758,14 @@ class Un {
|
|
|
1758
1758
|
const s = this.getBaseEndpoint();
|
|
1759
1759
|
if (!s)
|
|
1760
1760
|
throw new Error("Unable to derive channel-home download endpoint. Please provide botProviderEndpoint in config.");
|
|
1761
|
-
const r = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`,
|
|
1761
|
+
const r = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`, i = `${s}/channel-home/download?${r}`, o = {
|
|
1762
1762
|
...this.customHeaders
|
|
1763
1763
|
};
|
|
1764
|
-
this.apiKey && (
|
|
1764
|
+
this.apiKey && (o["X-API-KEY"] = this.apiKey);
|
|
1765
1765
|
try {
|
|
1766
|
-
const a = await fetch(
|
|
1766
|
+
const a = await fetch(i, {
|
|
1767
1767
|
method: "GET",
|
|
1768
|
-
headers:
|
|
1768
|
+
headers: o
|
|
1769
1769
|
});
|
|
1770
1770
|
if (!a.ok)
|
|
1771
1771
|
throw new Error(`Channel Home download failed: ${a.status} ${a.statusText}`);
|
|
@@ -1789,11 +1789,11 @@ class Un {
|
|
|
1789
1789
|
);
|
|
1790
1790
|
const s = `${e}/sandbox/${encodeURIComponent(t)}/browser/open-url`, r = { ...this.customHeaders };
|
|
1791
1791
|
this.apiKey && (r["X-API-KEY"] = this.apiKey);
|
|
1792
|
-
const
|
|
1793
|
-
if (!
|
|
1794
|
-
throw new w(
|
|
1792
|
+
const i = await fetch(s, { method: "POST", headers: r });
|
|
1793
|
+
if (!i.ok)
|
|
1794
|
+
throw new w(i.status, i.statusText, await i.text().catch(() => {
|
|
1795
1795
|
}));
|
|
1796
|
-
const
|
|
1796
|
+
const o = await i.json(), a = o.data?.openURL ?? o.openURL;
|
|
1797
1797
|
if (!a)
|
|
1798
1798
|
throw new Error("Sandbox browser open-url response did not contain an openURL.");
|
|
1799
1799
|
return a;
|
|
@@ -1823,8 +1823,8 @@ class Un {
|
|
|
1823
1823
|
if (!r.ok)
|
|
1824
1824
|
throw new w(r.status, r.statusText, await r.text().catch(() => {
|
|
1825
1825
|
}));
|
|
1826
|
-
const
|
|
1827
|
-
return { entries:
|
|
1826
|
+
const i = await r.json(), o = i.data ?? i;
|
|
1827
|
+
return { entries: o.entries ?? [], truncated: o.truncated ?? !1 };
|
|
1828
1828
|
}
|
|
1829
1829
|
/**
|
|
1830
1830
|
* F-021 — 讀取 sandbox 檔案(`GET fs/file?path=[&offset_bytes&limit_bytes]`)。回應是 raw octet-stream,
|
|
@@ -1833,15 +1833,15 @@ class Un {
|
|
|
1833
1833
|
async sandboxFsRead(t, e, s) {
|
|
1834
1834
|
const r = new URL(`${this.deriveSandboxFsEndpoint(t)}/file`);
|
|
1835
1835
|
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
|
-
const
|
|
1837
|
-
if (!
|
|
1838
|
-
throw new w(
|
|
1836
|
+
const i = await fetch(r.toString(), { method: "GET", headers: this.apiHeaders() });
|
|
1837
|
+
if (!i.ok)
|
|
1838
|
+
throw new w(i.status, i.statusText, await i.text().catch(() => {
|
|
1839
1839
|
}));
|
|
1840
|
-
const
|
|
1840
|
+
const o = await i.blob(), a = i.headers.get("X-Total-Bytes");
|
|
1841
1841
|
return {
|
|
1842
|
-
content:
|
|
1843
|
-
totalBytes: a != null ? Number(a) :
|
|
1844
|
-
truncated:
|
|
1842
|
+
content: o,
|
|
1843
|
+
totalBytes: a != null ? Number(a) : o.size,
|
|
1844
|
+
truncated: i.headers.get("X-Truncated") === "true"
|
|
1845
1845
|
};
|
|
1846
1846
|
}
|
|
1847
1847
|
/**
|
|
@@ -1849,11 +1849,11 @@ class Un {
|
|
|
1849
1849
|
* 回應 `{ data: { bytesWritten } }`。
|
|
1850
1850
|
*/
|
|
1851
1851
|
async sandboxFsWrite(t, e, s, r) {
|
|
1852
|
-
const
|
|
1853
|
-
|
|
1854
|
-
const
|
|
1855
|
-
|
|
1856
|
-
const a = await fetch(
|
|
1852
|
+
const i = new URL(`${this.deriveSandboxFsEndpoint(t)}/file`);
|
|
1853
|
+
i.searchParams.set("path", e), r?.mode != null && i.searchParams.set("mode", String(r.mode)), r?.createOnly && i.searchParams.set("create_only", "true");
|
|
1854
|
+
const o = new FormData();
|
|
1855
|
+
o.append("file", s instanceof Blob ? s : new Blob([s]));
|
|
1856
|
+
const a = await fetch(i.toString(), { method: "PUT", headers: this.apiHeaders(), body: o });
|
|
1857
1857
|
if (!a.ok)
|
|
1858
1858
|
throw new w(a.status, a.statusText, await a.text().catch(() => {
|
|
1859
1859
|
}));
|
|
@@ -1862,13 +1862,13 @@ class Un {
|
|
|
1862
1862
|
}
|
|
1863
1863
|
/** F-021 Cycle 2 — `sandbox://` fs mutation shared request helper (throws `HttpError` on non-OK). */
|
|
1864
1864
|
async sandboxFsRequest(t, e, s, r) {
|
|
1865
|
-
const
|
|
1866
|
-
Object.entries(r).forEach(([a, c]) =>
|
|
1867
|
-
const
|
|
1868
|
-
if (!
|
|
1869
|
-
throw new w(
|
|
1865
|
+
const i = new URL(`${this.deriveSandboxFsEndpoint(t)}/${e}`);
|
|
1866
|
+
Object.entries(r).forEach(([a, c]) => i.searchParams.set(a, c));
|
|
1867
|
+
const o = await fetch(i.toString(), { method: s, headers: this.apiHeaders() });
|
|
1868
|
+
if (!o.ok)
|
|
1869
|
+
throw new w(o.status, o.statusText, await o.text().catch(() => {
|
|
1870
1870
|
}));
|
|
1871
|
-
return
|
|
1871
|
+
return o.json().catch(() => null);
|
|
1872
1872
|
}
|
|
1873
1873
|
/** F-021 — stat a sandbox path (`GET fs/stat?path=`). */
|
|
1874
1874
|
async sandboxFsStat(t, e) {
|
|
@@ -1878,14 +1878,14 @@ class Un {
|
|
|
1878
1878
|
if (!r.ok)
|
|
1879
1879
|
throw new w(r.status, r.statusText, await r.text().catch(() => {
|
|
1880
1880
|
}));
|
|
1881
|
-
const
|
|
1881
|
+
const i = await r.json(), o = i.data ?? i;
|
|
1882
1882
|
return {
|
|
1883
|
-
exists:
|
|
1884
|
-
isDir:
|
|
1885
|
-
sizeBytes:
|
|
1886
|
-
mtimeUnix:
|
|
1887
|
-
mode:
|
|
1888
|
-
etag:
|
|
1883
|
+
exists: o.exists ?? !1,
|
|
1884
|
+
isDir: o.isDir ?? !1,
|
|
1885
|
+
sizeBytes: o.sizeBytes ?? 0,
|
|
1886
|
+
mtimeUnix: o.mtimeUnix ?? 0,
|
|
1887
|
+
mode: o.mode ?? 0,
|
|
1888
|
+
etag: o.etag
|
|
1889
1889
|
};
|
|
1890
1890
|
}
|
|
1891
1891
|
/** F-021 — create a directory (`POST fs/mkdir?path=`). */
|
|
@@ -1902,15 +1902,15 @@ class Un {
|
|
|
1902
1902
|
}
|
|
1903
1903
|
/** F-021 — copy a path (`POST fs/copy?src=&dst=[&overwrite]`) → bytes copied. */
|
|
1904
1904
|
async sandboxFsCopy(t, e, s, r) {
|
|
1905
|
-
const
|
|
1906
|
-
r?.overwrite && (
|
|
1907
|
-
const
|
|
1908
|
-
return { bytesCopied: (
|
|
1905
|
+
const i = { src: e, dst: s };
|
|
1906
|
+
r?.overwrite && (i.overwrite = "true");
|
|
1907
|
+
const o = await this.sandboxFsRequest(t, "copy", "POST", i);
|
|
1908
|
+
return { bytesCopied: (o?.data ?? o)?.bytesCopied ?? 0 };
|
|
1909
1909
|
}
|
|
1910
1910
|
/** F-021 — move / rename a path (`POST fs/move?src=&dst=[&overwrite]`). */
|
|
1911
1911
|
async sandboxFsMove(t, e, s, r) {
|
|
1912
|
-
const
|
|
1913
|
-
r?.overwrite && (
|
|
1912
|
+
const i = { src: e, dst: s };
|
|
1913
|
+
r?.overwrite && (i.overwrite = "true"), await this.sandboxFsRequest(t, "move", "POST", i);
|
|
1914
1914
|
}
|
|
1915
1915
|
/**
|
|
1916
1916
|
* F-021 — watch a sandbox path for changes (`GET fs/watch?path=`, SSE). Each `event: change` frame is one
|
|
@@ -1920,26 +1920,26 @@ class Un {
|
|
|
1920
1920
|
sandboxFsWatch(t, e) {
|
|
1921
1921
|
const s = new URL(`${this.deriveSandboxFsEndpoint(t)}/watch`);
|
|
1922
1922
|
return s.searchParams.set("path", e), new y((r) => {
|
|
1923
|
-
const
|
|
1924
|
-
return
|
|
1923
|
+
const i = new AbortController();
|
|
1924
|
+
return Ce(s.toString(), {
|
|
1925
1925
|
headers: this.apiHeaders(),
|
|
1926
|
-
signal:
|
|
1926
|
+
signal: i.signal,
|
|
1927
1927
|
openWhenHidden: !0,
|
|
1928
|
-
onopen: async (
|
|
1929
|
-
if (!
|
|
1930
|
-
const a = await
|
|
1928
|
+
onopen: async (o) => {
|
|
1929
|
+
if (!o.ok) {
|
|
1930
|
+
const a = await o.text().catch(() => {
|
|
1931
1931
|
});
|
|
1932
|
-
r.error(new w(
|
|
1932
|
+
r.error(new w(o.status, o.statusText, a)), i.abort();
|
|
1933
1933
|
}
|
|
1934
1934
|
},
|
|
1935
|
-
onmessage: (
|
|
1936
|
-
|
|
1935
|
+
onmessage: (o) => {
|
|
1936
|
+
o.event === "change" && r.next(JSON.parse(o.data));
|
|
1937
1937
|
},
|
|
1938
1938
|
onclose: () => r.complete(),
|
|
1939
|
-
onerror: (
|
|
1940
|
-
throw r.error(
|
|
1939
|
+
onerror: (o) => {
|
|
1940
|
+
throw r.error(o), i.abort(), o;
|
|
1941
1941
|
}
|
|
1942
|
-
}), () =>
|
|
1942
|
+
}), () => i.abort();
|
|
1943
1943
|
});
|
|
1944
1944
|
}
|
|
1945
1945
|
/**
|
|
@@ -1958,32 +1958,178 @@ class Un {
|
|
|
1958
1958
|
return !t && this.endpoint && (t = this.endpoint.replace("/message/sse", "")), t ? t.replace(/\/+$/, "") : null;
|
|
1959
1959
|
}
|
|
1960
1960
|
}
|
|
1961
|
+
const hn = "", fn = /* @__PURE__ */ new Set(["", ".", ".."]);
|
|
1962
|
+
function I(n, t) {
|
|
1963
|
+
if (n === hn) {
|
|
1964
|
+
if (t?.allowRoot)
|
|
1965
|
+
return n;
|
|
1966
|
+
throw new Error(
|
|
1967
|
+
"SourceSet volume path must not be empty: the volume root is not a valid target for this operation."
|
|
1968
|
+
);
|
|
1969
|
+
}
|
|
1970
|
+
if (n.startsWith("/"))
|
|
1971
|
+
throw new Error(`SourceSet volume path must be relative, with no leading slash (the root is ""): "${n}".`);
|
|
1972
|
+
if (n.endsWith("/"))
|
|
1973
|
+
throw new Error(`SourceSet volume path must not end with a slash: "${n}".`);
|
|
1974
|
+
if (n.split("/").some((e) => fn.has(e)))
|
|
1975
|
+
throw new Error(`SourceSet volume path must not contain empty, "." or ".." segments: "${n}".`);
|
|
1976
|
+
return n;
|
|
1977
|
+
}
|
|
1978
|
+
const Xe = 1e3, pn = 1e4;
|
|
1979
|
+
function Se(n) {
|
|
1980
|
+
return Math.min(Math.max(1, Math.floor(n)), Xe);
|
|
1981
|
+
}
|
|
1982
|
+
class Hn {
|
|
1983
|
+
endpoint;
|
|
1984
|
+
apiKey;
|
|
1985
|
+
customHeaders;
|
|
1986
|
+
constructor(t) {
|
|
1987
|
+
this.endpoint = t.sourceSetEndpoint.replace(/\/+$/, ""), this.apiKey = t.apiKey, this.customHeaders = t.customHeaders;
|
|
1988
|
+
}
|
|
1989
|
+
/** Auth + caller headers for every request, including the multipart upload and the binary download. */
|
|
1990
|
+
headers() {
|
|
1991
|
+
const t = { ...this.customHeaders };
|
|
1992
|
+
return this.apiKey && (t["X-API-KEY"] = this.apiKey), t;
|
|
1993
|
+
}
|
|
1994
|
+
/** Issue one volume request, turning any non-2xx into {@link HttpError} (409 included, see R8). */
|
|
1995
|
+
async request(t, e, s, r) {
|
|
1996
|
+
const i = new URL(`${this.endpoint}/${t}`);
|
|
1997
|
+
Object.entries(s).forEach(([a, c]) => i.searchParams.set(a, c));
|
|
1998
|
+
const o = await fetch(i.toString(), { method: e, headers: this.headers(), body: r });
|
|
1999
|
+
if (!o.ok)
|
|
2000
|
+
throw new w(o.status, o.statusText, await o.text().catch(() => {
|
|
2001
|
+
}));
|
|
2002
|
+
return o;
|
|
2003
|
+
}
|
|
2004
|
+
/** One page of a directory (`GET volume/list?path=[&page&page_size]`). `path` may be the root `''`. */
|
|
2005
|
+
async list(t, e) {
|
|
2006
|
+
const s = { path: I(t, { allowRoot: !0 }) };
|
|
2007
|
+
e?.page != null && (s.page = String(e.page)), e?.pageSize != null && (s.page_size = String(Se(e.pageSize)));
|
|
2008
|
+
const i = await (await this.request("list", "GET", s)).json(), o = i.data ?? i;
|
|
2009
|
+
return {
|
|
2010
|
+
entries: o.entries ?? [],
|
|
2011
|
+
// Reported as `null` rather than invented. An earlier version synthesized
|
|
2012
|
+
// `{ total: entries.length }` here to keep `listAll` terminating, which worked — and made a
|
|
2013
|
+
// relay that omits `paging` report the first 1000 of 3000 files as the whole directory.
|
|
2014
|
+
paging: o.paging ?? i.paging ?? null
|
|
2015
|
+
};
|
|
2016
|
+
}
|
|
2017
|
+
/**
|
|
2018
|
+
* F-026 — every entry in a directory, paging until `paging.total` or the cap.
|
|
2019
|
+
*
|
|
2020
|
+
* A failed page rejects rather than returning what it managed to collect: handing back half a
|
|
2021
|
+
* directory that looks whole is the failure this exists to prevent.
|
|
2022
|
+
*/
|
|
2023
|
+
async listAll(t, e) {
|
|
2024
|
+
const s = Se(e?.pageSize ?? Xe), r = e?.maxEntries ?? pn, i = [];
|
|
2025
|
+
let o = 0, a = !0, c = 0;
|
|
2026
|
+
for (; ; ) {
|
|
2027
|
+
const u = await this.list(t, { page: c, pageSize: s }), d = u.paging;
|
|
2028
|
+
if (d && d.index !== c) {
|
|
2029
|
+
o = d.total, a = !1;
|
|
2030
|
+
break;
|
|
2031
|
+
}
|
|
2032
|
+
if (i.push(...u.entries), !d) {
|
|
2033
|
+
a = u.entries.length < s;
|
|
2034
|
+
break;
|
|
2035
|
+
}
|
|
2036
|
+
if (o = d.total, i.length >= o)
|
|
2037
|
+
break;
|
|
2038
|
+
if (i.length >= r || u.entries.length === 0) {
|
|
2039
|
+
a = !1;
|
|
2040
|
+
break;
|
|
2041
|
+
}
|
|
2042
|
+
c += 1;
|
|
2043
|
+
}
|
|
2044
|
+
return { entries: i, total: o, complete: a };
|
|
2045
|
+
}
|
|
2046
|
+
/** Stat a path (`GET volume/stat?path=`). A missing path is 200 with `exists: false`, not a 404. */
|
|
2047
|
+
async stat(t) {
|
|
2048
|
+
const s = await (await this.request("stat", "GET", { path: I(t) })).json(), r = s.data ?? s;
|
|
2049
|
+
return {
|
|
2050
|
+
exists: r.exists ?? !1,
|
|
2051
|
+
isDir: r.isDir ?? !1,
|
|
2052
|
+
sizeBytes: r.sizeBytes ?? 0,
|
|
2053
|
+
mtimeUnix: r.mtimeUnix ?? 0,
|
|
2054
|
+
mode: r.mode ?? 0,
|
|
2055
|
+
etag: r.etag
|
|
2056
|
+
};
|
|
2057
|
+
}
|
|
2058
|
+
/** Read a file (`GET volume/file?path=[&offset_bytes&limit_bytes]`) as raw bytes. */
|
|
2059
|
+
async read(t, e) {
|
|
2060
|
+
const s = { path: I(t) };
|
|
2061
|
+
e?.offsetBytes != null && (s.offset_bytes = String(e.offsetBytes)), e?.limitBytes != null && (s.limit_bytes = String(e.limitBytes));
|
|
2062
|
+
const r = await this.request("file", "GET", s), i = await r.blob(), o = r.headers.get("X-Total-Bytes");
|
|
2063
|
+
return {
|
|
2064
|
+
content: i,
|
|
2065
|
+
totalBytes: o != null ? Number(o) : i.size,
|
|
2066
|
+
truncated: r.headers.get("X-Truncated") === "true"
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
2070
|
+
* Write a file (`PUT volume/file?path=[&mode&create_only]`, `multipart/form-data` with a `file` field).
|
|
2071
|
+
* With `createOnly`, an existing path is a 409 rather than an overwrite.
|
|
2072
|
+
*/
|
|
2073
|
+
async write(t, e, s) {
|
|
2074
|
+
const r = { path: I(t) };
|
|
2075
|
+
s?.mode != null && (r.mode = String(s.mode)), s?.createOnly && (r.create_only = "true");
|
|
2076
|
+
const i = new FormData();
|
|
2077
|
+
i.append("file", e instanceof Blob ? e : new Blob([e]));
|
|
2078
|
+
const a = await (await this.request("file", "PUT", r, i)).json();
|
|
2079
|
+
return { bytesWritten: (a.data ?? a).bytesWritten ?? 0 };
|
|
2080
|
+
}
|
|
2081
|
+
/** Create a directory and any missing parents (`POST volume/mkdir?path=`). */
|
|
2082
|
+
async mkdir(t) {
|
|
2083
|
+
await this.request("mkdir", "POST", { path: I(t) });
|
|
2084
|
+
}
|
|
2085
|
+
/** Delete a file or empty directory (`DELETE volume/item?path=`). */
|
|
2086
|
+
async remove(t) {
|
|
2087
|
+
await this.request("item", "DELETE", { path: I(t) });
|
|
2088
|
+
}
|
|
2089
|
+
/** Recursively delete a directory (`DELETE volume/all?path=`). The volume root is not a valid target. */
|
|
2090
|
+
async removeAll(t) {
|
|
2091
|
+
await this.request("all", "DELETE", { path: I(t) });
|
|
2092
|
+
}
|
|
2093
|
+
/** Copy a file or directory tree (`POST volume/copy?src=&dst=[&overwrite]`). */
|
|
2094
|
+
async copy(t, e, s) {
|
|
2095
|
+
const r = this.copyMoveQuery(t, e, s), o = await (await this.request("copy", "POST", r)).json();
|
|
2096
|
+
return { bytesCopied: (o.data ?? o).bytesCopied ?? 0 };
|
|
2097
|
+
}
|
|
2098
|
+
/** Move or rename (`POST volume/move?src=&dst=[&overwrite]`) — also how the UI renames. */
|
|
2099
|
+
async move(t, e, s) {
|
|
2100
|
+
await this.request("move", "POST", this.copyMoveQuery(t, e, s));
|
|
2101
|
+
}
|
|
2102
|
+
copyMoveQuery(t, e, s) {
|
|
2103
|
+
const r = { src: I(t), dst: I(e) };
|
|
2104
|
+
return s?.overwrite && (r.overwrite = "true"), r;
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
1961
2107
|
const S = [];
|
|
1962
2108
|
for (let n = 0; n < 256; ++n)
|
|
1963
2109
|
S.push((n + 256).toString(16).slice(1));
|
|
1964
|
-
function
|
|
2110
|
+
function mn(n, t = 0) {
|
|
1965
2111
|
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();
|
|
1966
2112
|
}
|
|
1967
|
-
let
|
|
1968
|
-
const
|
|
1969
|
-
function
|
|
1970
|
-
if (!
|
|
2113
|
+
let Q;
|
|
2114
|
+
const gn = new Uint8Array(16);
|
|
2115
|
+
function bn() {
|
|
2116
|
+
if (!Q) {
|
|
1971
2117
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1972
2118
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1973
|
-
|
|
2119
|
+
Q = crypto.getRandomValues.bind(crypto);
|
|
1974
2120
|
}
|
|
1975
|
-
return
|
|
2121
|
+
return Q(gn);
|
|
1976
2122
|
}
|
|
1977
|
-
const
|
|
1978
|
-
function
|
|
2123
|
+
const vn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ye = { randomUUID: vn };
|
|
2124
|
+
function Sn(n, t, e) {
|
|
1979
2125
|
n = n || {};
|
|
1980
|
-
const s = n.random ?? n.rng?.() ??
|
|
2126
|
+
const s = n.random ?? n.rng?.() ?? bn();
|
|
1981
2127
|
if (s.length < 16)
|
|
1982
2128
|
throw new Error("Random bytes length must be >= 16");
|
|
1983
|
-
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128,
|
|
2129
|
+
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, mn(s);
|
|
1984
2130
|
}
|
|
1985
|
-
function
|
|
1986
|
-
return
|
|
2131
|
+
function Ye(n, t, e) {
|
|
2132
|
+
return ye.randomUUID && !n ? ye.randomUUID() : Sn(n);
|
|
1987
2133
|
}
|
|
1988
2134
|
class g {
|
|
1989
2135
|
messages = null;
|
|
@@ -2128,8 +2274,8 @@ class g {
|
|
|
2128
2274
|
if (e.parentToolUseId) return this;
|
|
2129
2275
|
const s = this.messages?.get(e.messageId);
|
|
2130
2276
|
if (this.isTerminalBot(s)) return this;
|
|
2131
|
-
const r = s?.type === "bot" ? s : void 0,
|
|
2132
|
-
return
|
|
2277
|
+
const r = s?.type === "bot" ? s : void 0, i = new Map(this.messages);
|
|
2278
|
+
return i.set(e.messageId, {
|
|
2133
2279
|
type: "bot",
|
|
2134
2280
|
eventType: l.MESSAGE_DELTA,
|
|
2135
2281
|
isTyping: !0,
|
|
@@ -2139,7 +2285,7 @@ class g {
|
|
|
2139
2285
|
time: /* @__PURE__ */ new Date(),
|
|
2140
2286
|
traceId: t.traceId ?? r?.traceId,
|
|
2141
2287
|
raw: r?.raw ?? ""
|
|
2142
|
-
}), new g({ messages:
|
|
2288
|
+
}), new g({ messages: i, pendingConsent: this.pendingConsent });
|
|
2143
2289
|
}
|
|
2144
2290
|
onMessageComplete(t) {
|
|
2145
2291
|
const e = t.fact.messageComplete.message;
|
|
@@ -2176,7 +2322,7 @@ class g {
|
|
|
2176
2322
|
if (e.parentToolUseId) return this;
|
|
2177
2323
|
const s = this.messages?.get(e.messageId);
|
|
2178
2324
|
if (this.isTerminalThinking(s)) return this;
|
|
2179
|
-
const r = s?.type === "thinking" ? s : void 0,
|
|
2325
|
+
const r = s?.type === "thinking" ? s : void 0, i = new Map(this.messages), o = {
|
|
2180
2326
|
type: "thinking",
|
|
2181
2327
|
messageId: e.messageId,
|
|
2182
2328
|
text: `${r?.text ?? ""}${e.text}`,
|
|
@@ -2184,12 +2330,12 @@ class g {
|
|
|
2184
2330
|
time: r?.time ?? /* @__PURE__ */ new Date(),
|
|
2185
2331
|
traceId: t.traceId ?? r?.traceId
|
|
2186
2332
|
};
|
|
2187
|
-
return
|
|
2333
|
+
return i.set(e.messageId, o), new g({ messages: i, pendingConsent: this.pendingConsent });
|
|
2188
2334
|
}
|
|
2189
2335
|
onThinkingComplete(t) {
|
|
2190
2336
|
const e = t.fact.messageThinkingComplete.message;
|
|
2191
2337
|
if (e.parentToolUseId) return this;
|
|
2192
|
-
const s = this.messages?.get(e.messageId), r = s?.type === "thinking" ? s : void 0,
|
|
2338
|
+
const s = this.messages?.get(e.messageId), r = s?.type === "thinking" ? s : void 0, i = new Map(this.messages), o = {
|
|
2193
2339
|
type: "thinking",
|
|
2194
2340
|
messageId: e.messageId,
|
|
2195
2341
|
// Self-sufficient (F-011): the complete frame carries the full reasoning, so a complete-only
|
|
@@ -2199,7 +2345,7 @@ class g {
|
|
|
2199
2345
|
time: r?.time ?? /* @__PURE__ */ new Date(),
|
|
2200
2346
|
traceId: t.traceId ?? r?.traceId
|
|
2201
2347
|
};
|
|
2202
|
-
return
|
|
2348
|
+
return i.set(e.messageId, o), new g({ messages: i, pendingConsent: this.pendingConsent });
|
|
2203
2349
|
}
|
|
2204
2350
|
onCanvasStart(t) {
|
|
2205
2351
|
const e = t.fact.messageCanvasStart.message;
|
|
@@ -2220,7 +2366,7 @@ class g {
|
|
|
2220
2366
|
if (e.parentToolUseId) return this;
|
|
2221
2367
|
const s = this.messages?.get(e.messageId);
|
|
2222
2368
|
if (this.isTerminalCanvas(s)) return this;
|
|
2223
|
-
const r = s?.type === "canvas" ? s : void 0,
|
|
2369
|
+
const r = s?.type === "canvas" ? s : void 0, i = new Map(this.messages), o = {
|
|
2224
2370
|
type: "canvas",
|
|
2225
2371
|
messageId: e.messageId,
|
|
2226
2372
|
// Deltas are incremental, exactly like a text delta.
|
|
@@ -2230,18 +2376,18 @@ class g {
|
|
|
2230
2376
|
time: r?.time ?? /* @__PURE__ */ new Date(),
|
|
2231
2377
|
traceId: t.traceId ?? r?.traceId
|
|
2232
2378
|
};
|
|
2233
|
-
return
|
|
2379
|
+
return i.set(e.messageId, o), new g({ messages: i, pendingConsent: this.pendingConsent });
|
|
2234
2380
|
}
|
|
2235
2381
|
onCanvasComplete(t) {
|
|
2236
2382
|
const e = t.fact.messageCanvasComplete.message;
|
|
2237
2383
|
if (e.parentToolUseId) return this;
|
|
2238
|
-
const s = e.template?.type ===
|
|
2384
|
+
const s = e.template?.type === Te.CANVAS ? e.template : void 0, r = s?.canvas?.html;
|
|
2239
2385
|
if (!r) {
|
|
2240
2386
|
if (!this.messages?.has(e.messageId)) return this;
|
|
2241
2387
|
const u = new Map(this.messages);
|
|
2242
2388
|
return u.delete(e.messageId), new g({ messages: u, pendingConsent: this.pendingConsent });
|
|
2243
2389
|
}
|
|
2244
|
-
const
|
|
2390
|
+
const i = this.messages?.get(e.messageId), o = i?.type === "canvas" ? i : void 0, a = new Map(this.messages), c = {
|
|
2245
2391
|
type: "canvas",
|
|
2246
2392
|
messageId: e.messageId,
|
|
2247
2393
|
// **Replace, never append.** This fragment is authoritative, and a rejoin replays only the
|
|
@@ -2249,15 +2395,15 @@ class g {
|
|
|
2249
2395
|
html: r,
|
|
2250
2396
|
title: s?.title,
|
|
2251
2397
|
isDrawing: !1,
|
|
2252
|
-
time:
|
|
2253
|
-
traceId: t.traceId ??
|
|
2398
|
+
time: o?.time ?? /* @__PURE__ */ new Date(),
|
|
2399
|
+
traceId: t.traceId ?? o?.traceId
|
|
2254
2400
|
};
|
|
2255
2401
|
return a.set(e.messageId, c), new g({ messages: a, pendingConsent: this.pendingConsent });
|
|
2256
2402
|
}
|
|
2257
2403
|
onMessageUser(t) {
|
|
2258
2404
|
const e = t.fact.messageUser;
|
|
2259
2405
|
if ((this.messages?.get(e.messageId) ?? (e.customMessageId ? this.messages?.get(e.customMessageId) : void 0))?.type === "user") return this;
|
|
2260
|
-
const r = new Map(this.messages),
|
|
2406
|
+
const r = new Map(this.messages), i = {
|
|
2261
2407
|
type: "user",
|
|
2262
2408
|
messageId: e.messageId,
|
|
2263
2409
|
text: e.text,
|
|
@@ -2267,10 +2413,10 @@ class g {
|
|
|
2267
2413
|
time: /* @__PURE__ */ new Date(),
|
|
2268
2414
|
traceId: t.traceId
|
|
2269
2415
|
};
|
|
2270
|
-
return r.set(e.messageId,
|
|
2416
|
+
return r.set(e.messageId, i), new g({ messages: r, pendingConsent: this.pendingConsent });
|
|
2271
2417
|
}
|
|
2272
2418
|
onMessageError(t) {
|
|
2273
|
-
const e =
|
|
2419
|
+
const e = Ye(), s = t.fact.runError.error, r = new Map(this.messages);
|
|
2274
2420
|
return r.set(e, {
|
|
2275
2421
|
type: "error",
|
|
2276
2422
|
eventType: l.ERROR,
|
|
@@ -2283,7 +2429,7 @@ class g {
|
|
|
2283
2429
|
onToolCallStart(t) {
|
|
2284
2430
|
const e = t.fact.toolCallStart, s = new Map(this.messages), r = `${e.processId}-${e.callSeq}`;
|
|
2285
2431
|
if (this.isTerminalToolCall(this.messages?.get(r))) return this;
|
|
2286
|
-
const
|
|
2432
|
+
const i = {
|
|
2287
2433
|
type: "tool-call",
|
|
2288
2434
|
eventType: l.TOOL_CALL_START,
|
|
2289
2435
|
messageId: r,
|
|
@@ -2299,23 +2445,23 @@ class g {
|
|
|
2299
2445
|
time: /* @__PURE__ */ new Date(),
|
|
2300
2446
|
traceId: t.traceId
|
|
2301
2447
|
};
|
|
2302
|
-
return s.set(r,
|
|
2448
|
+
return s.set(r, i), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2303
2449
|
}
|
|
2304
2450
|
onToolCallComplete(t) {
|
|
2305
|
-
const e = t.fact.toolCallComplete, s = new Map(this.messages), r = `${e.processId}-${e.callSeq}`,
|
|
2306
|
-
if (
|
|
2307
|
-
const
|
|
2308
|
-
...
|
|
2451
|
+
const e = t.fact.toolCallComplete, s = new Map(this.messages), r = `${e.processId}-${e.callSeq}`, i = s.get(r);
|
|
2452
|
+
if (i?.type === "tool-call") {
|
|
2453
|
+
const o = {
|
|
2454
|
+
...i,
|
|
2309
2455
|
eventType: l.TOOL_CALL_COMPLETE,
|
|
2310
2456
|
result: e.toolCallResult,
|
|
2311
2457
|
isError: e.isError,
|
|
2312
2458
|
sidecar: e.toolUseResultSidecar,
|
|
2313
2459
|
isComplete: !0,
|
|
2314
|
-
traceId: t.traceId ??
|
|
2460
|
+
traceId: t.traceId ?? i.traceId
|
|
2315
2461
|
};
|
|
2316
|
-
s.set(r,
|
|
2462
|
+
s.set(r, o);
|
|
2317
2463
|
} else {
|
|
2318
|
-
const
|
|
2464
|
+
const o = {
|
|
2319
2465
|
type: "tool-call",
|
|
2320
2466
|
eventType: l.TOOL_CALL_COMPLETE,
|
|
2321
2467
|
messageId: r,
|
|
@@ -2334,7 +2480,7 @@ class g {
|
|
|
2334
2480
|
time: /* @__PURE__ */ new Date(),
|
|
2335
2481
|
traceId: t.traceId
|
|
2336
2482
|
};
|
|
2337
|
-
s.set(r,
|
|
2483
|
+
s.set(r, o);
|
|
2338
2484
|
}
|
|
2339
2485
|
return new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2340
2486
|
}
|
|
@@ -2343,7 +2489,7 @@ class g {
|
|
|
2343
2489
|
return new g({ messages: this.messages, pendingConsent: e });
|
|
2344
2490
|
}
|
|
2345
2491
|
onSubagentStart(t) {
|
|
2346
|
-
const e = t.fact.subagentStart, s = new Map(this.messages), r = `subagent:${e.parentToolUseId}:start`,
|
|
2492
|
+
const e = t.fact.subagentStart, s = new Map(this.messages), r = `subagent:${e.parentToolUseId}:start`, i = {
|
|
2347
2493
|
type: "subagent",
|
|
2348
2494
|
messageId: r,
|
|
2349
2495
|
kind: "start",
|
|
@@ -2354,10 +2500,10 @@ class g {
|
|
|
2354
2500
|
time: /* @__PURE__ */ new Date(),
|
|
2355
2501
|
traceId: t.traceId
|
|
2356
2502
|
};
|
|
2357
|
-
return s.delete(r), s.set(r,
|
|
2503
|
+
return s.delete(r), s.set(r, i), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2358
2504
|
}
|
|
2359
2505
|
onSubagentComplete(t) {
|
|
2360
|
-
const e = t.fact.subagentComplete, s = new Map(this.messages), r = `subagent:${e.parentToolUseId}:complete`,
|
|
2506
|
+
const e = t.fact.subagentComplete, s = new Map(this.messages), r = `subagent:${e.parentToolUseId}:complete`, i = {
|
|
2361
2507
|
type: "subagent",
|
|
2362
2508
|
messageId: r,
|
|
2363
2509
|
kind: "complete",
|
|
@@ -2369,36 +2515,36 @@ class g {
|
|
|
2369
2515
|
time: /* @__PURE__ */ new Date(),
|
|
2370
2516
|
traceId: t.traceId
|
|
2371
2517
|
};
|
|
2372
|
-
return s.delete(r), s.set(r,
|
|
2518
|
+
return s.delete(r), s.set(r, i), new g({ messages: s, pendingConsent: this.pendingConsent });
|
|
2373
2519
|
}
|
|
2374
2520
|
}
|
|
2375
|
-
const
|
|
2376
|
-
function
|
|
2377
|
-
return n.toolsetName === "" &&
|
|
2521
|
+
const yn = /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate"]);
|
|
2522
|
+
function wn(n) {
|
|
2523
|
+
return n.toolsetName === "" && yn.has(n.toolName);
|
|
2378
2524
|
}
|
|
2379
|
-
function
|
|
2525
|
+
function we(n) {
|
|
2380
2526
|
return typeof n == "object" && n !== null ? n : void 0;
|
|
2381
2527
|
}
|
|
2382
|
-
function
|
|
2528
|
+
function T(n) {
|
|
2383
2529
|
return typeof n == "string" ? n : void 0;
|
|
2384
2530
|
}
|
|
2385
|
-
function
|
|
2531
|
+
function En(n) {
|
|
2386
2532
|
const t = [], e = /* @__PURE__ */ new Map();
|
|
2387
2533
|
for (const s of n) {
|
|
2388
|
-
const r = s.parameter ?? {},
|
|
2534
|
+
const r = s.parameter ?? {}, i = s.sidecar ?? {};
|
|
2389
2535
|
if (s.toolName === "TaskCreate") {
|
|
2390
|
-
const
|
|
2536
|
+
const o = we(i.task), a = T(o?.id);
|
|
2391
2537
|
if (!a) continue;
|
|
2392
2538
|
e.has(a) || t.push(a), e.set(a, {
|
|
2393
2539
|
id: a,
|
|
2394
|
-
subject:
|
|
2395
|
-
activeForm:
|
|
2396
|
-
description:
|
|
2540
|
+
subject: T(r.subject) || T(o?.subject) || "",
|
|
2541
|
+
activeForm: T(r.activeForm),
|
|
2542
|
+
description: T(r.description),
|
|
2397
2543
|
status: e.get(a)?.status ?? "pending"
|
|
2398
2544
|
// initial status = pending (keep existing on repeat)
|
|
2399
2545
|
});
|
|
2400
2546
|
} else if (s.toolName === "TaskUpdate") {
|
|
2401
|
-
const
|
|
2547
|
+
const o = we(i.statusChange), a = T(r.taskId) || T(i.taskId), c = T(o?.to) || T(r.status);
|
|
2402
2548
|
if (!a || !c) continue;
|
|
2403
2549
|
const u = e.get(a);
|
|
2404
2550
|
u && e.set(a, { ...u, status: c });
|
|
@@ -2406,71 +2552,71 @@ function gn(n) {
|
|
|
2406
2552
|
}
|
|
2407
2553
|
return t.map((s) => e.get(s));
|
|
2408
2554
|
}
|
|
2409
|
-
function
|
|
2555
|
+
function In(n) {
|
|
2410
2556
|
return n.toolsetName === "" && n.toolName === "Agent";
|
|
2411
2557
|
}
|
|
2412
|
-
function
|
|
2558
|
+
function Tn(n) {
|
|
2413
2559
|
return !!n;
|
|
2414
2560
|
}
|
|
2415
|
-
function
|
|
2561
|
+
function Ee(n) {
|
|
2416
2562
|
n.status !== "running" && (n.status = "running", n.summary = void 0);
|
|
2417
2563
|
}
|
|
2418
|
-
function
|
|
2419
|
-
const t = [], e = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), r = (
|
|
2420
|
-
for (const
|
|
2421
|
-
switch (
|
|
2564
|
+
function Cn(n) {
|
|
2565
|
+
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));
|
|
2566
|
+
for (const i of n)
|
|
2567
|
+
switch (i.kind) {
|
|
2422
2568
|
case "agentStart": {
|
|
2423
|
-
const
|
|
2424
|
-
|
|
2569
|
+
const o = r(i.toolUseId);
|
|
2570
|
+
i.description && !o.description && (o.description = i.description);
|
|
2425
2571
|
break;
|
|
2426
2572
|
}
|
|
2427
2573
|
case "subagentStart": {
|
|
2428
|
-
const
|
|
2429
|
-
|
|
2574
|
+
const o = r(i.parentToolUseId);
|
|
2575
|
+
o.agentId = i.agentId ?? o.agentId, o.subagentType = i.subagentType ?? o.subagentType, o.description = i.description ?? o.description, Ee(o);
|
|
2430
2576
|
break;
|
|
2431
2577
|
}
|
|
2432
2578
|
case "toolStart": {
|
|
2433
|
-
|
|
2434
|
-
toolsetName:
|
|
2435
|
-
toolName:
|
|
2436
|
-
parameter:
|
|
2437
|
-
reason:
|
|
2579
|
+
Ee(r(i.parentToolUseId)), s.get(i.parentToolUseId).set(i.toolUseId, {
|
|
2580
|
+
toolsetName: i.toolsetName,
|
|
2581
|
+
toolName: i.toolName,
|
|
2582
|
+
parameter: i.parameter ?? {},
|
|
2583
|
+
reason: i.reason,
|
|
2438
2584
|
status: "running"
|
|
2439
2585
|
});
|
|
2440
2586
|
break;
|
|
2441
2587
|
}
|
|
2442
2588
|
case "toolComplete": {
|
|
2443
|
-
const
|
|
2444
|
-
|
|
2589
|
+
const o = s.get(i.parentToolUseId)?.get(i.toolUseId);
|
|
2590
|
+
o && (o.status = i.isError ? "error" : "completed");
|
|
2445
2591
|
break;
|
|
2446
2592
|
}
|
|
2447
2593
|
case "subagentComplete": {
|
|
2448
|
-
const
|
|
2449
|
-
|
|
2594
|
+
const o = r(i.parentToolUseId);
|
|
2595
|
+
o.status = i.status, o.summary = i.summary;
|
|
2450
2596
|
break;
|
|
2451
2597
|
}
|
|
2452
2598
|
}
|
|
2453
|
-
return t.map((
|
|
2454
|
-
parentToolUseId:
|
|
2455
|
-
...e.get(
|
|
2456
|
-
tools: Array.from(s.get(
|
|
2599
|
+
return t.map((i) => ({
|
|
2600
|
+
parentToolUseId: i,
|
|
2601
|
+
...e.get(i),
|
|
2602
|
+
tools: Array.from(s.get(i).values())
|
|
2457
2603
|
}));
|
|
2458
2604
|
}
|
|
2459
|
-
function
|
|
2605
|
+
function xn(n) {
|
|
2460
2606
|
return typeof n == "string" ? n : void 0;
|
|
2461
2607
|
}
|
|
2462
|
-
function
|
|
2608
|
+
function An(n) {
|
|
2463
2609
|
const t = [];
|
|
2464
2610
|
for (const e of n) {
|
|
2465
|
-
if (e.type === "tool-call" &&
|
|
2611
|
+
if (e.type === "tool-call" && In(e)) {
|
|
2466
2612
|
t.push({
|
|
2467
2613
|
kind: "agentStart",
|
|
2468
2614
|
toolUseId: e.toolUseId ?? e.messageId,
|
|
2469
|
-
description:
|
|
2615
|
+
description: xn(e.parameter.description)
|
|
2470
2616
|
});
|
|
2471
2617
|
continue;
|
|
2472
2618
|
}
|
|
2473
|
-
if (e.type === "tool-call" &&
|
|
2619
|
+
if (e.type === "tool-call" && Tn(e.parentToolUseId)) {
|
|
2474
2620
|
const s = e.toolUseId ?? e.messageId;
|
|
2475
2621
|
t.push({
|
|
2476
2622
|
kind: "toolStart",
|
|
@@ -2507,37 +2653,37 @@ function wn(n) {
|
|
|
2507
2653
|
}
|
|
2508
2654
|
return t;
|
|
2509
2655
|
}
|
|
2510
|
-
function
|
|
2656
|
+
function On(n) {
|
|
2511
2657
|
const t = Array.from(n.messages?.values() ?? []).filter(
|
|
2512
|
-
(e) => e.type === "tool-call" && e.isComplete &&
|
|
2658
|
+
(e) => e.type === "tool-call" && e.isComplete && wn(e)
|
|
2513
2659
|
);
|
|
2514
|
-
return
|
|
2660
|
+
return En(t);
|
|
2515
2661
|
}
|
|
2516
|
-
function
|
|
2517
|
-
return
|
|
2662
|
+
function Pn(n) {
|
|
2663
|
+
return Cn(An(Array.from(n.messages?.values() ?? [])));
|
|
2518
2664
|
}
|
|
2519
|
-
function
|
|
2665
|
+
function _n(n, t) {
|
|
2520
2666
|
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2521
2667
|
const r = t[s];
|
|
2522
2668
|
return e.id === r.id && e.status === r.status && e.subject === r.subject && e.activeForm === r.activeForm && e.description === r.description;
|
|
2523
2669
|
});
|
|
2524
2670
|
}
|
|
2525
|
-
function
|
|
2671
|
+
function Mn(n, t) {
|
|
2526
2672
|
return n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2527
2673
|
const r = t[s];
|
|
2528
2674
|
return e.toolName === r.toolName && e.toolsetName === r.toolsetName && e.status === r.status && e.reason === r.reason;
|
|
2529
2675
|
});
|
|
2530
2676
|
}
|
|
2531
|
-
function
|
|
2677
|
+
function Ln(n, t) {
|
|
2532
2678
|
return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, s) => {
|
|
2533
2679
|
const r = t[s];
|
|
2534
|
-
return e.parentToolUseId === r.parentToolUseId && e.status === r.status && e.subagentType === r.subagentType && e.description === r.description && e.summary === r.summary &&
|
|
2680
|
+
return e.parentToolUseId === r.parentToolUseId && e.status === r.status && e.subagentType === r.subagentType && e.description === r.description && e.summary === r.summary && Mn(e.tools, r.tools);
|
|
2535
2681
|
});
|
|
2536
2682
|
}
|
|
2537
|
-
function
|
|
2538
|
-
const t = new
|
|
2539
|
-
return s.add(n.pipe(
|
|
2540
|
-
n.pipe(
|
|
2683
|
+
function Un(n) {
|
|
2684
|
+
const t = new C([]), e = new C([]), s = new $();
|
|
2685
|
+
return s.add(n.pipe(j(On), U(_n)).subscribe(t)), s.add(
|
|
2686
|
+
n.pipe(j(Pn), U(Ln)).subscribe(e)
|
|
2541
2687
|
), {
|
|
2542
2688
|
tasks$: t.asObservable(),
|
|
2543
2689
|
subagents$: e.asObservable(),
|
|
@@ -2546,18 +2692,18 @@ function An(n) {
|
|
|
2546
2692
|
teardown: () => s.unsubscribe()
|
|
2547
2693
|
};
|
|
2548
2694
|
}
|
|
2549
|
-
function
|
|
2695
|
+
function Ie(n) {
|
|
2550
2696
|
const t = /* @__PURE__ */ new Map();
|
|
2551
2697
|
for (const e of n) t.set(e.sandboxName, e);
|
|
2552
2698
|
return [...t.values()].sort(
|
|
2553
2699
|
(e, s) => (e.sandboxBlueprintName || e.sandboxName).localeCompare(s.sandboxBlueprintName || s.sandboxName)
|
|
2554
2700
|
);
|
|
2555
2701
|
}
|
|
2556
|
-
const
|
|
2557
|
-
function
|
|
2702
|
+
const Z = { kind: null, stopPhase: "idle" }, Nn = 1e4;
|
|
2703
|
+
function Rn(n, t) {
|
|
2558
2704
|
return n.kind === t.kind && n.stopPhase === t.stopPhase && n.requestId === t.requestId;
|
|
2559
2705
|
}
|
|
2560
|
-
class
|
|
2706
|
+
class K {
|
|
2561
2707
|
client;
|
|
2562
2708
|
customChannelId;
|
|
2563
2709
|
customMessageId;
|
|
@@ -2617,9 +2763,9 @@ class q {
|
|
|
2617
2763
|
throw new Error("client must be required");
|
|
2618
2764
|
if (!t.customChannelId)
|
|
2619
2765
|
throw new Error("customChannelId must be required");
|
|
2620
|
-
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.joinRunState = t.runState ?? "IDLE", this.isConnecting$ = new
|
|
2621
|
-
|
|
2622
|
-
), this.derivedStores =
|
|
2766
|
+
this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.joinRunState = t.runState ?? "IDLE", this.isConnecting$ = new C(!1), this.runStatusSubject = new C(Z), this.conversation$ = new C(t.conversation), this.channelTitleSubject = new C(t.channelTitle ?? null), this.promptSuggestionSubject = new C(null), this.sandboxPhaseSubject = new C("idle"), this.launchedSandboxesSubject = new C(
|
|
2767
|
+
Ie(t.launchedSandboxes ?? [])
|
|
2768
|
+
), this.derivedStores = Un(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(U()), this.promptSuggestion$ = this.promptSuggestionSubject.pipe(U()), this.sandboxPhase$ = this.sandboxPhaseSubject.pipe(U()), this.launchedSandboxes$ = this.launchedSandboxesSubject.pipe(U()), this.runStatus$ = this.runStatusSubject.pipe(U(Rn)), this.statesObserver = t.statesObserver;
|
|
2623
2769
|
}
|
|
2624
2770
|
/** Current Task Check List snapshot (F-013) — for framework-agnostic `getSnapshot()` bridging. */
|
|
2625
2771
|
getTasks() {
|
|
@@ -2667,7 +2813,7 @@ class q {
|
|
|
2667
2813
|
* launch whose name now appears (promoted to live). metadata (heartbeat-backed) is the sole authority.
|
|
2668
2814
|
*/
|
|
2669
2815
|
applyLaunchedSandboxes(t) {
|
|
2670
|
-
const e =
|
|
2816
|
+
const e = Ie(t);
|
|
2671
2817
|
this.pendingLaunches = this.pendingLaunches.filter((s) => !e.some((r) => r.sandboxName === s)), this.launchedSandboxesSubject.next(e);
|
|
2672
2818
|
}
|
|
2673
2819
|
/**
|
|
@@ -2701,15 +2847,15 @@ class q {
|
|
|
2701
2847
|
this.channelTitleSubject.next(t);
|
|
2702
2848
|
}
|
|
2703
2849
|
static create(t) {
|
|
2704
|
-
const e = new
|
|
2850
|
+
const e = new K(t);
|
|
2705
2851
|
return e.subscribe(), e;
|
|
2706
2852
|
}
|
|
2707
2853
|
static async reset(t, e, s, r) {
|
|
2708
|
-
const
|
|
2854
|
+
const i = new K(t);
|
|
2709
2855
|
try {
|
|
2710
|
-
return
|
|
2711
|
-
} catch (
|
|
2712
|
-
throw
|
|
2856
|
+
return i.subscribe(), r?.(i), await i.resetChannel(e, s), i;
|
|
2857
|
+
} catch (o) {
|
|
2858
|
+
throw i.close(), o;
|
|
2713
2859
|
}
|
|
2714
2860
|
}
|
|
2715
2861
|
/**
|
|
@@ -2720,15 +2866,15 @@ class q {
|
|
|
2720
2866
|
* "join an existing channel and wipe its history" data-loss bug.
|
|
2721
2867
|
*/
|
|
2722
2868
|
static async restore(t, e, s) {
|
|
2723
|
-
const r = new
|
|
2869
|
+
const r = new K(t);
|
|
2724
2870
|
try {
|
|
2725
2871
|
return r.subscribe(), s?.(r), await r.rejoinChannel(e), r;
|
|
2726
|
-
} catch (
|
|
2727
|
-
throw r.close(),
|
|
2872
|
+
} catch (i) {
|
|
2873
|
+
throw r.close(), i;
|
|
2728
2874
|
}
|
|
2729
2875
|
}
|
|
2730
2876
|
subscribe() {
|
|
2731
|
-
this.statesSubscription =
|
|
2877
|
+
this.statesSubscription = Qt([
|
|
2732
2878
|
this.isConnecting$,
|
|
2733
2879
|
this.conversation$,
|
|
2734
2880
|
this.derivedStores.tasks$,
|
|
@@ -2739,14 +2885,14 @@ class q {
|
|
|
2739
2885
|
this.launchedSandboxes$,
|
|
2740
2886
|
this.runStatus$
|
|
2741
2887
|
]).pipe(
|
|
2742
|
-
|
|
2888
|
+
j(
|
|
2743
2889
|
([
|
|
2744
2890
|
t,
|
|
2745
2891
|
e,
|
|
2746
2892
|
s,
|
|
2747
2893
|
r,
|
|
2748
|
-
o,
|
|
2749
2894
|
i,
|
|
2895
|
+
o,
|
|
2750
2896
|
a,
|
|
2751
2897
|
c,
|
|
2752
2898
|
u
|
|
@@ -2755,8 +2901,8 @@ class q {
|
|
|
2755
2901
|
conversation: e,
|
|
2756
2902
|
tasks: s,
|
|
2757
2903
|
subagents: r,
|
|
2758
|
-
channelTitle:
|
|
2759
|
-
promptSuggestion:
|
|
2904
|
+
channelTitle: i,
|
|
2905
|
+
promptSuggestion: o,
|
|
2760
2906
|
sandboxPhase: a,
|
|
2761
2907
|
launchedSandboxes: c,
|
|
2762
2908
|
runStatus: u
|
|
@@ -2811,12 +2957,12 @@ class q {
|
|
|
2811
2957
|
), r.eventType === l.PROMPT_SUGGESTION ? this.promptSuggestionSubject.next(
|
|
2812
2958
|
r.fact.promptSuggestion.suggestion
|
|
2813
2959
|
) : r.eventType === l.INIT && this.clearPromptSuggestion(), this.updateSandboxPhase(r.eventType), r.eventType === l.SANDBOX_LAUNCH && this.noteSandboxLaunch(r.fact.sandboxLaunch.sandboxName), this.currentUserMessageId && r.traceId) {
|
|
2814
|
-
const
|
|
2815
|
-
|
|
2816
|
-
...
|
|
2960
|
+
const i = new Map(this.conversation$.value.messages), o = i.get(this.currentUserMessageId);
|
|
2961
|
+
o && o.type === "user" && (i.set(this.currentUserMessageId, {
|
|
2962
|
+
...o,
|
|
2817
2963
|
traceId: r.traceId
|
|
2818
2964
|
}), this.conversation$.next(
|
|
2819
|
-
new g({ messages:
|
|
2965
|
+
new g({ messages: i, pendingConsent: this.conversation$.value.pendingConsent })
|
|
2820
2966
|
)), this.currentUserMessageId = void 0;
|
|
2821
2967
|
}
|
|
2822
2968
|
this.conversation$.next(this.conversation$.value.onMessage(r));
|
|
@@ -2836,7 +2982,7 @@ class q {
|
|
|
2836
2982
|
*/
|
|
2837
2983
|
settleRun() {
|
|
2838
2984
|
const t = this.runStatusSubject.value.stopPhase !== "idle";
|
|
2839
|
-
this.clearForceStopTimer(), this.isConnecting$.next(!1), this.runStatusSubject.next(
|
|
2985
|
+
this.clearForceStopTimer(), this.isConnecting$.next(!1), this.runStatusSubject.next(Z), this.currentUserMessageId = void 0, this.currentRun = void 0, t && this.conversation$.next(this.conversation$.value.settleInFlightMessages());
|
|
2840
2986
|
}
|
|
2841
2987
|
/** Record the backend run id from the first frame that carries one; later frames must not overwrite it. */
|
|
2842
2988
|
captureRequestId(t) {
|
|
@@ -2847,8 +2993,8 @@ class q {
|
|
|
2847
2993
|
this.forceStopTimer && (clearTimeout(this.forceStopTimer), this.forceStopTimer = void 0);
|
|
2848
2994
|
}
|
|
2849
2995
|
fetchSse(t, e, s) {
|
|
2850
|
-
return new Promise((r,
|
|
2851
|
-
this.isConnecting$.next(!0), this.runStatusSubject.next({ kind: t, stopPhase: "idle" }), this.currentRun = this.client.fetchSse(e, this.buildRunHandlers(s, r,
|
|
2996
|
+
return new Promise((r, i) => {
|
|
2997
|
+
this.isConnecting$.next(!0), this.runStatusSubject.next({ kind: t, stopPhase: "idle" }), this.currentRun = this.client.fetchSse(e, this.buildRunHandlers(s, r, i));
|
|
2852
2998
|
});
|
|
2853
2999
|
}
|
|
2854
3000
|
/**
|
|
@@ -2873,7 +3019,7 @@ class q {
|
|
|
2873
3019
|
return this.fetchSse(
|
|
2874
3020
|
"reset",
|
|
2875
3021
|
{
|
|
2876
|
-
action:
|
|
3022
|
+
action: D.RESET_CHANNEL,
|
|
2877
3023
|
customChannelId: this.customChannelId,
|
|
2878
3024
|
customMessageId: this.customMessageId,
|
|
2879
3025
|
text: t?.text || "",
|
|
@@ -2884,16 +3030,16 @@ class q {
|
|
|
2884
3030
|
}
|
|
2885
3031
|
sendMessage(t, e) {
|
|
2886
3032
|
const s = this.runStatusSubject.value.kind;
|
|
2887
|
-
if (s) return Promise.reject(new
|
|
3033
|
+
if (s) return Promise.reject(new ee(s));
|
|
2888
3034
|
const r = this.conversation$.value.pendingConsent;
|
|
2889
|
-
if (r) return Promise.reject(new
|
|
3035
|
+
if (r) return Promise.reject(new te(r.processId));
|
|
2890
3036
|
this.clearPromptSuggestion();
|
|
2891
|
-
const
|
|
2892
|
-
return this.currentUserMessageId =
|
|
3037
|
+
const i = t.text.trim(), o = t.customMessageId ?? Ye();
|
|
3038
|
+
return this.currentUserMessageId = o, this.lastSentMessageId = o, this.conversation$.next(
|
|
2893
3039
|
this.conversation$.value.pushMessage({
|
|
2894
3040
|
type: "user",
|
|
2895
|
-
messageId:
|
|
2896
|
-
text:
|
|
3041
|
+
messageId: o,
|
|
3042
|
+
text: i,
|
|
2897
3043
|
blobIds: t.blobIds,
|
|
2898
3044
|
filePreviewUrls: t.filePreviewUrls,
|
|
2899
3045
|
documentNames: t.documentNames,
|
|
@@ -2902,11 +3048,11 @@ class q {
|
|
|
2902
3048
|
), this.fetchSse(
|
|
2903
3049
|
"user",
|
|
2904
3050
|
{
|
|
2905
|
-
action:
|
|
3051
|
+
action: D.NONE,
|
|
2906
3052
|
customChannelId: this.customChannelId,
|
|
2907
|
-
customMessageId:
|
|
3053
|
+
customMessageId: o,
|
|
2908
3054
|
payload: this.resolvePayload(t?.payload),
|
|
2909
|
-
text:
|
|
3055
|
+
text: i,
|
|
2910
3056
|
blobIds: t?.blobIds
|
|
2911
3057
|
},
|
|
2912
3058
|
e
|
|
@@ -2917,7 +3063,7 @@ class q {
|
|
|
2917
3063
|
return this.conversation$.next(this.conversation$.value.clearPendingConsent()), this.fetchSse(
|
|
2918
3064
|
"user",
|
|
2919
3065
|
{
|
|
2920
|
-
action:
|
|
3066
|
+
action: D.RESPONSE_TOOL_CALL_CONSENT,
|
|
2921
3067
|
customChannelId: this.customChannelId,
|
|
2922
3068
|
customMessageId: this.lastSentMessageId ?? this.customMessageId,
|
|
2923
3069
|
payload: this.resolvePayload(s),
|
|
@@ -2925,8 +3071,8 @@ class q {
|
|
|
2925
3071
|
toolCallConsents: t
|
|
2926
3072
|
},
|
|
2927
3073
|
e
|
|
2928
|
-
).catch((
|
|
2929
|
-
throw r && this.conversation$.next(this.conversation$.value.restorePendingConsent(r)),
|
|
3074
|
+
).catch((i) => {
|
|
3075
|
+
throw r && this.conversation$.next(this.conversation$.value.restorePendingConsent(r)), i;
|
|
2930
3076
|
});
|
|
2931
3077
|
}
|
|
2932
3078
|
/**
|
|
@@ -2951,12 +3097,12 @@ class q {
|
|
|
2951
3097
|
*/
|
|
2952
3098
|
nudge(t, e) {
|
|
2953
3099
|
const s = this.runStatusSubject.value.kind;
|
|
2954
|
-
if (s) return Promise.reject(new
|
|
3100
|
+
if (s) return Promise.reject(new ee(s));
|
|
2955
3101
|
const r = this.conversation$.value.pendingConsent;
|
|
2956
|
-
return r ? Promise.reject(new
|
|
3102
|
+
return r ? Promise.reject(new te(r.processId)) : this.fetchSse(
|
|
2957
3103
|
"nudge",
|
|
2958
3104
|
{
|
|
2959
|
-
action:
|
|
3105
|
+
action: D.NUDGE,
|
|
2960
3106
|
customChannelId: this.customChannelId,
|
|
2961
3107
|
customMessageId: this.lastSentMessageId ?? this.customMessageId,
|
|
2962
3108
|
payload: this.resolvePayload(e),
|
|
@@ -3022,7 +3168,7 @@ class q {
|
|
|
3022
3168
|
this.forceStopTimer = void 0;
|
|
3023
3169
|
const t = this.runStatusSubject.value;
|
|
3024
3170
|
t.stopPhase === "stopping" && this.runStatusSubject.next({ ...t, stopPhase: "force-stoppable" });
|
|
3025
|
-
},
|
|
3171
|
+
}, Nn);
|
|
3026
3172
|
}
|
|
3027
3173
|
/**
|
|
3028
3174
|
* Cut the local SSE connection without telling the backend. This is *not* stop-generation (see
|
|
@@ -3033,49 +3179,54 @@ class q {
|
|
|
3033
3179
|
* stream disposed so no reconnect is attempted (F-023 AC10).
|
|
3034
3180
|
*/
|
|
3035
3181
|
abortConnection() {
|
|
3036
|
-
this.currentRun && (this.currentRun.unsubscribe(), this.clearForceStopTimer(), this.currentRun = void 0, this.isConnecting$.next(!1), this.runStatusSubject.next(
|
|
3182
|
+
this.currentRun && (this.currentRun.unsubscribe(), this.clearForceStopTimer(), this.currentRun = void 0, this.isConnecting$.next(!1), this.runStatusSubject.next(Z), this.currentUserMessageId = void 0, this.conversation$.next(this.conversation$.value.settleInFlightMessages()));
|
|
3037
3183
|
}
|
|
3038
3184
|
close() {
|
|
3039
3185
|
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();
|
|
3040
3186
|
}
|
|
3041
3187
|
}
|
|
3042
|
-
function
|
|
3188
|
+
function Fn(n) {
|
|
3043
3189
|
const t = /^sandbox:\/\/([^/]+)\/([^?#]+)(?:\?([^#]*))?/.exec(n.trim());
|
|
3044
3190
|
if (!t) return null;
|
|
3045
3191
|
const e = decodeURIComponent(t[1]), s = t[2], r = new URLSearchParams(t[3] ?? "");
|
|
3046
3192
|
if (s === "open-browser") return { kind: "open-browser", sandboxName: e };
|
|
3047
3193
|
if (s === "open-file") {
|
|
3048
|
-
const
|
|
3049
|
-
return
|
|
3194
|
+
const i = r.get("absolute_path");
|
|
3195
|
+
return i ? { kind: "open-file", sandboxName: e, absolutePath: i } : null;
|
|
3050
3196
|
}
|
|
3051
3197
|
return null;
|
|
3052
3198
|
}
|
|
3053
3199
|
export {
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3200
|
+
Dn as AsgardServiceClient,
|
|
3201
|
+
Hn as AsgardSourceSetClient,
|
|
3202
|
+
K as Channel,
|
|
3203
|
+
te as ChannelAwaitingConsentError,
|
|
3204
|
+
ee as ChannelBusyError,
|
|
3058
3205
|
g as Conversation,
|
|
3059
3206
|
l as EventType,
|
|
3060
|
-
|
|
3207
|
+
D as FetchSseAction,
|
|
3061
3208
|
w as HttpError,
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3209
|
+
Te as MessageTemplateType,
|
|
3210
|
+
pn as SOURCE_SET_DEFAULT_MAX_ENTRIES,
|
|
3211
|
+
Xe as SOURCE_SET_MAX_PAGE_SIZE,
|
|
3212
|
+
hn as SOURCE_SET_VOLUME_ROOT,
|
|
3213
|
+
Qe as ToolCallConsentResult,
|
|
3214
|
+
I as assertVolumePath,
|
|
3215
|
+
An as conversationToSubagentEvents,
|
|
3216
|
+
Un as createDerivedStores,
|
|
3217
|
+
Pn as deriveSubagents,
|
|
3218
|
+
On as deriveTasks,
|
|
3219
|
+
In as isAgentTool,
|
|
3220
|
+
$n as isChannelAwaitingConsentError,
|
|
3221
|
+
jn as isChannelBusyError,
|
|
3222
|
+
kn as isHttpError,
|
|
3223
|
+
Tn as isSubagentChildTool,
|
|
3224
|
+
wn as isTaskTool,
|
|
3225
|
+
Ie as reconcileLaunched,
|
|
3226
|
+
Cn as reduceSubagents,
|
|
3227
|
+
En as reduceTaskEvents,
|
|
3228
|
+
Fn as resolveSandboxUri,
|
|
3229
|
+
Ln as subagentsEqual,
|
|
3230
|
+
_n as tasksEqual
|
|
3080
3231
|
};
|
|
3081
3232
|
//# sourceMappingURL=index.mjs.map
|