@capytale/iframe-react 1.1.18 → 1.2.0
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 +5 -5
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +23 -5
- package/dist/index.es.js +586 -524
- package/package.json +52 -52
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as Q, jsxs as ft, Fragment as
|
|
2
|
-
import
|
|
3
|
-
const et = Symbol("Comlink.proxy"),
|
|
1
|
+
import { jsx as Q, jsxs as ft, Fragment as mt } from "react/jsx-runtime";
|
|
2
|
+
import M, { useCallback as w, useEffect as A, useMemo as U } from "react";
|
|
3
|
+
const et = Symbol("Comlink.proxy"), pt = Symbol("Comlink.endpoint"), Ct = Symbol("Comlink.releaseProxy"), q = Symbol("Comlink.finalizer"), I = Symbol("Comlink.thrown"), nt = (t) => typeof t == "object" && t !== null || typeof t == "function", vt = {
|
|
4
4
|
canHandle: (t) => nt(t) && t[et],
|
|
5
5
|
serialize(t) {
|
|
6
6
|
const { port1: e, port2: n } = new MessageChannel();
|
|
@@ -9,7 +9,7 @@ const et = Symbol("Comlink.proxy"), mt = Symbol("Comlink.endpoint"), yt = Symbol
|
|
|
9
9
|
deserialize(t) {
|
|
10
10
|
return t.start(), st(t);
|
|
11
11
|
}
|
|
12
|
-
},
|
|
12
|
+
}, yt = {
|
|
13
13
|
canHandle: (t) => nt(t) && I in t,
|
|
14
14
|
serialize({ value: t }) {
|
|
15
15
|
let e;
|
|
@@ -27,7 +27,7 @@ const et = Symbol("Comlink.proxy"), mt = Symbol("Comlink.endpoint"), yt = Symbol
|
|
|
27
27
|
}
|
|
28
28
|
}, ot = /* @__PURE__ */ new Map([
|
|
29
29
|
["proxy", vt],
|
|
30
|
-
["throw",
|
|
30
|
+
["throw", yt]
|
|
31
31
|
]);
|
|
32
32
|
function St(t, e) {
|
|
33
33
|
for (const n of t)
|
|
@@ -36,87 +36,87 @@ function St(t, e) {
|
|
|
36
36
|
return !1;
|
|
37
37
|
}
|
|
38
38
|
function _(t, e = globalThis, n = ["*"]) {
|
|
39
|
-
e.addEventListener("message", function
|
|
39
|
+
e.addEventListener("message", function s(o) {
|
|
40
40
|
if (!o || !o.data)
|
|
41
41
|
return;
|
|
42
42
|
if (!St(n, o.origin)) {
|
|
43
43
|
console.warn(`Invalid origin '${o.origin}' for comlink proxy`);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
const { id:
|
|
47
|
-
let
|
|
46
|
+
const { id: i, type: u, path: l } = Object.assign({ path: [] }, o.data), f = (o.data.argumentList || []).map(J);
|
|
47
|
+
let g;
|
|
48
48
|
try {
|
|
49
|
-
const
|
|
50
|
-
switch (
|
|
49
|
+
const d = l.slice(0, -1).reduce((C, y) => C[y], t), m = l.reduce((C, y) => C[y], t);
|
|
50
|
+
switch (u) {
|
|
51
51
|
case "GET":
|
|
52
|
-
|
|
52
|
+
g = m;
|
|
53
53
|
break;
|
|
54
54
|
case "SET":
|
|
55
|
-
|
|
55
|
+
d[l.slice(-1)[0]] = J(o.data.value), g = !0;
|
|
56
56
|
break;
|
|
57
57
|
case "APPLY":
|
|
58
|
-
|
|
58
|
+
g = m.apply(d, f);
|
|
59
59
|
break;
|
|
60
60
|
case "CONSTRUCT":
|
|
61
61
|
{
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const C = new m(...f);
|
|
63
|
+
g = lt(C);
|
|
64
64
|
}
|
|
65
65
|
break;
|
|
66
66
|
case "ENDPOINT":
|
|
67
67
|
{
|
|
68
|
-
const { port1:
|
|
69
|
-
_(t,
|
|
68
|
+
const { port1: C, port2: y } = new MessageChannel();
|
|
69
|
+
_(t, y), g = Ft(C, [C]);
|
|
70
70
|
}
|
|
71
71
|
break;
|
|
72
72
|
case "RELEASE":
|
|
73
|
-
|
|
73
|
+
g = void 0;
|
|
74
74
|
break;
|
|
75
75
|
default:
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
} catch (
|
|
79
|
-
|
|
78
|
+
} catch (d) {
|
|
79
|
+
g = { value: d, [I]: 0 };
|
|
80
80
|
}
|
|
81
|
-
Promise.resolve(
|
|
82
|
-
const [
|
|
83
|
-
e.postMessage(Object.assign(Object.assign({},
|
|
84
|
-
}).catch((
|
|
85
|
-
const [
|
|
81
|
+
Promise.resolve(g).catch((d) => ({ value: d, [I]: 0 })).then((d) => {
|
|
82
|
+
const [m, C] = O(d);
|
|
83
|
+
e.postMessage(Object.assign(Object.assign({}, m), { id: i }), C), u === "RELEASE" && (e.removeEventListener("message", s), rt(e), q in t && typeof t[q] == "function" && t[q]());
|
|
84
|
+
}).catch((d) => {
|
|
85
|
+
const [m, C] = O({
|
|
86
86
|
value: new TypeError("Unserializable return value"),
|
|
87
87
|
[I]: 0
|
|
88
88
|
});
|
|
89
|
-
e.postMessage(Object.assign(Object.assign({},
|
|
89
|
+
e.postMessage(Object.assign(Object.assign({}, m), { id: i }), C);
|
|
90
90
|
});
|
|
91
91
|
}), e.start && e.start();
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function At(t) {
|
|
94
94
|
return t.constructor.name === "MessagePort";
|
|
95
95
|
}
|
|
96
96
|
function rt(t) {
|
|
97
|
-
|
|
97
|
+
At(t) && t.close();
|
|
98
98
|
}
|
|
99
99
|
function st(t, e) {
|
|
100
100
|
const n = /* @__PURE__ */ new Map();
|
|
101
101
|
return t.addEventListener("message", function(o) {
|
|
102
|
-
const { data:
|
|
103
|
-
if (!
|
|
102
|
+
const { data: i } = o;
|
|
103
|
+
if (!i || !i.id)
|
|
104
104
|
return;
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
105
|
+
const u = n.get(i.id);
|
|
106
|
+
if (u)
|
|
107
107
|
try {
|
|
108
|
-
|
|
108
|
+
u(i);
|
|
109
109
|
} finally {
|
|
110
|
-
n.delete(
|
|
110
|
+
n.delete(i.id);
|
|
111
111
|
}
|
|
112
112
|
}), z(t, n, [], e);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function G(t) {
|
|
115
115
|
if (t)
|
|
116
116
|
throw new Error("Proxy has been released and is not useable");
|
|
117
117
|
}
|
|
118
118
|
function it(t) {
|
|
119
|
-
return
|
|
119
|
+
return x(t, /* @__PURE__ */ new Map(), {
|
|
120
120
|
type: "RELEASE"
|
|
121
121
|
}).then(() => {
|
|
122
122
|
rt(t);
|
|
@@ -130,65 +130,65 @@ function bt(t, e) {
|
|
|
130
130
|
const n = (j.get(e) || 0) + 1;
|
|
131
131
|
j.set(e, n), $ && $.register(t, e, t);
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function wt(t) {
|
|
134
134
|
$ && $.unregister(t);
|
|
135
135
|
}
|
|
136
|
-
function z(t, e, n = [],
|
|
136
|
+
function z(t, e, n = [], s = function() {
|
|
137
137
|
}) {
|
|
138
138
|
let o = !1;
|
|
139
|
-
const
|
|
140
|
-
get(
|
|
141
|
-
if (
|
|
139
|
+
const i = new Proxy(s, {
|
|
140
|
+
get(u, l) {
|
|
141
|
+
if (G(o), l === Ct)
|
|
142
142
|
return () => {
|
|
143
|
-
|
|
143
|
+
wt(i), it(t), e.clear(), o = !0;
|
|
144
144
|
};
|
|
145
|
-
if (
|
|
145
|
+
if (l === "then") {
|
|
146
146
|
if (n.length === 0)
|
|
147
|
-
return { then: () =>
|
|
148
|
-
const
|
|
147
|
+
return { then: () => i };
|
|
148
|
+
const f = x(t, e, {
|
|
149
149
|
type: "GET",
|
|
150
|
-
path: n.map((
|
|
151
|
-
}).then(
|
|
152
|
-
return
|
|
150
|
+
path: n.map((g) => g.toString())
|
|
151
|
+
}).then(J);
|
|
152
|
+
return f.then.bind(f);
|
|
153
153
|
}
|
|
154
|
-
return z(t, e, [...n,
|
|
154
|
+
return z(t, e, [...n, l]);
|
|
155
155
|
},
|
|
156
|
-
set(
|
|
157
|
-
|
|
158
|
-
const [
|
|
159
|
-
return
|
|
156
|
+
set(u, l, f) {
|
|
157
|
+
G(o);
|
|
158
|
+
const [g, d] = O(f);
|
|
159
|
+
return x(t, e, {
|
|
160
160
|
type: "SET",
|
|
161
|
-
path: [...n,
|
|
162
|
-
value:
|
|
163
|
-
},
|
|
161
|
+
path: [...n, l].map((m) => m.toString()),
|
|
162
|
+
value: g
|
|
163
|
+
}, d).then(J);
|
|
164
164
|
},
|
|
165
|
-
apply(
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
169
|
-
return
|
|
165
|
+
apply(u, l, f) {
|
|
166
|
+
G(o);
|
|
167
|
+
const g = n[n.length - 1];
|
|
168
|
+
if (g === pt)
|
|
169
|
+
return x(t, e, {
|
|
170
170
|
type: "ENDPOINT"
|
|
171
|
-
}).then(
|
|
172
|
-
if (
|
|
171
|
+
}).then(J);
|
|
172
|
+
if (g === "bind")
|
|
173
173
|
return z(t, e, n.slice(0, -1));
|
|
174
|
-
const [
|
|
175
|
-
return
|
|
174
|
+
const [d, m] = Y(f);
|
|
175
|
+
return x(t, e, {
|
|
176
176
|
type: "APPLY",
|
|
177
|
-
path: n.map((
|
|
178
|
-
argumentList:
|
|
179
|
-
},
|
|
177
|
+
path: n.map((C) => C.toString()),
|
|
178
|
+
argumentList: d
|
|
179
|
+
}, m).then(J);
|
|
180
180
|
},
|
|
181
|
-
construct(
|
|
182
|
-
|
|
183
|
-
const [
|
|
184
|
-
return
|
|
181
|
+
construct(u, l) {
|
|
182
|
+
G(o);
|
|
183
|
+
const [f, g] = Y(l);
|
|
184
|
+
return x(t, e, {
|
|
185
185
|
type: "CONSTRUCT",
|
|
186
|
-
path: n.map((
|
|
187
|
-
argumentList:
|
|
188
|
-
},
|
|
186
|
+
path: n.map((d) => d.toString()),
|
|
187
|
+
argumentList: f
|
|
188
|
+
}, g).then(J);
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
|
-
return bt(
|
|
191
|
+
return bt(i, t), i;
|
|
192
192
|
}
|
|
193
193
|
function ht(t) {
|
|
194
194
|
return Array.prototype.concat.apply([], t);
|
|
@@ -198,15 +198,15 @@ function Y(t) {
|
|
|
198
198
|
return [e.map((n) => n[0]), ht(e.map((n) => n[1]))];
|
|
199
199
|
}
|
|
200
200
|
const at = /* @__PURE__ */ new WeakMap();
|
|
201
|
-
function
|
|
201
|
+
function Ft(t, e) {
|
|
202
202
|
return at.set(t, e), t;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function lt(t) {
|
|
205
205
|
return Object.assign(t, { [et]: !0 });
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Rt(t, e = globalThis, n = "*") {
|
|
208
208
|
return {
|
|
209
|
-
postMessage: (
|
|
209
|
+
postMessage: (s, o) => t.postMessage(s, n, o),
|
|
210
210
|
addEventListener: e.addEventListener.bind(e),
|
|
211
211
|
removeEventListener: e.removeEventListener.bind(e)
|
|
212
212
|
};
|
|
@@ -214,12 +214,12 @@ function Ft(t, e = globalThis, n = "*") {
|
|
|
214
214
|
function O(t) {
|
|
215
215
|
for (const [e, n] of ot)
|
|
216
216
|
if (n.canHandle(t)) {
|
|
217
|
-
const [
|
|
217
|
+
const [s, o] = n.serialize(t);
|
|
218
218
|
return [
|
|
219
219
|
{
|
|
220
220
|
type: "HANDLER",
|
|
221
221
|
name: e,
|
|
222
|
-
value:
|
|
222
|
+
value: s
|
|
223
223
|
},
|
|
224
224
|
o
|
|
225
225
|
];
|
|
@@ -232,7 +232,7 @@ function O(t) {
|
|
|
232
232
|
at.get(t) || []
|
|
233
233
|
];
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function J(t) {
|
|
236
236
|
switch (t.type) {
|
|
237
237
|
case "HANDLER":
|
|
238
238
|
return ot.get(t.name).deserialize(t.value);
|
|
@@ -240,26 +240,26 @@ function x(t) {
|
|
|
240
240
|
return t.value;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function x(t, e, n, s) {
|
|
244
244
|
return new Promise((o) => {
|
|
245
|
-
const
|
|
246
|
-
e.set(
|
|
245
|
+
const i = Et();
|
|
246
|
+
e.set(i, o), t.start && t.start(), t.postMessage(Object.assign({ id: i }, n), s);
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
249
|
function Et() {
|
|
250
250
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function Jt(t, e) {
|
|
253
253
|
return t.length === 0 ? e : `[${t}] ${e}`;
|
|
254
254
|
}
|
|
255
|
-
function
|
|
256
|
-
let n = !1,
|
|
257
|
-
function
|
|
258
|
-
return
|
|
255
|
+
function Tt(t, e) {
|
|
256
|
+
let n = !1, s, o, i;
|
|
257
|
+
function u(d) {
|
|
258
|
+
return Jt(t, d);
|
|
259
259
|
}
|
|
260
|
-
let
|
|
260
|
+
let l, f = !1;
|
|
261
261
|
if (window.parent === window)
|
|
262
|
-
console.warn(
|
|
262
|
+
console.warn(u("Contract link is not supported in standalone mode")), l = {
|
|
263
263
|
ready() {
|
|
264
264
|
return Promise.resolve();
|
|
265
265
|
},
|
|
@@ -269,106 +269,106 @@ function kt(t, e) {
|
|
|
269
269
|
done() {
|
|
270
270
|
return Promise.resolve();
|
|
271
271
|
},
|
|
272
|
-
provide(
|
|
272
|
+
provide(d, m, C) {
|
|
273
273
|
return Promise.resolve();
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
276
|
else {
|
|
277
|
-
const
|
|
277
|
+
const d = Rt(window.parent, void 0, e);
|
|
278
278
|
_({
|
|
279
|
-
declare(
|
|
280
|
-
if (
|
|
281
|
-
|
|
279
|
+
declare(m) {
|
|
280
|
+
if (s == null) throw new Error(u("No handler for declare"));
|
|
281
|
+
s(m);
|
|
282
282
|
},
|
|
283
283
|
done() {
|
|
284
|
-
if (o == null) throw new Error(
|
|
284
|
+
if (o == null) throw new Error(u("No handler for done"));
|
|
285
285
|
o();
|
|
286
286
|
},
|
|
287
|
-
provide(
|
|
288
|
-
if (
|
|
289
|
-
|
|
287
|
+
provide(m, C, y) {
|
|
288
|
+
if (i == null) throw new Error(u("No handler for provide"));
|
|
289
|
+
i(m, C, y);
|
|
290
290
|
}
|
|
291
|
-
},
|
|
291
|
+
}, d), l = st(d), f = !0;
|
|
292
292
|
}
|
|
293
|
-
const
|
|
293
|
+
const g = () => {
|
|
294
294
|
if (!n) {
|
|
295
|
-
if (
|
|
296
|
-
n = !0,
|
|
295
|
+
if (s == null || o == null || i == null) return;
|
|
296
|
+
n = !0, l.ready();
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
299
|
return {
|
|
300
|
-
declare: (
|
|
301
|
-
done: () =>
|
|
302
|
-
provide: (
|
|
300
|
+
declare: (d) => l.declare(d),
|
|
301
|
+
done: () => l.done(),
|
|
302
|
+
provide: (d, m, C) => l.provide(d, m, lt(C)),
|
|
303
303
|
get name() {
|
|
304
304
|
return t;
|
|
305
305
|
},
|
|
306
306
|
get isReady() {
|
|
307
|
-
return
|
|
307
|
+
return f;
|
|
308
308
|
},
|
|
309
|
-
set onDeclare(
|
|
310
|
-
|
|
309
|
+
set onDeclare(d) {
|
|
310
|
+
s = d, g();
|
|
311
311
|
},
|
|
312
|
-
set onDone(
|
|
313
|
-
o =
|
|
312
|
+
set onDone(d) {
|
|
313
|
+
o = d, g();
|
|
314
314
|
},
|
|
315
|
-
set onProvide(
|
|
316
|
-
|
|
315
|
+
set onProvide(d) {
|
|
316
|
+
i = d, g();
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function kt(t) {
|
|
321
321
|
return function(e) {
|
|
322
|
-
let n,
|
|
323
|
-
function
|
|
324
|
-
if (
|
|
325
|
-
return
|
|
322
|
+
let n, s = !1, o = !1, i, u, l = !1, f = !1, g, d, m, C;
|
|
323
|
+
function y() {
|
|
324
|
+
if (i != null && i !== 0 && u != null)
|
|
325
|
+
return u;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
if (
|
|
329
|
-
return
|
|
327
|
+
function R(a) {
|
|
328
|
+
if (i != null && u != null && !(a > i))
|
|
329
|
+
return u;
|
|
330
330
|
}
|
|
331
331
|
function h() {
|
|
332
|
-
return
|
|
333
|
-
|
|
332
|
+
return m ?? (f ? m = Promise.resolve() : m = new Promise((a, c) => {
|
|
333
|
+
C = a;
|
|
334
334
|
}));
|
|
335
335
|
}
|
|
336
|
-
function
|
|
337
|
-
return
|
|
336
|
+
function T() {
|
|
337
|
+
return g === void 0 && (g = {
|
|
338
338
|
get name() {
|
|
339
339
|
return e;
|
|
340
340
|
},
|
|
341
341
|
get version() {
|
|
342
|
-
return
|
|
342
|
+
return i;
|
|
343
343
|
},
|
|
344
344
|
get i() {
|
|
345
|
-
return
|
|
345
|
+
return y();
|
|
346
346
|
},
|
|
347
|
-
v: (a) =>
|
|
348
|
-
}),
|
|
347
|
+
v: (a) => R(a)
|
|
348
|
+
}), g;
|
|
349
349
|
}
|
|
350
|
-
function
|
|
351
|
-
return
|
|
350
|
+
function L() {
|
|
351
|
+
return d === void 0 && (d = {
|
|
352
352
|
get name() {
|
|
353
353
|
return e;
|
|
354
354
|
},
|
|
355
355
|
get version() {
|
|
356
|
-
return
|
|
356
|
+
return f ? i : void 0;
|
|
357
357
|
},
|
|
358
358
|
get i() {
|
|
359
|
-
return
|
|
359
|
+
return f ? y() : void 0;
|
|
360
360
|
},
|
|
361
|
-
v: (a) =>
|
|
361
|
+
v: (a) => f ? R(a) : void 0,
|
|
362
362
|
get promise() {
|
|
363
|
-
return
|
|
364
|
-
if (
|
|
365
|
-
return
|
|
363
|
+
return i === 0 ? Promise.reject(t("Remote interface not provided")) : h().then(() => {
|
|
364
|
+
if (i === 0) throw new Error(t("Remote interface not provided"));
|
|
365
|
+
return T();
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
|
-
}),
|
|
368
|
+
}), d;
|
|
369
369
|
}
|
|
370
370
|
function E() {
|
|
371
|
-
|
|
371
|
+
C != null && (C(), C = void 0);
|
|
372
372
|
}
|
|
373
373
|
return {
|
|
374
374
|
get name() {
|
|
@@ -383,11 +383,11 @@ function Jt(t) {
|
|
|
383
383
|
n = a;
|
|
384
384
|
},
|
|
385
385
|
get localVersionSent() {
|
|
386
|
-
return
|
|
386
|
+
return s;
|
|
387
387
|
},
|
|
388
388
|
set localVersionSent(a) {
|
|
389
|
-
if (!a &&
|
|
390
|
-
|
|
389
|
+
if (!a && s) throw new Error(t("Local version already notified"));
|
|
390
|
+
s = a, a && n === 0 && (o = !0);
|
|
391
391
|
},
|
|
392
392
|
get localInterfaceSent() {
|
|
393
393
|
return o;
|
|
@@ -398,70 +398,70 @@ function Jt(t) {
|
|
|
398
398
|
o = a;
|
|
399
399
|
},
|
|
400
400
|
get remoteVersion() {
|
|
401
|
-
if (
|
|
402
|
-
return
|
|
401
|
+
if (i != null)
|
|
402
|
+
return i;
|
|
403
403
|
},
|
|
404
404
|
set remoteVersion(a) {
|
|
405
|
-
if (
|
|
406
|
-
|
|
405
|
+
if (i != null && i !== a) throw new Error(t("A different remote version is already set for " + e + `(${i} -> ${a})`));
|
|
406
|
+
i = a, a === 0 && (l = !0);
|
|
407
407
|
},
|
|
408
408
|
get remoteVersionReceived() {
|
|
409
|
-
return
|
|
409
|
+
return i != null;
|
|
410
410
|
},
|
|
411
411
|
setRemoteInterface: (a) => {
|
|
412
|
-
if (
|
|
413
|
-
if (
|
|
412
|
+
if (i == null) throw new Error(t("Remote version not set"));
|
|
413
|
+
if (i === 0) {
|
|
414
414
|
console.warn(t("Remote version is 0, remote interface is ignored."));
|
|
415
415
|
return;
|
|
416
416
|
}
|
|
417
|
-
if (
|
|
418
|
-
|
|
417
|
+
if (l) throw new Error(t("Interface already provided."));
|
|
418
|
+
u = a, l = !0;
|
|
419
419
|
},
|
|
420
420
|
get remoteInterfaceReceived() {
|
|
421
|
-
return
|
|
421
|
+
return l;
|
|
422
422
|
},
|
|
423
423
|
depGroup: void 0,
|
|
424
424
|
get isActivable() {
|
|
425
|
-
return
|
|
425
|
+
return l && o;
|
|
426
426
|
},
|
|
427
427
|
get isActivated() {
|
|
428
|
-
return
|
|
428
|
+
return f;
|
|
429
429
|
},
|
|
430
430
|
activate() {
|
|
431
|
-
if (!
|
|
432
|
-
if (!
|
|
431
|
+
if (!f) {
|
|
432
|
+
if (!l) throw new Error(t("Remote interface not provided."));
|
|
433
433
|
if (!o) throw new Error(t("Local interface not sent"));
|
|
434
|
-
|
|
434
|
+
f = !0, E();
|
|
435
435
|
}
|
|
436
436
|
},
|
|
437
|
-
getRemote: () =>
|
|
438
|
-
getLazyRemote: () =>
|
|
437
|
+
getRemote: () => T(),
|
|
438
|
+
getLazyRemote: () => L(),
|
|
439
439
|
get activationPromise() {
|
|
440
440
|
return h();
|
|
441
441
|
}
|
|
442
442
|
};
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
return function(e, n,
|
|
447
|
-
let
|
|
448
|
-
function
|
|
449
|
-
return e.every((
|
|
445
|
+
function xt(t) {
|
|
446
|
+
return function(e, n, s, o) {
|
|
447
|
+
let i = s, u = !1, l = !1;
|
|
448
|
+
function f() {
|
|
449
|
+
return e.every((g) => g.remoteVersionReceived && g.localVersionSent) && n.every((g) => g.remoteVersionReceived);
|
|
450
450
|
}
|
|
451
451
|
return {
|
|
452
452
|
get isDeclared() {
|
|
453
|
-
return
|
|
453
|
+
return l;
|
|
454
454
|
},
|
|
455
|
-
set isDeclared(
|
|
456
|
-
if (!
|
|
455
|
+
set isDeclared(g) {
|
|
456
|
+
if (!g && l)
|
|
457
457
|
throw new Error(t("Factory already declared"));
|
|
458
|
-
|
|
458
|
+
l = g;
|
|
459
459
|
},
|
|
460
460
|
get isReady() {
|
|
461
|
-
return
|
|
461
|
+
return f();
|
|
462
462
|
},
|
|
463
463
|
get isDone() {
|
|
464
|
-
return
|
|
464
|
+
return u;
|
|
465
465
|
},
|
|
466
466
|
get args() {
|
|
467
467
|
return e;
|
|
@@ -470,185 +470,185 @@ function Tt(t) {
|
|
|
470
470
|
return n;
|
|
471
471
|
},
|
|
472
472
|
invoke() {
|
|
473
|
-
if (
|
|
473
|
+
if (u)
|
|
474
474
|
throw new Error(t("Factory already invoked"));
|
|
475
|
-
if (!
|
|
475
|
+
if (!f())
|
|
476
476
|
throw new Error(t("Factory is not ready"));
|
|
477
|
+
let g;
|
|
478
|
+
o ? g = e.map((C) => C.getRemote()) : g = e[0].getRemote();
|
|
477
479
|
let d;
|
|
478
|
-
|
|
479
|
-
let u;
|
|
480
|
-
const p = n.length > 0 ? n.map((y) => y.getRemote()) : null;
|
|
480
|
+
const m = n.length > 0 ? n.map((C) => C.getRemote()) : null;
|
|
481
481
|
try {
|
|
482
|
-
|
|
483
|
-
} catch (
|
|
484
|
-
throw new Error(t("error in factory:"), { cause:
|
|
482
|
+
d = m == null ? i(g) : i(g, m);
|
|
483
|
+
} catch (C) {
|
|
484
|
+
throw new Error(t("error in factory:"), { cause: C });
|
|
485
485
|
}
|
|
486
|
-
if (o || (
|
|
486
|
+
if (o || (d = [d]), d.length != e.length)
|
|
487
487
|
throw new Error(t("Invalid factory result"));
|
|
488
|
-
return
|
|
488
|
+
return u = !0, i = null, d;
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
|
-
function
|
|
494
|
-
return function(e, n,
|
|
495
|
-
let
|
|
496
|
-
function
|
|
497
|
-
return e.every((
|
|
493
|
+
function Lt(t) {
|
|
494
|
+
return function(e, n, s, o) {
|
|
495
|
+
let i = n, u = !1;
|
|
496
|
+
function l() {
|
|
497
|
+
return e.every((f) => f.isActivated);
|
|
498
498
|
}
|
|
499
499
|
return {
|
|
500
500
|
get isReady() {
|
|
501
|
-
return
|
|
501
|
+
return l();
|
|
502
502
|
},
|
|
503
503
|
get isDone() {
|
|
504
|
-
return
|
|
504
|
+
return u;
|
|
505
505
|
},
|
|
506
506
|
get args() {
|
|
507
507
|
return e;
|
|
508
508
|
},
|
|
509
509
|
invoke() {
|
|
510
|
-
if (
|
|
511
|
-
const
|
|
512
|
-
throw o?.[1](
|
|
510
|
+
if (u || !l()) {
|
|
511
|
+
const d = new Error(t(u ? "callback already invoked" : "callback parameters are not ready"));
|
|
512
|
+
throw o?.[1](d), d;
|
|
513
513
|
}
|
|
514
|
-
const
|
|
515
|
-
let
|
|
514
|
+
const f = s ? e.map((d) => d.getRemote()) : e[0].getRemote();
|
|
515
|
+
let g;
|
|
516
516
|
try {
|
|
517
|
-
|
|
518
|
-
} catch (
|
|
519
|
-
o == null ? console.error(t("error in callback:"),
|
|
517
|
+
g = i(f);
|
|
518
|
+
} catch (d) {
|
|
519
|
+
o == null ? console.error(t("error in callback:"), d) : o[1](d);
|
|
520
520
|
} finally {
|
|
521
|
-
|
|
521
|
+
u = !0;
|
|
522
522
|
}
|
|
523
|
-
o?.[0](
|
|
523
|
+
o?.[0](g);
|
|
524
524
|
}
|
|
525
525
|
};
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
|
-
function
|
|
528
|
+
function ct(t, e) {
|
|
529
529
|
return t == null || t.length === 0 ? e : `[${t}] ${e}`;
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function Mt(t) {
|
|
532
532
|
function e(a) {
|
|
533
|
-
return
|
|
533
|
+
return ct(t.name, a);
|
|
534
534
|
}
|
|
535
|
-
const n =
|
|
536
|
-
let
|
|
537
|
-
const
|
|
538
|
-
function
|
|
539
|
-
let
|
|
540
|
-
return
|
|
535
|
+
const n = Lt(e), s = kt(e), o = xt(e), i = {}, u = [];
|
|
536
|
+
let l = [], f;
|
|
537
|
+
const g = () => (f == null ? f = 0 : f++, f);
|
|
538
|
+
function d(a) {
|
|
539
|
+
let c = i[a];
|
|
540
|
+
return c == null && (c = s(a), c.localVersion == null && (h && (c.localVersion = 0), T && (c.localVersionSent = !0)), c.remoteVersion == null && L && (c.remoteVersion = 0), i[a] = c), c;
|
|
541
541
|
}
|
|
542
|
-
function
|
|
543
|
-
return a.map(
|
|
542
|
+
function m(a) {
|
|
543
|
+
return a.map(d);
|
|
544
544
|
}
|
|
545
|
-
function
|
|
546
|
-
const
|
|
545
|
+
function C(...a) {
|
|
546
|
+
const c = g(), p = Array(c).fill(!1);
|
|
547
547
|
a.forEach((v) => {
|
|
548
548
|
v.forEach((S) => {
|
|
549
|
-
S.depGroup != null && (
|
|
549
|
+
S.depGroup != null && (p[S.depGroup] = !0), S.depGroup = c;
|
|
550
550
|
});
|
|
551
|
-
}), Object.values(
|
|
552
|
-
v.depGroup != null && v.depGroup !==
|
|
551
|
+
}), Object.values(i).forEach((v) => {
|
|
552
|
+
v.depGroup != null && v.depGroup !== c && p[v.depGroup] && (v.depGroup = c);
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
555
|
t.onDeclare = (a) => {
|
|
556
|
-
const
|
|
557
|
-
for (let
|
|
558
|
-
a[
|
|
559
|
-
|
|
556
|
+
const c = m(a.map((p) => p.name));
|
|
557
|
+
for (let p = 0; p < a.length; p++)
|
|
558
|
+
a[p].version != null && (c[p].remoteVersion = a[p].version);
|
|
559
|
+
C(c), E();
|
|
560
560
|
}, t.onDone = () => {
|
|
561
|
-
|
|
561
|
+
L || (L = !0, Object.values(i).forEach((a) => {
|
|
562
562
|
a.remoteVersion == null && (a.remoteVersion = 0);
|
|
563
563
|
}), E());
|
|
564
|
-
}, t.onProvide = (a,
|
|
565
|
-
let v =
|
|
564
|
+
}, t.onProvide = (a, c, p) => {
|
|
565
|
+
let v = i[a];
|
|
566
566
|
if (v == null)
|
|
567
567
|
throw new Error(e(`Contract not declared : ${a}`));
|
|
568
|
-
if (v.remoteVersion !=
|
|
569
|
-
throw new Error(e(`Remote declared version ${v.remoteVersion} of contract "${a}" but provided version ${
|
|
568
|
+
if (v.remoteVersion != c)
|
|
569
|
+
throw new Error(e(`Remote declared version ${v.remoteVersion} of contract "${a}" but provided version ${c}.`));
|
|
570
570
|
if (v.remoteInterfaceReceived)
|
|
571
571
|
throw new Error(e(`Remote contract "${a}" is already provided.`));
|
|
572
|
-
v.setRemoteInterface(
|
|
572
|
+
v.setRemoteInterface(p), E();
|
|
573
573
|
};
|
|
574
|
-
let
|
|
574
|
+
let y = !1, R = !1, h = !1, T = !1, L = !1;
|
|
575
575
|
async function E() {
|
|
576
|
-
if (
|
|
577
|
-
for (
|
|
578
|
-
if (
|
|
579
|
-
const a =
|
|
576
|
+
if (R = !0, !y) {
|
|
577
|
+
for (y = !0; R; ) {
|
|
578
|
+
if (R = !1, t.isReady) {
|
|
579
|
+
const a = u.filter((c) => !c.isDeclared);
|
|
580
580
|
if (a.length > 0)
|
|
581
|
-
for (const
|
|
582
|
-
const
|
|
583
|
-
|
|
581
|
+
for (const c of a) {
|
|
582
|
+
const p = Array(c.args.length + c.deps.length);
|
|
583
|
+
c.args.forEach((v, S) => p[S] = v), c.deps.forEach((v, S) => p[S + c.args.length] = v), await t.declare(p.map((v) => ({ name: v.name, version: v.localVersion }))), p.forEach((v) => {
|
|
584
584
|
v.localVersion != null && (v.localVersionSent = !0);
|
|
585
|
-
}),
|
|
585
|
+
}), c.isDeclared = !0;
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
|
-
if (t.isReady && h &&
|
|
589
|
-
const a = Object.values(
|
|
588
|
+
if (t.isReady && h && u.every((a) => a.isDeclared)) {
|
|
589
|
+
const a = Object.values(i).filter((c) => !c.localVersionSent && c.localVersion != null);
|
|
590
590
|
if (a.length > 0)
|
|
591
|
-
for (const
|
|
592
|
-
await t.declare([{ name:
|
|
593
|
-
|
|
591
|
+
for (const c of a)
|
|
592
|
+
await t.declare([{ name: c.name, version: c.localVersion }]), c.localVersionSent = !0;
|
|
593
|
+
T || (T = !0, await t.done());
|
|
594
594
|
}
|
|
595
595
|
if (t.isReady) {
|
|
596
|
-
const a =
|
|
596
|
+
const a = u.filter((c) => !c.isDone && c.isReady);
|
|
597
597
|
if (a.length > 0)
|
|
598
|
-
for (const
|
|
599
|
-
const
|
|
600
|
-
for (let v = 0; v <
|
|
601
|
-
const S =
|
|
602
|
-
await t.provide(S.name, S.localVersion,
|
|
598
|
+
for (const c of a) {
|
|
599
|
+
const p = c.invoke();
|
|
600
|
+
for (let v = 0; v < c.args.length; v++) {
|
|
601
|
+
const S = c.args[v];
|
|
602
|
+
await t.provide(S.name, S.localVersion, p[v]), S.localInterfaceSent = !0;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
|
-
if (
|
|
607
|
-
const a = Array(
|
|
608
|
-
for (const
|
|
609
|
-
const
|
|
610
|
-
|
|
606
|
+
if (f != null) {
|
|
607
|
+
const a = Array(f + 1).fill(null);
|
|
608
|
+
for (const c in i) {
|
|
609
|
+
const p = i[c];
|
|
610
|
+
p.depGroup != null && (p.isActivable ? a[p.depGroup] == null && !p.isActivated && (a[p.depGroup] = !0) : a[p.depGroup] = !1);
|
|
611
611
|
}
|
|
612
|
-
if (a.some((
|
|
613
|
-
for (const
|
|
614
|
-
const
|
|
615
|
-
|
|
612
|
+
if (a.some((c) => c === !0))
|
|
613
|
+
for (const c in i) {
|
|
614
|
+
const p = i[c];
|
|
615
|
+
p.depGroup != null && a[p.depGroup] && p.activate();
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
if (t.isReady) {
|
|
619
|
-
const a =
|
|
620
|
-
|
|
621
|
-
const
|
|
622
|
-
for (const
|
|
623
|
-
!
|
|
624
|
-
|
|
619
|
+
const a = l;
|
|
620
|
+
l = [];
|
|
621
|
+
const c = [];
|
|
622
|
+
for (const p of a)
|
|
623
|
+
!p.isDone && p.isReady ? p.invoke() : c.push(p);
|
|
624
|
+
c.push(...l), l = c;
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
-
|
|
627
|
+
y = !1;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
630
|
return {
|
|
631
631
|
get(a) {
|
|
632
|
-
return
|
|
632
|
+
return d(a);
|
|
633
633
|
},
|
|
634
|
-
declareFactory: (a,
|
|
634
|
+
declareFactory: (a, c, p, v) => {
|
|
635
635
|
if (h) throw new Error(e("Cannot declare a factory after done has been set to true."));
|
|
636
|
-
const S =
|
|
636
|
+
const S = m(a.map((F) => F.name));
|
|
637
637
|
{
|
|
638
|
-
const
|
|
639
|
-
if (
|
|
640
|
-
throw new Error(e("Cannot declare a factory for already implemented contracts : " +
|
|
638
|
+
const F = S.filter((N) => N.localVersion != null);
|
|
639
|
+
if (F.length > 0)
|
|
640
|
+
throw new Error(e("Cannot declare a factory for already implemented contracts : " + F.map((N) => N.name).join(", ")));
|
|
641
641
|
}
|
|
642
|
-
for (let
|
|
643
|
-
S[
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
const gt = o(S,
|
|
647
|
-
|
|
642
|
+
for (let F = 0; F < a.length; F++)
|
|
643
|
+
S[F].localVersion = a[F].version;
|
|
644
|
+
const k = m(c);
|
|
645
|
+
C(S, k);
|
|
646
|
+
const gt = o(S, k, p, v);
|
|
647
|
+
u.push(gt), E();
|
|
648
648
|
},
|
|
649
|
-
declareCallback(a,
|
|
650
|
-
const S =
|
|
651
|
-
!
|
|
649
|
+
declareCallback(a, c, p, v) {
|
|
650
|
+
const S = m(a), k = n(S, c, p, v);
|
|
651
|
+
!y && l.length === 0 && k.isReady ? k.invoke() : (l.push(k), E());
|
|
652
652
|
},
|
|
653
653
|
get done() {
|
|
654
654
|
return h;
|
|
@@ -657,102 +657,102 @@ function Gt(t) {
|
|
|
657
657
|
if (h) {
|
|
658
658
|
if (!a) throw new Error(e("Cannot set done to false after it has been set to true."));
|
|
659
659
|
} else
|
|
660
|
-
a && (h = !0, Object.values(
|
|
661
|
-
|
|
660
|
+
a && (h = !0, Object.values(i).forEach((c) => {
|
|
661
|
+
c.localVersion == null && (c.localVersion = 0);
|
|
662
662
|
}), E());
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
|
-
const
|
|
667
|
-
function
|
|
668
|
-
const [e, n,
|
|
669
|
-
if (n == null ||
|
|
666
|
+
const Gt = /^\d+$/;
|
|
667
|
+
function Dt(t) {
|
|
668
|
+
const [e, n, s] = t.split(":", 3);
|
|
669
|
+
if (n == null || s != null || !Gt.test(n)) return null;
|
|
670
670
|
const o = parseInt(n);
|
|
671
671
|
return isNaN(o) || o === 0 ? null : { name: e, version: o };
|
|
672
672
|
}
|
|
673
|
-
function
|
|
674
|
-
const e =
|
|
675
|
-
function n(
|
|
676
|
-
return
|
|
673
|
+
function Pt(t) {
|
|
674
|
+
const e = Mt(t);
|
|
675
|
+
function n(s) {
|
|
676
|
+
return ct(t.name, s);
|
|
677
677
|
}
|
|
678
678
|
return {
|
|
679
|
-
plug(
|
|
679
|
+
plug(s, o, i = void 0) {
|
|
680
680
|
if (e.done) throw new Error(n("Cannot plug after plugsDone."));
|
|
681
|
-
|
|
682
|
-
let
|
|
683
|
-
Array.isArray(
|
|
684
|
-
const
|
|
685
|
-
const
|
|
686
|
-
if (
|
|
687
|
-
throw new Error(n("Invalid contract id : " +
|
|
688
|
-
return
|
|
681
|
+
i == null && (i = o, o = []);
|
|
682
|
+
let u = !0;
|
|
683
|
+
Array.isArray(s) || (s = [s], u = !1);
|
|
684
|
+
const l = s.map((f) => {
|
|
685
|
+
const g = Dt(f);
|
|
686
|
+
if (g == null)
|
|
687
|
+
throw new Error(n("Invalid contract id : " + f));
|
|
688
|
+
return g;
|
|
689
689
|
});
|
|
690
|
-
e.declareFactory(
|
|
690
|
+
e.declareFactory(l, o, i, u);
|
|
691
691
|
},
|
|
692
692
|
plugsDone() {
|
|
693
693
|
e.done = !0;
|
|
694
694
|
},
|
|
695
|
-
use(
|
|
696
|
-
let
|
|
697
|
-
Array.isArray(
|
|
695
|
+
use(s, o) {
|
|
696
|
+
let i = !0;
|
|
697
|
+
Array.isArray(s) || (s = [s], i = !1), e.declareCallback(s, o, i);
|
|
698
698
|
},
|
|
699
|
-
exec(
|
|
700
|
-
let
|
|
701
|
-
return Array.isArray(
|
|
702
|
-
e.declareCallback(
|
|
699
|
+
exec(s, o) {
|
|
700
|
+
let i = !0;
|
|
701
|
+
return Array.isArray(s) || (s = [s], i = !1), new Promise((...u) => {
|
|
702
|
+
e.declareCallback(s, o, i, u);
|
|
703
703
|
});
|
|
704
704
|
},
|
|
705
|
-
get(
|
|
706
|
-
return
|
|
705
|
+
get(s) {
|
|
706
|
+
return s.map((o) => e.get(o).getLazyRemote());
|
|
707
707
|
}
|
|
708
708
|
};
|
|
709
709
|
}
|
|
710
710
|
const ut = "app-agent";
|
|
711
|
-
let
|
|
712
|
-
function
|
|
713
|
-
return
|
|
711
|
+
let W;
|
|
712
|
+
function Vt(t) {
|
|
713
|
+
return W != null || (W = Pt(Tt(ut, t))), W;
|
|
714
714
|
}
|
|
715
715
|
console.log(`[${ut}@1.0.12] loaded`);
|
|
716
716
|
const K = (t) => {
|
|
717
717
|
let e;
|
|
718
|
-
const n = /* @__PURE__ */ new Set(),
|
|
719
|
-
const
|
|
720
|
-
if (!Object.is(
|
|
721
|
-
const
|
|
722
|
-
e =
|
|
718
|
+
const n = /* @__PURE__ */ new Set(), s = (g, d) => {
|
|
719
|
+
const m = typeof g == "function" ? g(e) : g;
|
|
720
|
+
if (!Object.is(m, e)) {
|
|
721
|
+
const C = e;
|
|
722
|
+
e = d ?? (typeof m != "object" || m === null) ? m : Object.assign({}, e, m), n.forEach((y) => y(e, C));
|
|
723
723
|
}
|
|
724
|
-
}, o = () => e,
|
|
725
|
-
return
|
|
724
|
+
}, o = () => e, l = { setState: s, getState: o, getInitialState: () => f, subscribe: (g) => (n.add(g), () => n.delete(g)) }, f = e = t(s, o, l);
|
|
725
|
+
return l;
|
|
726
726
|
}, It = (t) => t ? K(t) : K, jt = (t) => t;
|
|
727
727
|
function $t(t, e = jt) {
|
|
728
|
-
const n =
|
|
728
|
+
const n = M.useSyncExternalStore(
|
|
729
729
|
t.subscribe,
|
|
730
|
-
|
|
731
|
-
|
|
730
|
+
M.useCallback(() => e(t.getState()), [t, e]),
|
|
731
|
+
M.useCallback(() => e(t.getInitialState()), [t, e])
|
|
732
732
|
);
|
|
733
|
-
return
|
|
733
|
+
return M.useDebugValue(n), n;
|
|
734
734
|
}
|
|
735
735
|
const X = (t) => {
|
|
736
|
-
const e = It(t), n = (
|
|
736
|
+
const e = It(t), n = (s) => $t(e, s);
|
|
737
737
|
return Object.assign(n, e), n;
|
|
738
|
-
}, dt = (t) => t ? X(t) : X, Ot = (t) => (e, n,
|
|
739
|
-
const o =
|
|
740
|
-
return
|
|
741
|
-
let
|
|
742
|
-
if (
|
|
743
|
-
const
|
|
744
|
-
let
|
|
745
|
-
|
|
746
|
-
const
|
|
747
|
-
if (!
|
|
748
|
-
const
|
|
749
|
-
|
|
738
|
+
}, dt = (t) => t ? X(t) : X, Ot = (t) => (e, n, s) => {
|
|
739
|
+
const o = s.subscribe;
|
|
740
|
+
return s.subscribe = (u, l, f) => {
|
|
741
|
+
let g = u;
|
|
742
|
+
if (l) {
|
|
743
|
+
const d = f?.equalityFn || Object.is;
|
|
744
|
+
let m = u(s.getState());
|
|
745
|
+
g = (C) => {
|
|
746
|
+
const y = u(C);
|
|
747
|
+
if (!d(m, y)) {
|
|
748
|
+
const R = m;
|
|
749
|
+
l(m = y, R);
|
|
750
750
|
}
|
|
751
|
-
},
|
|
751
|
+
}, f?.fireImmediately && l(m, m);
|
|
752
752
|
}
|
|
753
|
-
return o(
|
|
754
|
-
}, t(e, n,
|
|
755
|
-
}, Nt = Ot,
|
|
753
|
+
return o(g);
|
|
754
|
+
}, t(e, n, s);
|
|
755
|
+
}, Nt = Ot, r = dt()(
|
|
756
756
|
Nt((t) => ({
|
|
757
757
|
ready: !1,
|
|
758
758
|
workflow: "current",
|
|
@@ -824,6 +824,10 @@ const X = (t) => {
|
|
|
824
824
|
setGetTextContentFunction: (e) => {
|
|
825
825
|
t({ getTextContentFunction: e });
|
|
826
826
|
},
|
|
827
|
+
llmDescribeToolFunction: null,
|
|
828
|
+
setLlmDescribeToolFunction: (e) => {
|
|
829
|
+
t({ llmDescribeToolFunction: e });
|
|
830
|
+
},
|
|
827
831
|
setGetJsonContentFunction: (e) => {
|
|
828
832
|
t({ getJsonContentFunction: e });
|
|
829
833
|
},
|
|
@@ -874,7 +878,7 @@ const qt = [
|
|
|
874
878
|
], tt = {
|
|
875
879
|
"mode:1": {
|
|
876
880
|
setMode: (t) => {
|
|
877
|
-
|
|
881
|
+
r.setState({ mode: t });
|
|
878
882
|
}
|
|
879
883
|
},
|
|
880
884
|
"reload:1": {
|
|
@@ -885,70 +889,75 @@ const qt = [
|
|
|
885
889
|
"theme:1": {
|
|
886
890
|
setTheme: (t) => {
|
|
887
891
|
if (t === null) {
|
|
888
|
-
|
|
892
|
+
r.setState({ theme: null });
|
|
889
893
|
return;
|
|
890
894
|
}
|
|
891
895
|
if (t !== "light" && t !== "dark") {
|
|
892
896
|
console.warn(
|
|
893
897
|
`[React bindings] Invalid theme: ${t}. Expected 'light' or 'dark'.`
|
|
894
|
-
),
|
|
898
|
+
), r.setState({ theme: null });
|
|
895
899
|
return;
|
|
896
900
|
}
|
|
897
|
-
|
|
901
|
+
r.setState({ theme: t });
|
|
898
902
|
}
|
|
899
903
|
},
|
|
900
904
|
"workflow:1": {
|
|
901
905
|
setWorkflow: (t) => {
|
|
902
|
-
|
|
906
|
+
r.setState({ workflow: t });
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
"workflow:2": {
|
|
910
|
+
setWorkflow: (t) => {
|
|
911
|
+
r.setState({ workflow: t });
|
|
903
912
|
}
|
|
904
913
|
},
|
|
905
914
|
"trigger-save:1": {
|
|
906
915
|
setCanSave(t) {
|
|
907
|
-
|
|
916
|
+
r.setState({ canSave: t });
|
|
908
917
|
}
|
|
909
918
|
},
|
|
910
919
|
"simple-content(text):1": {
|
|
911
920
|
contentSaved: () => {
|
|
912
|
-
|
|
921
|
+
r.setState((t) => ({
|
|
913
922
|
afterSaveCount: t.afterSaveCount + 1
|
|
914
923
|
}));
|
|
915
924
|
},
|
|
916
|
-
getContent: () =>
|
|
925
|
+
getContent: () => r.getState().getTextContentFunction(),
|
|
917
926
|
loadContent: (t) => {
|
|
918
|
-
|
|
927
|
+
r.setState({ loadedTextContent: t });
|
|
919
928
|
}
|
|
920
929
|
},
|
|
921
930
|
"simple-content(json):1": {
|
|
922
931
|
contentSaved: () => {
|
|
923
|
-
|
|
932
|
+
r.setState((t) => ({
|
|
924
933
|
afterSaveCount: t.afterSaveCount + 1
|
|
925
934
|
}));
|
|
926
935
|
},
|
|
927
|
-
getContent: () =>
|
|
936
|
+
getContent: () => r.getState().getJsonContentFunction(),
|
|
928
937
|
loadContent: (t) => {
|
|
929
|
-
|
|
938
|
+
r.setState({ loadedJsonContent: t });
|
|
930
939
|
}
|
|
931
940
|
},
|
|
932
941
|
"simple-binary-data(text):1": {
|
|
933
942
|
contentSaved: () => {
|
|
934
|
-
|
|
943
|
+
r.setState((t) => ({
|
|
935
944
|
afterSaveCount: t.afterSaveCount + 1
|
|
936
945
|
}));
|
|
937
946
|
},
|
|
938
|
-
getContent: () =>
|
|
947
|
+
getContent: () => r.getState().getTextContentFunction(),
|
|
939
948
|
loadContent: (t) => {
|
|
940
|
-
|
|
949
|
+
r.setState({ loadedTextContent: t });
|
|
941
950
|
}
|
|
942
951
|
},
|
|
943
952
|
"simple-content-eval(text):1": {
|
|
944
953
|
contentSaved: () => {
|
|
945
|
-
|
|
954
|
+
r.setState((t) => ({
|
|
946
955
|
afterSaveCount: t.afterSaveCount + 1
|
|
947
956
|
}));
|
|
948
957
|
},
|
|
949
|
-
getContent: () =>
|
|
958
|
+
getContent: () => r.getState().getTextContentFunction(),
|
|
950
959
|
loadContent: (t) => {
|
|
951
|
-
|
|
960
|
+
r.setState({ loadedTextContent: t });
|
|
952
961
|
},
|
|
953
962
|
getAssignmentContent: () => {
|
|
954
963
|
throw new Error(
|
|
@@ -958,13 +967,13 @@ const qt = [
|
|
|
958
967
|
},
|
|
959
968
|
"simple-content-eval(json):1": {
|
|
960
969
|
contentSaved: () => {
|
|
961
|
-
|
|
970
|
+
r.setState((t) => ({
|
|
962
971
|
afterSaveCount: t.afterSaveCount + 1
|
|
963
972
|
}));
|
|
964
973
|
},
|
|
965
|
-
getContent: () =>
|
|
974
|
+
getContent: () => r.getState().getJsonContentFunction(),
|
|
966
975
|
loadContent: (t) => {
|
|
967
|
-
|
|
976
|
+
r.setState({ loadedJsonContent: t });
|
|
968
977
|
},
|
|
969
978
|
getAssignmentContent: () => {
|
|
970
979
|
throw new Error(
|
|
@@ -974,13 +983,13 @@ const qt = [
|
|
|
974
983
|
},
|
|
975
984
|
"simple-content-eval(json):2": {
|
|
976
985
|
contentSaved: () => {
|
|
977
|
-
|
|
986
|
+
r.setState((t) => ({
|
|
978
987
|
afterSaveCount: t.afterSaveCount + 1
|
|
979
988
|
}));
|
|
980
989
|
},
|
|
981
|
-
getContent: () =>
|
|
990
|
+
getContent: () => r.getState().getJsonContentFunction(),
|
|
982
991
|
loadContent: (t) => {
|
|
983
|
-
|
|
992
|
+
r.setState({ loadedJsonContent: t });
|
|
984
993
|
},
|
|
985
994
|
getAssignmentContent: () => {
|
|
986
995
|
throw new Error(
|
|
@@ -990,13 +999,13 @@ const qt = [
|
|
|
990
999
|
},
|
|
991
1000
|
"simple-content-eval(text):2": {
|
|
992
1001
|
contentSaved: () => {
|
|
993
|
-
|
|
1002
|
+
r.setState((t) => ({
|
|
994
1003
|
afterSaveCount: t.afterSaveCount + 1
|
|
995
1004
|
}));
|
|
996
1005
|
},
|
|
997
|
-
getContent: () =>
|
|
1006
|
+
getContent: () => r.getState().getTextContentFunction(),
|
|
998
1007
|
loadContent: (t) => {
|
|
999
|
-
|
|
1008
|
+
r.setState({ loadedTextContent: t });
|
|
1000
1009
|
},
|
|
1001
1010
|
getAssignmentContent: () => {
|
|
1002
1011
|
throw new Error(
|
|
@@ -1006,22 +1015,52 @@ const qt = [
|
|
|
1006
1015
|
},
|
|
1007
1016
|
"separate-contents(json):1": {
|
|
1008
1017
|
contentSaved: () => {
|
|
1009
|
-
|
|
1018
|
+
r.setState((t) => ({
|
|
1019
|
+
afterSaveCount: t.afterSaveCount + 1
|
|
1020
|
+
}));
|
|
1021
|
+
},
|
|
1022
|
+
loadContent: (t, e) => {
|
|
1023
|
+
r.setState({
|
|
1024
|
+
loadedJsonActivityContent: t,
|
|
1025
|
+
loadedJsonAssignmentContent: e
|
|
1026
|
+
});
|
|
1027
|
+
},
|
|
1028
|
+
getActivityContent: () => r.getState().getJsonActivityContentFunction(),
|
|
1029
|
+
getAssignmentContent: () => r.getState().getJsonAssignmentContentFunction()
|
|
1030
|
+
},
|
|
1031
|
+
"separate-contents-eval(json):1": {
|
|
1032
|
+
contentSaved: () => {
|
|
1033
|
+
r.setState((t) => ({
|
|
1010
1034
|
afterSaveCount: t.afterSaveCount + 1
|
|
1011
1035
|
}));
|
|
1012
1036
|
},
|
|
1013
1037
|
loadContent: (t, e) => {
|
|
1014
|
-
|
|
1038
|
+
r.setState({
|
|
1015
1039
|
loadedJsonActivityContent: t,
|
|
1016
1040
|
loadedJsonAssignmentContent: e
|
|
1017
1041
|
});
|
|
1018
1042
|
},
|
|
1019
|
-
getActivityContent: () =>
|
|
1020
|
-
getAssignmentContent: () =>
|
|
1043
|
+
getActivityContent: () => r.getState().getJsonActivityContentFunction(),
|
|
1044
|
+
getAssignmentContent: () => r.getState().getJsonAssignmentContentFunction()
|
|
1045
|
+
},
|
|
1046
|
+
"separate-contents-eval(json):2": {
|
|
1047
|
+
contentSaved: () => {
|
|
1048
|
+
r.setState((t) => ({
|
|
1049
|
+
afterSaveCount: t.afterSaveCount + 1
|
|
1050
|
+
}));
|
|
1051
|
+
},
|
|
1052
|
+
loadContent: (t, e) => {
|
|
1053
|
+
r.setState({
|
|
1054
|
+
loadedJsonActivityContent: t,
|
|
1055
|
+
loadedJsonAssignmentContent: e
|
|
1056
|
+
});
|
|
1057
|
+
},
|
|
1058
|
+
getActivityContent: () => r.getState().getJsonActivityContentFunction(),
|
|
1059
|
+
getAssignmentContent: () => r.getState().getJsonAssignmentContentFunction()
|
|
1021
1060
|
},
|
|
1022
1061
|
"separate-dual-contents(json):1": {
|
|
1023
1062
|
contentSaved: () => {
|
|
1024
|
-
|
|
1063
|
+
r.setState((t) => ({
|
|
1025
1064
|
afterSaveCount: t.afterSaveCount + 1
|
|
1026
1065
|
}));
|
|
1027
1066
|
},
|
|
@@ -1029,17 +1068,17 @@ const qt = [
|
|
|
1029
1068
|
activityContent: t,
|
|
1030
1069
|
assignmentContent: e,
|
|
1031
1070
|
activityBinaryData: n,
|
|
1032
|
-
assignmentBinaryData:
|
|
1071
|
+
assignmentBinaryData: s
|
|
1033
1072
|
}) => {
|
|
1034
|
-
|
|
1073
|
+
r.setState({
|
|
1035
1074
|
loadedJsonActivityContent: t,
|
|
1036
1075
|
loadedJsonAssignmentContent: e,
|
|
1037
1076
|
loadedJsonActivityBinaryData: n,
|
|
1038
|
-
loadedJsonAssignmentBinaryData:
|
|
1077
|
+
loadedJsonAssignmentBinaryData: s
|
|
1039
1078
|
});
|
|
1040
1079
|
},
|
|
1041
|
-
getActivityContentAndData: () => (console.log("[React bindings] Getting activity content and data"),
|
|
1042
|
-
getAssignmentContentAndData: () => (console.log("[React bindings] Getting assignment content and data"),
|
|
1080
|
+
getActivityContentAndData: () => (console.log("[React bindings] Getting activity content and data"), r.getState().getJsonActivitySplitContentFunction()),
|
|
1081
|
+
getAssignmentContentAndData: () => (console.log("[React bindings] Getting assignment content and data"), r.getState().getJsonAssignmentSplitContentFunction())
|
|
1043
1082
|
},
|
|
1044
1083
|
"meta-player-anti-cheat:1": {
|
|
1045
1084
|
lock: () => {
|
|
@@ -1050,24 +1089,24 @@ const qt = [
|
|
|
1050
1089
|
"meta-player-ui:1": {
|
|
1051
1090
|
executeAction(t) {
|
|
1052
1091
|
if (console.log("[React bindings] Executing action:", t), t.startsWith("qa")) {
|
|
1053
|
-
const n =
|
|
1092
|
+
const n = r.getState().quickActions[t];
|
|
1054
1093
|
n ? n() : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1055
1094
|
} else {
|
|
1056
|
-
const n =
|
|
1095
|
+
const n = r.getState().sidebarActions[t];
|
|
1057
1096
|
n ? n() : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1058
1097
|
}
|
|
1059
1098
|
},
|
|
1060
1099
|
executeFileUpload(t, e) {
|
|
1061
1100
|
if (t.startsWith("qa")) {
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1101
|
+
const s = r.getState().quickActions[t];
|
|
1102
|
+
s ? s(e) : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1064
1103
|
} else {
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1104
|
+
const s = r.getState().sidebarActions[t];
|
|
1105
|
+
s ? s(e) : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1067
1106
|
}
|
|
1068
1107
|
},
|
|
1069
1108
|
updateSettings(t) {
|
|
1070
|
-
const e =
|
|
1109
|
+
const e = r.getState().activitySettingsCallback;
|
|
1071
1110
|
e ? e(t) : console.warn(
|
|
1072
1111
|
"activitySettingsCallback is not set. Changes:",
|
|
1073
1112
|
t
|
|
@@ -1076,31 +1115,37 @@ const qt = [
|
|
|
1076
1115
|
},
|
|
1077
1116
|
"meta-player-events:1": {
|
|
1078
1117
|
handleEvent(t) {
|
|
1079
|
-
t === "all-loaded" &&
|
|
1118
|
+
t === "all-loaded" && r.setState({ ready: !0 });
|
|
1080
1119
|
}
|
|
1081
1120
|
},
|
|
1082
1121
|
"llm:1": {
|
|
1083
1122
|
getFirstMessageContext: (t) => {
|
|
1084
|
-
const e =
|
|
1123
|
+
const e = r.getState().llmGetFirstMessageContextFunction;
|
|
1085
1124
|
return e ? e(t) : "";
|
|
1086
1125
|
},
|
|
1087
1126
|
getAllMessagesContext: (t) => {
|
|
1088
|
-
const e =
|
|
1127
|
+
const e = r.getState().llmGetAllMessagesContextFunction;
|
|
1089
1128
|
return e ? e(t) : "";
|
|
1090
1129
|
},
|
|
1091
1130
|
getAvailableTools: (t) => {
|
|
1092
|
-
const e =
|
|
1131
|
+
const e = r.getState().llmGetAvailableToolsFunction;
|
|
1093
1132
|
return e ? e(t) : [];
|
|
1094
1133
|
},
|
|
1095
1134
|
callTool: (t, e) => {
|
|
1096
|
-
const n =
|
|
1135
|
+
const n = r.getState().llmCallToolFunction;
|
|
1097
1136
|
if (!n)
|
|
1098
1137
|
throw new Error("LLM call tool function is not set");
|
|
1099
1138
|
return n(t, e);
|
|
1139
|
+
},
|
|
1140
|
+
getToolCallDescription: (t, e) => {
|
|
1141
|
+
const n = r.getState().llmDescribeToolFunction;
|
|
1142
|
+
if (!n)
|
|
1143
|
+
throw new Error("LLM describe tool function is not set");
|
|
1144
|
+
return n(t, e);
|
|
1100
1145
|
}
|
|
1101
1146
|
}
|
|
1102
|
-
}, b =
|
|
1103
|
-
function
|
|
1147
|
+
}, b = Vt();
|
|
1148
|
+
function Wt(t) {
|
|
1104
1149
|
if (console.log("[React bindings] Contracts to plug:", t), Z) {
|
|
1105
1150
|
console.warn(
|
|
1106
1151
|
"[React bindings] Contracts have already been plugged. Skipping."
|
|
@@ -1143,11 +1188,11 @@ function Bt(t) {
|
|
|
1143
1188
|
`[React bindings] Subscribing to content changes for contract ${e}`
|
|
1144
1189
|
);
|
|
1145
1190
|
const n = e.split(":")[0];
|
|
1146
|
-
b.use([n], ([
|
|
1147
|
-
|
|
1191
|
+
b.use([n], ([s]) => {
|
|
1192
|
+
r.subscribe(
|
|
1148
1193
|
(o) => o.isDirtyCount,
|
|
1149
1194
|
() => {
|
|
1150
|
-
|
|
1195
|
+
s.i?.contentChanged(), console.log(
|
|
1151
1196
|
`[React bindings] Content changed for contract ${n}`
|
|
1152
1197
|
);
|
|
1153
1198
|
}
|
|
@@ -1155,80 +1200,80 @@ function Bt(t) {
|
|
|
1155
1200
|
});
|
|
1156
1201
|
}
|
|
1157
1202
|
}
|
|
1158
|
-
const re = () =>
|
|
1203
|
+
const re = () => r((t) => {
|
|
1159
1204
|
if (t.mode === null)
|
|
1160
1205
|
throw new Error("Mode is not set. Have you used contract 'mode'?");
|
|
1161
1206
|
return t.mode;
|
|
1162
|
-
}), se = () =>
|
|
1207
|
+
}), se = () => r((t) => {
|
|
1163
1208
|
if (t.workflow === null)
|
|
1164
1209
|
throw new Error(
|
|
1165
1210
|
"Workflow is not set. Have you used contract 'workflow'?"
|
|
1166
1211
|
);
|
|
1167
1212
|
return t.workflow;
|
|
1168
|
-
}), ie = () =>
|
|
1213
|
+
}), ie = () => r((t) => {
|
|
1169
1214
|
if (t.theme === null)
|
|
1170
1215
|
throw new Error("Theme is not set. Have you used contract 'theme'?");
|
|
1171
1216
|
return t.theme;
|
|
1172
|
-
}), ae = () =>
|
|
1217
|
+
}), ae = () => r((t) => t.incSaveCount), le = () => r((t) => t.incDirtyCount), ce = () => r((t) => t.loadedTextContent), ue = () => r((t) => t.loadedJsonContent), de = () => r((t) => t.loadedJsonActivityContent), ge = () => r((t) => t.loadedJsonAssignmentContent), fe = () => r((t) => t.loadedJsonActivityBinaryData), me = () => r((t) => t.loadedJsonAssignmentBinaryData), pe = () => w(() => r.getState().loadedTextContent, []), Ce = () => w(() => r.getState().loadedJsonContent, []), ve = () => w(() => r.getState().loadedJsonActivityContent, []), ye = () => w(() => r.getState().loadedJsonAssignmentContent, []), Se = () => w(
|
|
1173
1218
|
() => ({
|
|
1174
|
-
content:
|
|
1175
|
-
binaryData:
|
|
1219
|
+
content: r.getState().loadedJsonActivityContent,
|
|
1220
|
+
binaryData: r.getState().loadedJsonActivityBinaryData
|
|
1176
1221
|
}),
|
|
1177
1222
|
[]
|
|
1178
|
-
),
|
|
1223
|
+
), Ae = () => w(
|
|
1179
1224
|
() => ({
|
|
1180
|
-
content:
|
|
1181
|
-
binaryData:
|
|
1225
|
+
content: r.getState().loadedJsonAssignmentContent,
|
|
1226
|
+
binaryData: r.getState().loadedJsonAssignmentBinaryData
|
|
1182
1227
|
}),
|
|
1183
1228
|
[]
|
|
1184
1229
|
), be = (t) => {
|
|
1185
|
-
const e =
|
|
1230
|
+
const e = r(
|
|
1186
1231
|
(n) => n.setGetTextContentFunction
|
|
1187
1232
|
);
|
|
1188
|
-
|
|
1233
|
+
A(() => {
|
|
1189
1234
|
e(t);
|
|
1190
1235
|
}, [t, e]);
|
|
1191
|
-
},
|
|
1192
|
-
const e =
|
|
1236
|
+
}, we = (t) => {
|
|
1237
|
+
const e = r(
|
|
1193
1238
|
(n) => n.setGetJsonContentFunction
|
|
1194
1239
|
);
|
|
1195
|
-
|
|
1240
|
+
A(() => {
|
|
1196
1241
|
e(t);
|
|
1197
1242
|
}, [t, e]);
|
|
1198
1243
|
}, he = (t) => {
|
|
1199
|
-
const e =
|
|
1244
|
+
const e = r(
|
|
1200
1245
|
(n) => n.setGetJsonActivityContentFunction
|
|
1201
1246
|
);
|
|
1202
|
-
|
|
1247
|
+
A(() => {
|
|
1203
1248
|
e(t);
|
|
1204
1249
|
}, [t, e]);
|
|
1205
|
-
},
|
|
1206
|
-
const e =
|
|
1250
|
+
}, Fe = (t) => {
|
|
1251
|
+
const e = r(
|
|
1207
1252
|
(n) => n.setGetJsonAssignmentContentFunction
|
|
1208
1253
|
);
|
|
1209
|
-
|
|
1254
|
+
A(() => {
|
|
1210
1255
|
e(t);
|
|
1211
1256
|
}, [t, e]);
|
|
1212
|
-
},
|
|
1213
|
-
const e =
|
|
1257
|
+
}, Re = (t) => {
|
|
1258
|
+
const e = r(
|
|
1214
1259
|
(n) => n.setGetJsonActivitySplitContentFunction
|
|
1215
1260
|
);
|
|
1216
|
-
|
|
1261
|
+
A(() => {
|
|
1217
1262
|
e(t);
|
|
1218
1263
|
}, [t, e]);
|
|
1219
1264
|
}, Ee = (t) => {
|
|
1220
|
-
const e =
|
|
1265
|
+
const e = r(
|
|
1221
1266
|
(n) => n.setGetJsonAssignmentSplitContentFunction
|
|
1222
1267
|
);
|
|
1223
|
-
|
|
1268
|
+
A(() => {
|
|
1224
1269
|
e(t);
|
|
1225
1270
|
}, [t, e]);
|
|
1226
|
-
},
|
|
1227
|
-
const e =
|
|
1228
|
-
|
|
1271
|
+
}, Je = (t) => {
|
|
1272
|
+
const e = r((n) => n.afterSaveCount);
|
|
1273
|
+
A(() => {
|
|
1229
1274
|
e > 0 && t();
|
|
1230
1275
|
}, [e]);
|
|
1231
|
-
},
|
|
1276
|
+
}, Te = () => (t, e) => {
|
|
1232
1277
|
b.use(["meta-player-ui"], ([n]) => {
|
|
1233
1278
|
if (n.version === 0) {
|
|
1234
1279
|
console.error(
|
|
@@ -1238,7 +1283,7 @@ const re = () => i((t) => {
|
|
|
1238
1283
|
}
|
|
1239
1284
|
n.i?.previewTextFile(t, e);
|
|
1240
1285
|
});
|
|
1241
|
-
},
|
|
1286
|
+
}, ke = () => (t, e) => {
|
|
1242
1287
|
b.use(["meta-player-ui"], ([n]) => {
|
|
1243
1288
|
if (n.version === 0) {
|
|
1244
1289
|
console.error(
|
|
@@ -1249,34 +1294,34 @@ const re = () => i((t) => {
|
|
|
1249
1294
|
n.i?.previewImageFile(t, e);
|
|
1250
1295
|
});
|
|
1251
1296
|
};
|
|
1252
|
-
let
|
|
1253
|
-
const
|
|
1254
|
-
const n = U(t, e),
|
|
1255
|
-
|
|
1297
|
+
let D = 0, B = 0;
|
|
1298
|
+
const xe = (t, e) => {
|
|
1299
|
+
const n = U(t, e), s = r((o) => o.setSidebarActions);
|
|
1300
|
+
A(() => (D++, D > 1 && console.error(
|
|
1256
1301
|
"[React bindings] Capytale iframe React: Multiple sidebar actions registered: ",
|
|
1257
|
-
|
|
1302
|
+
D
|
|
1258
1303
|
), () => {
|
|
1259
|
-
|
|
1260
|
-
}), []),
|
|
1304
|
+
D--;
|
|
1305
|
+
}), []), A(() => (b.use(["meta-player-ui"], ([o]) => {
|
|
1261
1306
|
if (o.version === 0) {
|
|
1262
1307
|
console.error(
|
|
1263
1308
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1264
1309
|
);
|
|
1265
1310
|
return;
|
|
1266
1311
|
}
|
|
1267
|
-
|
|
1268
|
-
const
|
|
1269
|
-
type:
|
|
1270
|
-
title:
|
|
1271
|
-
icon:
|
|
1272
|
-
id: `sa-${
|
|
1273
|
-
...
|
|
1274
|
-
})),
|
|
1275
|
-
n.forEach((
|
|
1276
|
-
|
|
1277
|
-
}), o.i?.setSidebarActionButtons(
|
|
1312
|
+
B++;
|
|
1313
|
+
const i = n.map((l, f) => ({
|
|
1314
|
+
type: l.type,
|
|
1315
|
+
title: l.title,
|
|
1316
|
+
icon: l.icon,
|
|
1317
|
+
id: `sa-${B}-${f}`,
|
|
1318
|
+
...l.type === "file-upload" ? { accept: l.accept } : {}
|
|
1319
|
+
})), u = {};
|
|
1320
|
+
n.forEach((l, f) => {
|
|
1321
|
+
u[`sa-${B}-${f}`] = l.action;
|
|
1322
|
+
}), o.i?.setSidebarActionButtons(i), s(u);
|
|
1278
1323
|
}), () => {
|
|
1279
|
-
|
|
1324
|
+
s({}), b.use(["meta-player-ui"], ([o]) => {
|
|
1280
1325
|
if (o.version === 0) {
|
|
1281
1326
|
console.error(
|
|
1282
1327
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1287,15 +1332,15 @@ const Te = (t, e) => {
|
|
|
1287
1332
|
});
|
|
1288
1333
|
}), [n]);
|
|
1289
1334
|
};
|
|
1290
|
-
let
|
|
1291
|
-
const
|
|
1292
|
-
const n = U(t, e),
|
|
1293
|
-
|
|
1335
|
+
let P = 0, H = 0;
|
|
1336
|
+
const Le = (t, e) => {
|
|
1337
|
+
const n = U(t, e), s = r((o) => o.setQuickActions);
|
|
1338
|
+
A(() => (P++, P > 1 && console.error(
|
|
1294
1339
|
"[React bindings] Capytale iframe React: Multiple quick actions registered: ",
|
|
1295
|
-
|
|
1340
|
+
P
|
|
1296
1341
|
), () => {
|
|
1297
|
-
|
|
1298
|
-
}), []),
|
|
1342
|
+
P--;
|
|
1343
|
+
}), []), A(() => (b.use(["meta-player-ui"], ([o]) => {
|
|
1299
1344
|
if (o.version === 0) {
|
|
1300
1345
|
console.error(
|
|
1301
1346
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1303,18 +1348,18 @@ const Me = (t, e) => {
|
|
|
1303
1348
|
return;
|
|
1304
1349
|
}
|
|
1305
1350
|
H++;
|
|
1306
|
-
const
|
|
1307
|
-
type:
|
|
1308
|
-
title:
|
|
1309
|
-
icon:
|
|
1310
|
-
id: `qa-${H}-${
|
|
1311
|
-
...
|
|
1312
|
-
})),
|
|
1313
|
-
n.forEach((
|
|
1314
|
-
|
|
1315
|
-
}), o.i?.setQuickActionButtons(
|
|
1351
|
+
const i = n.map((l, f) => ({
|
|
1352
|
+
type: l.type,
|
|
1353
|
+
title: l.title,
|
|
1354
|
+
icon: l.icon,
|
|
1355
|
+
id: `qa-${H}-${f}`,
|
|
1356
|
+
...l.type === "file-upload" ? { accept: l.accept } : {}
|
|
1357
|
+
})), u = {};
|
|
1358
|
+
n.forEach((l, f) => {
|
|
1359
|
+
u[`qa-${H}-${f}`] = l.action;
|
|
1360
|
+
}), o.i?.setQuickActionButtons(i), s(u);
|
|
1316
1361
|
}), () => {
|
|
1317
|
-
|
|
1362
|
+
s({}), b.use(["meta-player-ui"], ([o]) => {
|
|
1318
1363
|
if (o.version === 0) {
|
|
1319
1364
|
console.error(
|
|
1320
1365
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1325,18 +1370,18 @@ const Me = (t, e) => {
|
|
|
1325
1370
|
});
|
|
1326
1371
|
}), [n]);
|
|
1327
1372
|
};
|
|
1328
|
-
let
|
|
1329
|
-
const
|
|
1330
|
-
const
|
|
1331
|
-
(
|
|
1373
|
+
let V = 0;
|
|
1374
|
+
const Bt = (t, e, n) => {
|
|
1375
|
+
const s = U(t, n), o = r(
|
|
1376
|
+
(i) => i.setActivitySettingsCallback
|
|
1332
1377
|
);
|
|
1333
|
-
|
|
1378
|
+
A(() => (console.log("[React bindings] Mounting useSettings"), V++, V > 1 && console.error(
|
|
1334
1379
|
"[React bindings] Capytale iframe React: Multiple settings registered: ",
|
|
1335
|
-
|
|
1380
|
+
V
|
|
1336
1381
|
), () => {
|
|
1337
|
-
console.log("[React bindings] Unmounting useSettings"),
|
|
1338
|
-
}), []),
|
|
1339
|
-
if (
|
|
1382
|
+
console.log("[React bindings] Unmounting useSettings"), V--;
|
|
1383
|
+
}), []), A(() => (b.use(["meta-player-ui"], ([i]) => {
|
|
1384
|
+
if (i.version === 0) {
|
|
1340
1385
|
console.error(
|
|
1341
1386
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1342
1387
|
);
|
|
@@ -1344,14 +1389,14 @@ const Wt = (t, e, n) => {
|
|
|
1344
1389
|
}
|
|
1345
1390
|
console.log(
|
|
1346
1391
|
"[React bindings] Updating settings UI in MetaPlayer",
|
|
1347
|
-
|
|
1348
|
-
),
|
|
1392
|
+
s
|
|
1393
|
+
), i.i?.setSettingsUI(s);
|
|
1349
1394
|
}), o(
|
|
1350
1395
|
e
|
|
1351
1396
|
), () => {
|
|
1352
1397
|
o(null);
|
|
1353
|
-
}), [
|
|
1354
|
-
}, Ht = () =>
|
|
1398
|
+
}), [s]);
|
|
1399
|
+
}, Ht = () => w((e) => b.exec(["meta-player-ui"], ([n]) => {
|
|
1355
1400
|
if (n.version === 0)
|
|
1356
1401
|
throw console.error(
|
|
1357
1402
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1359,7 +1404,7 @@ const Wt = (t, e, n) => {
|
|
|
1359
1404
|
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1360
1405
|
);
|
|
1361
1406
|
return n.i?.showToast(e);
|
|
1362
|
-
}), []), zt = () =>
|
|
1407
|
+
}), []), zt = () => w(
|
|
1363
1408
|
(e) => b.exec(["meta-player-ui"], ([n]) => {
|
|
1364
1409
|
if (n.version === 0)
|
|
1365
1410
|
throw console.error(
|
|
@@ -1370,7 +1415,7 @@ const Wt = (t, e, n) => {
|
|
|
1370
1415
|
return n.i?.clearToast(e);
|
|
1371
1416
|
}),
|
|
1372
1417
|
[]
|
|
1373
|
-
),
|
|
1418
|
+
), Me = () => w(
|
|
1374
1419
|
() => b.exec(["meta-player-ui"], ([e]) => {
|
|
1375
1420
|
if (e.version === 0)
|
|
1376
1421
|
throw console.error(
|
|
@@ -1382,18 +1427,18 @@ const Wt = (t, e, n) => {
|
|
|
1382
1427
|
}),
|
|
1383
1428
|
[]
|
|
1384
1429
|
), Ut = (t, e) => {
|
|
1385
|
-
const n = Ht(),
|
|
1386
|
-
return
|
|
1430
|
+
const n = Ht(), s = zt();
|
|
1431
|
+
return A(() => {
|
|
1387
1432
|
if (t == null)
|
|
1388
1433
|
return;
|
|
1389
1434
|
const o = n(t);
|
|
1390
1435
|
return () => {
|
|
1391
|
-
o.then((
|
|
1392
|
-
|
|
1436
|
+
o.then((i) => {
|
|
1437
|
+
i != null && s(i);
|
|
1393
1438
|
});
|
|
1394
1439
|
};
|
|
1395
|
-
}, [n,
|
|
1396
|
-
},
|
|
1440
|
+
}, [n, s, ...e]), null;
|
|
1441
|
+
}, Ge = () => w(() => b.exec(["trigger-save"], ([e]) => {
|
|
1397
1442
|
if (e.version === 0)
|
|
1398
1443
|
throw console.error(
|
|
1399
1444
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
@@ -1401,20 +1446,36 @@ const Wt = (t, e, n) => {
|
|
|
1401
1446
|
"Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
1402
1447
|
);
|
|
1403
1448
|
return e.i?.triggerSave();
|
|
1404
|
-
}), []),
|
|
1405
|
-
const n =
|
|
1406
|
-
(
|
|
1449
|
+
}), []), De = () => r((t) => t.canSave), Pe = (t, e) => {
|
|
1450
|
+
const n = r(
|
|
1451
|
+
(s) => s.setLlmGetFirstMessageContextFunction
|
|
1407
1452
|
);
|
|
1408
|
-
|
|
1453
|
+
A(() => (n(t), () => {
|
|
1409
1454
|
n(null);
|
|
1410
1455
|
}), [e, n]);
|
|
1411
|
-
},
|
|
1412
|
-
const n =
|
|
1413
|
-
(
|
|
1456
|
+
}, Ve = (t, e) => {
|
|
1457
|
+
const n = r(
|
|
1458
|
+
(s) => s.setLlmGetAllMessagesContextFunction
|
|
1414
1459
|
);
|
|
1415
|
-
|
|
1460
|
+
A(() => (n(t), () => {
|
|
1416
1461
|
n(null);
|
|
1417
1462
|
}), [e, n]);
|
|
1463
|
+
}, Ie = (t, e, n, s) => {
|
|
1464
|
+
const o = r(
|
|
1465
|
+
(l) => l.setLlmGetAvailableToolsFunction
|
|
1466
|
+
), i = r(
|
|
1467
|
+
(l) => l.setLlmCallToolFunction
|
|
1468
|
+
), u = r(
|
|
1469
|
+
(l) => l.setLlmDescribeToolFunction
|
|
1470
|
+
);
|
|
1471
|
+
A(() => (o(t), i(e), u(n), () => {
|
|
1472
|
+
o(null), i(null), u(null);
|
|
1473
|
+
}), [
|
|
1474
|
+
s,
|
|
1475
|
+
o,
|
|
1476
|
+
i,
|
|
1477
|
+
u
|
|
1478
|
+
]);
|
|
1418
1479
|
};
|
|
1419
1480
|
function _t(t) {
|
|
1420
1481
|
const e = {};
|
|
@@ -1447,14 +1508,14 @@ function Xt(t) {
|
|
|
1447
1508
|
Object.assign(e, Kt(n));
|
|
1448
1509
|
return e;
|
|
1449
1510
|
}
|
|
1450
|
-
function
|
|
1451
|
-
const n = dt()((
|
|
1511
|
+
function je(t) {
|
|
1512
|
+
const n = dt()((s) => ({
|
|
1452
1513
|
...Xt(t)
|
|
1453
1514
|
}));
|
|
1454
1515
|
return n.activitySettings = t, n;
|
|
1455
1516
|
}
|
|
1456
1517
|
function Zt(t) {
|
|
1457
|
-
|
|
1518
|
+
Bt(
|
|
1458
1519
|
() => t.activitySettings,
|
|
1459
1520
|
(e) => {
|
|
1460
1521
|
t.setState(e);
|
|
@@ -1473,65 +1534,66 @@ const ee = [
|
|
|
1473
1534
|
"mode:1",
|
|
1474
1535
|
"workflow:1"
|
|
1475
1536
|
];
|
|
1476
|
-
function
|
|
1537
|
+
function $e({
|
|
1477
1538
|
children: t,
|
|
1478
1539
|
contracts: e,
|
|
1479
1540
|
loadOnlyWhenReady: n = !0,
|
|
1480
|
-
activitySettingsStore:
|
|
1541
|
+
activitySettingsStore: s
|
|
1481
1542
|
}) {
|
|
1482
|
-
const o =
|
|
1483
|
-
return
|
|
1484
|
-
const
|
|
1485
|
-
for (const
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
}, []), n && !o ? /* @__PURE__ */ Q("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */ ft(
|
|
1489
|
-
|
|
1543
|
+
const o = r((i) => i.ready);
|
|
1544
|
+
return A(() => {
|
|
1545
|
+
const i = [...e];
|
|
1546
|
+
for (const u of ee)
|
|
1547
|
+
i.includes(u) || i.push(u);
|
|
1548
|
+
Wt(i);
|
|
1549
|
+
}, []), n && !o ? /* @__PURE__ */ Q("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */ ft(mt, { children: [
|
|
1550
|
+
s && /* @__PURE__ */ Q(te, { store: s }),
|
|
1490
1551
|
t
|
|
1491
1552
|
] });
|
|
1492
1553
|
}
|
|
1493
|
-
function
|
|
1554
|
+
function Oe({ message: t }) {
|
|
1494
1555
|
return Ut(t, [t]), null;
|
|
1495
1556
|
}
|
|
1496
1557
|
export {
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1558
|
+
$e as Capytale,
|
|
1559
|
+
Oe as TemporaryToast,
|
|
1560
|
+
je as createActivitySettingsStore,
|
|
1561
|
+
Je as useAfterSaveAction,
|
|
1562
|
+
De as useCanSave,
|
|
1502
1563
|
zt as useClearToast,
|
|
1503
|
-
|
|
1564
|
+
Me as useClearToasts,
|
|
1504
1565
|
ve as useGetLoadedJsonActivityContent,
|
|
1505
1566
|
Se as useGetLoadedJsonActivitySplitContent,
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1567
|
+
ye as useGetLoadedJsonAssignmentContent,
|
|
1568
|
+
Ae as useGetLoadedJsonAssignmentSplitContent,
|
|
1569
|
+
Ce as useGetLoadedJsonContent,
|
|
1570
|
+
pe as useGetLoadedTextContent,
|
|
1510
1571
|
he as useJsonActivityContentSaveFunction,
|
|
1511
|
-
|
|
1512
|
-
|
|
1572
|
+
Re as useJsonActivitySplitContentSaveFunction,
|
|
1573
|
+
Fe as useJsonAssignmentContentSaveFunction,
|
|
1513
1574
|
Ee as useJsonAssignmentSplitContentSaveFunction,
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1575
|
+
we as useJsonContentSaveFunction,
|
|
1576
|
+
Ve as useLLMAllMessagesContext,
|
|
1577
|
+
Pe as useLLMFirstMessageContext,
|
|
1578
|
+
Ie as useLLMTools,
|
|
1517
1579
|
fe as useLoadedJsonActivityBinaryData,
|
|
1518
1580
|
de as useLoadedJsonActivityContent,
|
|
1519
|
-
|
|
1581
|
+
me as useLoadedJsonAssignmentBinaryData,
|
|
1520
1582
|
ge as useLoadedJsonAssignmentContent,
|
|
1521
1583
|
ue as useLoadedJsonContent,
|
|
1522
|
-
|
|
1584
|
+
ce as useLoadedTextContent,
|
|
1523
1585
|
re as useMode,
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1586
|
+
le as useNotifyIsDirty,
|
|
1587
|
+
ke as usePreviewImageFile,
|
|
1588
|
+
Te as usePreviewTextFile,
|
|
1589
|
+
Le as useQuickActions,
|
|
1528
1590
|
ae as useRequestSave,
|
|
1529
|
-
|
|
1591
|
+
Bt as useSettings,
|
|
1530
1592
|
Ht as useShowToast,
|
|
1531
|
-
|
|
1593
|
+
xe as useSidebarActions,
|
|
1532
1594
|
be as useTextContentSaveFunction,
|
|
1533
1595
|
ie as useTheme,
|
|
1534
1596
|
Ut as useToast,
|
|
1535
|
-
|
|
1597
|
+
Ge as useTriggerSave,
|
|
1536
1598
|
se as useWorkflow
|
|
1537
1599
|
};
|