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