@capytale/iframe-react 1.2.1 → 1.3.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 +10 -140
- package/dist/index.es.js +371 -366
- package/package.json +52 -52
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import M, { useCallback as
|
|
3
|
-
const et = /* @__PURE__ */ Symbol("Comlink.proxy"), pt = /* @__PURE__ */ Symbol("Comlink.endpoint"),
|
|
1
|
+
import { jsx as U, jsxs as ft, Fragment as mt } from "react/jsx-runtime";
|
|
2
|
+
import M, { useCallback as b, useEffect as w, useMemo as _ } from "react";
|
|
3
|
+
const et = /* @__PURE__ */ Symbol("Comlink.proxy"), pt = /* @__PURE__ */ Symbol("Comlink.endpoint"), vt = /* @__PURE__ */ Symbol("Comlink.releaseProxy"), q = /* @__PURE__ */ Symbol("Comlink.finalizer"), I = /* @__PURE__ */ Symbol("Comlink.thrown"), nt = (t) => typeof t == "object" && t !== null || typeof t == "function", Ct = {
|
|
4
4
|
canHandle: (t) => nt(t) && t[et],
|
|
5
5
|
serialize(t) {
|
|
6
6
|
const { port1: e, port2: n } = new MessageChannel();
|
|
7
|
-
return
|
|
7
|
+
return Q(t, e), [n, [n]];
|
|
8
8
|
},
|
|
9
9
|
deserialize(t) {
|
|
10
10
|
return t.start(), st(t);
|
|
@@ -26,7 +26,7 @@ const et = /* @__PURE__ */ Symbol("Comlink.proxy"), pt = /* @__PURE__ */ Symbol(
|
|
|
26
26
|
throw t.isError ? Object.assign(new Error(t.value.message), t.value) : t.value;
|
|
27
27
|
}
|
|
28
28
|
}, ot = /* @__PURE__ */ new Map([
|
|
29
|
-
["proxy",
|
|
29
|
+
["proxy", Ct],
|
|
30
30
|
["throw", yt]
|
|
31
31
|
]);
|
|
32
32
|
function St(t, e) {
|
|
@@ -35,8 +35,8 @@ function St(t, e) {
|
|
|
35
35
|
return !0;
|
|
36
36
|
return !1;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
e.addEventListener("message", function
|
|
38
|
+
function Q(t, e = globalThis, n = ["*"]) {
|
|
39
|
+
e.addEventListener("message", function r(o) {
|
|
40
40
|
if (!o || !o.data)
|
|
41
41
|
return;
|
|
42
42
|
if (!St(n, o.origin)) {
|
|
@@ -46,7 +46,7 @@ function _(t, e = globalThis, n = ["*"]) {
|
|
|
46
46
|
const { id: i, type: u, path: l } = Object.assign({ path: [] }, o.data), f = (o.data.argumentList || []).map(J);
|
|
47
47
|
let g;
|
|
48
48
|
try {
|
|
49
|
-
const d = l.slice(0, -1).reduce((
|
|
49
|
+
const d = l.slice(0, -1).reduce((v, y) => v[y], t), m = l.reduce((v, y) => v[y], t);
|
|
50
50
|
switch (u) {
|
|
51
51
|
case "GET":
|
|
52
52
|
g = m;
|
|
@@ -59,14 +59,14 @@ function _(t, e = globalThis, n = ["*"]) {
|
|
|
59
59
|
break;
|
|
60
60
|
case "CONSTRUCT":
|
|
61
61
|
{
|
|
62
|
-
const
|
|
63
|
-
g = lt(
|
|
62
|
+
const v = new m(...f);
|
|
63
|
+
g = lt(v);
|
|
64
64
|
}
|
|
65
65
|
break;
|
|
66
66
|
case "ENDPOINT":
|
|
67
67
|
{
|
|
68
|
-
const { port1:
|
|
69
|
-
|
|
68
|
+
const { port1: v, port2: y } = new MessageChannel();
|
|
69
|
+
Q(t, y), g = Ft(v, [v]);
|
|
70
70
|
}
|
|
71
71
|
break;
|
|
72
72
|
case "RELEASE":
|
|
@@ -79,22 +79,22 @@ function _(t, e = globalThis, n = ["*"]) {
|
|
|
79
79
|
g = { value: d, [I]: 0 };
|
|
80
80
|
}
|
|
81
81
|
Promise.resolve(g).catch((d) => ({ value: d, [I]: 0 })).then((d) => {
|
|
82
|
-
const [m,
|
|
83
|
-
e.postMessage(Object.assign(Object.assign({}, m), { id: i }),
|
|
82
|
+
const [m, v] = $(d);
|
|
83
|
+
e.postMessage(Object.assign(Object.assign({}, m), { id: i }), v), u === "RELEASE" && (e.removeEventListener("message", r), rt(e), q in t && typeof t[q] == "function" && t[q]());
|
|
84
84
|
}).catch((d) => {
|
|
85
|
-
const [m,
|
|
85
|
+
const [m, v] = $({
|
|
86
86
|
value: new TypeError("Unserializable return value"),
|
|
87
87
|
[I]: 0
|
|
88
88
|
});
|
|
89
|
-
e.postMessage(Object.assign(Object.assign({}, m), { id: i }),
|
|
89
|
+
e.postMessage(Object.assign(Object.assign({}, m), { id: i }), v);
|
|
90
90
|
});
|
|
91
91
|
}), e.start && e.start();
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function wt(t) {
|
|
94
94
|
return t.constructor.name === "MessagePort";
|
|
95
95
|
}
|
|
96
96
|
function rt(t) {
|
|
97
|
-
|
|
97
|
+
wt(t) && t.close();
|
|
98
98
|
}
|
|
99
99
|
function st(t, e) {
|
|
100
100
|
const n = /* @__PURE__ */ new Map();
|
|
@@ -111,7 +111,7 @@ function st(t, e) {
|
|
|
111
111
|
}
|
|
112
112
|
}), z(t, n, [], e);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function P(t) {
|
|
115
115
|
if (t)
|
|
116
116
|
throw new Error("Proxy has been released and is not useable");
|
|
117
117
|
}
|
|
@@ -122,25 +122,25 @@ function it(t) {
|
|
|
122
122
|
rt(t);
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
const j = /* @__PURE__ */ new WeakMap(),
|
|
125
|
+
const j = /* @__PURE__ */ new WeakMap(), O = "FinalizationRegistry" in globalThis && new FinalizationRegistry((t) => {
|
|
126
126
|
const e = (j.get(t) || 0) - 1;
|
|
127
127
|
j.set(t, e), e === 0 && it(t);
|
|
128
128
|
});
|
|
129
|
-
function
|
|
129
|
+
function At(t, e) {
|
|
130
130
|
const n = (j.get(e) || 0) + 1;
|
|
131
|
-
j.set(e, n),
|
|
131
|
+
j.set(e, n), O && O.register(t, e, t);
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
|
|
133
|
+
function bt(t) {
|
|
134
|
+
O && O.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 i = new Proxy(
|
|
139
|
+
const i = new Proxy(r, {
|
|
140
140
|
get(u, l) {
|
|
141
|
-
if (
|
|
141
|
+
if (P(o), l === vt)
|
|
142
142
|
return () => {
|
|
143
|
-
|
|
143
|
+
bt(i), it(t), e.clear(), o = !0;
|
|
144
144
|
};
|
|
145
145
|
if (l === "then") {
|
|
146
146
|
if (n.length === 0)
|
|
@@ -154,8 +154,8 @@ function z(t, e, n = [], s = function() {
|
|
|
154
154
|
return z(t, e, [...n, l]);
|
|
155
155
|
},
|
|
156
156
|
set(u, l, f) {
|
|
157
|
-
|
|
158
|
-
const [g, d] =
|
|
157
|
+
P(o);
|
|
158
|
+
const [g, d] = $(f);
|
|
159
159
|
return x(t, e, {
|
|
160
160
|
type: "SET",
|
|
161
161
|
path: [...n, l].map((m) => m.toString()),
|
|
@@ -163,7 +163,7 @@ function z(t, e, n = [], s = function() {
|
|
|
163
163
|
}, d).then(J);
|
|
164
164
|
},
|
|
165
165
|
apply(u, l, f) {
|
|
166
|
-
|
|
166
|
+
P(o);
|
|
167
167
|
const g = n[n.length - 1];
|
|
168
168
|
if (g === pt)
|
|
169
169
|
return x(t, e, {
|
|
@@ -174,12 +174,12 @@ function z(t, e, n = [], s = function() {
|
|
|
174
174
|
const [d, m] = Y(f);
|
|
175
175
|
return x(t, e, {
|
|
176
176
|
type: "APPLY",
|
|
177
|
-
path: n.map((
|
|
177
|
+
path: n.map((v) => v.toString()),
|
|
178
178
|
argumentList: d
|
|
179
179
|
}, m).then(J);
|
|
180
180
|
},
|
|
181
181
|
construct(u, l) {
|
|
182
|
-
|
|
182
|
+
P(o);
|
|
183
183
|
const [f, g] = Y(l);
|
|
184
184
|
return x(t, e, {
|
|
185
185
|
type: "CONSTRUCT",
|
|
@@ -188,13 +188,13 @@ function z(t, e, n = [], s = function() {
|
|
|
188
188
|
}, g).then(J);
|
|
189
189
|
}
|
|
190
190
|
});
|
|
191
|
-
return
|
|
191
|
+
return At(i, t), i;
|
|
192
192
|
}
|
|
193
193
|
function ht(t) {
|
|
194
194
|
return Array.prototype.concat.apply([], t);
|
|
195
195
|
}
|
|
196
196
|
function Y(t) {
|
|
197
|
-
const e = t.map(
|
|
197
|
+
const e = t.map($);
|
|
198
198
|
return [e.map((n) => n[0]), ht(e.map((n) => n[1]))];
|
|
199
199
|
}
|
|
200
200
|
const at = /* @__PURE__ */ new WeakMap();
|
|
@@ -204,22 +204,22 @@ function Ft(t, e) {
|
|
|
204
204
|
function lt(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
|
};
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function $(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
|
];
|
|
@@ -240,20 +240,20 @@ function J(t) {
|
|
|
240
240
|
return t.value;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
function x(t, e, n,
|
|
243
|
+
function x(t, e, n, r) {
|
|
244
244
|
return new Promise((o) => {
|
|
245
|
-
const i =
|
|
246
|
-
e.set(i, o), t.start && t.start(), t.postMessage(Object.assign({ id: i }, n),
|
|
245
|
+
const i = Rt();
|
|
246
|
+
e.set(i, o), t.start && t.start(), t.postMessage(Object.assign({ id: i }, n), r);
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function Rt() {
|
|
250
250
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
251
251
|
}
|
|
252
252
|
function Jt(t, e) {
|
|
253
253
|
return t.length === 0 ? e : `[${t}] ${e}`;
|
|
254
254
|
}
|
|
255
255
|
function Tt(t, e) {
|
|
256
|
-
let n = !1,
|
|
256
|
+
let n = !1, r, o, i;
|
|
257
257
|
function u(d) {
|
|
258
258
|
return Jt(t, d);
|
|
259
259
|
}
|
|
@@ -269,37 +269,37 @@ function Tt(t, e) {
|
|
|
269
269
|
done() {
|
|
270
270
|
return Promise.resolve();
|
|
271
271
|
},
|
|
272
|
-
provide(d, m,
|
|
272
|
+
provide(d, m, v) {
|
|
273
273
|
return Promise.resolve();
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
276
|
else {
|
|
277
|
-
const d =
|
|
278
|
-
|
|
277
|
+
const d = Et(window.parent, void 0, e);
|
|
278
|
+
Q({
|
|
279
279
|
declare(m) {
|
|
280
|
-
if (
|
|
281
|
-
|
|
280
|
+
if (r == null) throw new Error(u("No handler for declare"));
|
|
281
|
+
r(m);
|
|
282
282
|
},
|
|
283
283
|
done() {
|
|
284
284
|
if (o == null) throw new Error(u("No handler for done"));
|
|
285
285
|
o();
|
|
286
286
|
},
|
|
287
|
-
provide(m,
|
|
287
|
+
provide(m, v, y) {
|
|
288
288
|
if (i == null) throw new Error(u("No handler for provide"));
|
|
289
|
-
i(m,
|
|
289
|
+
i(m, v, y);
|
|
290
290
|
}
|
|
291
291
|
}, d), l = st(d), f = !0;
|
|
292
292
|
}
|
|
293
293
|
const g = () => {
|
|
294
294
|
if (!n) {
|
|
295
|
-
if (
|
|
295
|
+
if (r == null || o == null || i == null) return;
|
|
296
296
|
n = !0, l.ready();
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
299
|
return {
|
|
300
300
|
declare: (d) => l.declare(d),
|
|
301
301
|
done: () => l.done(),
|
|
302
|
-
provide: (d, m,
|
|
302
|
+
provide: (d, m, v) => l.provide(d, m, lt(v)),
|
|
303
303
|
get name() {
|
|
304
304
|
return t;
|
|
305
305
|
},
|
|
@@ -307,7 +307,7 @@ function Tt(t, e) {
|
|
|
307
307
|
return f;
|
|
308
308
|
},
|
|
309
309
|
set onDeclare(d) {
|
|
310
|
-
|
|
310
|
+
r = d, g();
|
|
311
311
|
},
|
|
312
312
|
set onDone(d) {
|
|
313
313
|
o = d, g();
|
|
@@ -319,18 +319,18 @@ function Tt(t, e) {
|
|
|
319
319
|
}
|
|
320
320
|
function kt(t) {
|
|
321
321
|
return function(e) {
|
|
322
|
-
let n,
|
|
322
|
+
let n, r = !1, o = !1, i, u, l = !1, f = !1, g, d, m, v;
|
|
323
323
|
function y() {
|
|
324
324
|
if (i != null && i !== 0 && u != null)
|
|
325
325
|
return u;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function E(a) {
|
|
328
328
|
if (i != null && u != null && !(a > i))
|
|
329
329
|
return u;
|
|
330
330
|
}
|
|
331
331
|
function h() {
|
|
332
332
|
return m ?? (f ? m = Promise.resolve() : m = new Promise((a, c) => {
|
|
333
|
-
|
|
333
|
+
v = a;
|
|
334
334
|
}));
|
|
335
335
|
}
|
|
336
336
|
function T() {
|
|
@@ -344,7 +344,7 @@ function kt(t) {
|
|
|
344
344
|
get i() {
|
|
345
345
|
return y();
|
|
346
346
|
},
|
|
347
|
-
v: (a) =>
|
|
347
|
+
v: (a) => E(a)
|
|
348
348
|
}), g;
|
|
349
349
|
}
|
|
350
350
|
function L() {
|
|
@@ -358,7 +358,7 @@ function kt(t) {
|
|
|
358
358
|
get i() {
|
|
359
359
|
return f ? y() : void 0;
|
|
360
360
|
},
|
|
361
|
-
v: (a) => f ?
|
|
361
|
+
v: (a) => f ? E(a) : void 0,
|
|
362
362
|
get promise() {
|
|
363
363
|
return i === 0 ? Promise.reject(t("Remote interface not provided")) : h().then(() => {
|
|
364
364
|
if (i === 0) throw new Error(t("Remote interface not provided"));
|
|
@@ -367,8 +367,8 @@ function kt(t) {
|
|
|
367
367
|
}
|
|
368
368
|
}), d;
|
|
369
369
|
}
|
|
370
|
-
function
|
|
371
|
-
|
|
370
|
+
function R() {
|
|
371
|
+
v != null && (v(), v = void 0);
|
|
372
372
|
}
|
|
373
373
|
return {
|
|
374
374
|
get name() {
|
|
@@ -383,11 +383,11 @@ function kt(t) {
|
|
|
383
383
|
n = a;
|
|
384
384
|
},
|
|
385
385
|
get localVersionSent() {
|
|
386
|
-
return
|
|
386
|
+
return r;
|
|
387
387
|
},
|
|
388
388
|
set localVersionSent(a) {
|
|
389
|
-
if (!a &&
|
|
390
|
-
|
|
389
|
+
if (!a && r) throw new Error(t("Local version already notified"));
|
|
390
|
+
r = a, a && n === 0 && (o = !0);
|
|
391
391
|
},
|
|
392
392
|
get localInterfaceSent() {
|
|
393
393
|
return o;
|
|
@@ -431,7 +431,7 @@ function kt(t) {
|
|
|
431
431
|
if (!f) {
|
|
432
432
|
if (!l) throw new Error(t("Remote interface not provided."));
|
|
433
433
|
if (!o) throw new Error(t("Local interface not sent"));
|
|
434
|
-
f = !0,
|
|
434
|
+
f = !0, R();
|
|
435
435
|
}
|
|
436
436
|
},
|
|
437
437
|
getRemote: () => T(),
|
|
@@ -443,8 +443,8 @@ function kt(t) {
|
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
445
|
function xt(t) {
|
|
446
|
-
return function(e, n,
|
|
447
|
-
let i =
|
|
446
|
+
return function(e, n, r, o) {
|
|
447
|
+
let i = r, u = !1, l = !1;
|
|
448
448
|
function f() {
|
|
449
449
|
return e.every((g) => g.remoteVersionReceived && g.localVersionSent) && n.every((g) => g.remoteVersionReceived);
|
|
450
450
|
}
|
|
@@ -475,13 +475,13 @@ function xt(t) {
|
|
|
475
475
|
if (!f())
|
|
476
476
|
throw new Error(t("Factory is not ready"));
|
|
477
477
|
let g;
|
|
478
|
-
o ? g = e.map((
|
|
478
|
+
o ? g = e.map((v) => v.getRemote()) : g = e[0].getRemote();
|
|
479
479
|
let d;
|
|
480
|
-
const m = n.length > 0 ? n.map((
|
|
480
|
+
const m = n.length > 0 ? n.map((v) => v.getRemote()) : null;
|
|
481
481
|
try {
|
|
482
482
|
d = m == null ? i(g) : i(g, m);
|
|
483
|
-
} catch (
|
|
484
|
-
throw new Error(t("error in factory:"), { cause:
|
|
483
|
+
} catch (v) {
|
|
484
|
+
throw new Error(t("error in factory:"), { cause: v });
|
|
485
485
|
}
|
|
486
486
|
if (o || (d = [d]), d.length != e.length)
|
|
487
487
|
throw new Error(t("Invalid factory result"));
|
|
@@ -491,7 +491,7 @@ function xt(t) {
|
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
493
|
function Lt(t) {
|
|
494
|
-
return function(e, n,
|
|
494
|
+
return function(e, n, r, o) {
|
|
495
495
|
let i = n, u = !1;
|
|
496
496
|
function l() {
|
|
497
497
|
return e.every((f) => f.isActivated);
|
|
@@ -511,7 +511,7 @@ function Lt(t) {
|
|
|
511
511
|
const d = new Error(t(u ? "callback already invoked" : "callback parameters are not ready"));
|
|
512
512
|
throw o?.[1](d), d;
|
|
513
513
|
}
|
|
514
|
-
const f =
|
|
514
|
+
const f = r ? e.map((d) => d.getRemote()) : e[0].getRemote();
|
|
515
515
|
let g;
|
|
516
516
|
try {
|
|
517
517
|
g = i(f);
|
|
@@ -532,56 +532,56 @@ function Mt(t) {
|
|
|
532
532
|
function e(a) {
|
|
533
533
|
return ct(t.name, a);
|
|
534
534
|
}
|
|
535
|
-
const n = Lt(e),
|
|
535
|
+
const n = Lt(e), r = kt(e), o = xt(e), i = {}, u = [];
|
|
536
536
|
let l = [], f;
|
|
537
537
|
const g = () => (f == null ? f = 0 : f++, f);
|
|
538
538
|
function d(a) {
|
|
539
539
|
let c = i[a];
|
|
540
|
-
return c == null && (c =
|
|
540
|
+
return c == null && (c = r(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
542
|
function m(a) {
|
|
543
543
|
return a.map(d);
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function v(...a) {
|
|
546
546
|
const c = g(), p = Array(c).fill(!1);
|
|
547
|
-
a.forEach((
|
|
548
|
-
|
|
547
|
+
a.forEach((C) => {
|
|
548
|
+
C.forEach((S) => {
|
|
549
549
|
S.depGroup != null && (p[S.depGroup] = !0), S.depGroup = c;
|
|
550
550
|
});
|
|
551
|
-
}), Object.values(i).forEach((
|
|
552
|
-
|
|
551
|
+
}), Object.values(i).forEach((C) => {
|
|
552
|
+
C.depGroup != null && C.depGroup !== c && p[C.depGroup] && (C.depGroup = c);
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
555
|
t.onDeclare = (a) => {
|
|
556
556
|
const c = m(a.map((p) => p.name));
|
|
557
557
|
for (let p = 0; p < a.length; p++)
|
|
558
558
|
a[p].version != null && (c[p].remoteVersion = a[p].version);
|
|
559
|
-
|
|
559
|
+
v(c), R();
|
|
560
560
|
}, t.onDone = () => {
|
|
561
561
|
L || (L = !0, Object.values(i).forEach((a) => {
|
|
562
562
|
a.remoteVersion == null && (a.remoteVersion = 0);
|
|
563
|
-
}),
|
|
563
|
+
}), R());
|
|
564
564
|
}, t.onProvide = (a, c, p) => {
|
|
565
|
-
let
|
|
566
|
-
if (
|
|
565
|
+
let C = i[a];
|
|
566
|
+
if (C == null)
|
|
567
567
|
throw new Error(e(`Contract not declared : ${a}`));
|
|
568
|
-
if (
|
|
569
|
-
throw new Error(e(`Remote declared version ${
|
|
570
|
-
if (
|
|
568
|
+
if (C.remoteVersion != c)
|
|
569
|
+
throw new Error(e(`Remote declared version ${C.remoteVersion} of contract "${a}" but provided version ${c}.`));
|
|
570
|
+
if (C.remoteInterfaceReceived)
|
|
571
571
|
throw new Error(e(`Remote contract "${a}" is already provided.`));
|
|
572
|
-
|
|
572
|
+
C.setRemoteInterface(p), R();
|
|
573
573
|
};
|
|
574
|
-
let y = !1,
|
|
575
|
-
async function
|
|
576
|
-
if (
|
|
577
|
-
for (y = !0;
|
|
578
|
-
if (
|
|
574
|
+
let y = !1, E = !1, h = !1, T = !1, L = !1;
|
|
575
|
+
async function R() {
|
|
576
|
+
if (E = !0, !y) {
|
|
577
|
+
for (y = !0; E; ) {
|
|
578
|
+
if (E = !1, t.isReady) {
|
|
579
579
|
const a = u.filter((c) => !c.isDeclared);
|
|
580
580
|
if (a.length > 0)
|
|
581
581
|
for (const c of a) {
|
|
582
582
|
const p = Array(c.args.length + c.deps.length);
|
|
583
|
-
c.args.forEach((
|
|
584
|
-
|
|
583
|
+
c.args.forEach((C, S) => p[S] = C), c.deps.forEach((C, S) => p[S + c.args.length] = C), await t.declare(p.map((C) => ({ name: C.name, version: C.localVersion }))), p.forEach((C) => {
|
|
584
|
+
C.localVersion != null && (C.localVersionSent = !0);
|
|
585
585
|
}), c.isDeclared = !0;
|
|
586
586
|
}
|
|
587
587
|
}
|
|
@@ -597,9 +597,9 @@ function Mt(t) {
|
|
|
597
597
|
if (a.length > 0)
|
|
598
598
|
for (const c of a) {
|
|
599
599
|
const p = c.invoke();
|
|
600
|
-
for (let
|
|
601
|
-
const S = c.args[
|
|
602
|
-
await t.provide(S.name, S.localVersion, p[
|
|
600
|
+
for (let C = 0; C < c.args.length; C++) {
|
|
601
|
+
const S = c.args[C];
|
|
602
|
+
await t.provide(S.name, S.localVersion, p[C]), S.localInterfaceSent = !0;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
}
|
|
@@ -631,7 +631,7 @@ function Mt(t) {
|
|
|
631
631
|
get(a) {
|
|
632
632
|
return d(a);
|
|
633
633
|
},
|
|
634
|
-
declareFactory: (a, c, p,
|
|
634
|
+
declareFactory: (a, c, p, C) => {
|
|
635
635
|
if (h) throw new Error(e("Cannot declare a factory after done has been set to true."));
|
|
636
636
|
const S = m(a.map((F) => F.name));
|
|
637
637
|
{
|
|
@@ -642,13 +642,13 @@ function Mt(t) {
|
|
|
642
642
|
for (let F = 0; F < a.length; F++)
|
|
643
643
|
S[F].localVersion = a[F].version;
|
|
644
644
|
const k = m(c);
|
|
645
|
-
|
|
646
|
-
const gt = o(S, k, p,
|
|
647
|
-
u.push(gt),
|
|
645
|
+
v(S, k);
|
|
646
|
+
const gt = o(S, k, p, C);
|
|
647
|
+
u.push(gt), R();
|
|
648
648
|
},
|
|
649
|
-
declareCallback(a, c, p,
|
|
650
|
-
const S = m(a), k = n(S, c, p,
|
|
651
|
-
!y && l.length === 0 && k.isReady ? k.invoke() : (l.push(k),
|
|
649
|
+
declareCallback(a, c, p, C) {
|
|
650
|
+
const S = m(a), k = n(S, c, p, C);
|
|
651
|
+
!y && l.length === 0 && k.isReady ? k.invoke() : (l.push(k), R());
|
|
652
652
|
},
|
|
653
653
|
get done() {
|
|
654
654
|
return h;
|
|
@@ -659,30 +659,30 @@ function Mt(t) {
|
|
|
659
659
|
} else
|
|
660
660
|
a && (h = !0, Object.values(i).forEach((c) => {
|
|
661
661
|
c.localVersion == null && (c.localVersion = 0);
|
|
662
|
-
}),
|
|
662
|
+
}), R());
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
|
-
const
|
|
667
|
-
function
|
|
668
|
-
const [e, n,
|
|
669
|
-
if (n == null ||
|
|
666
|
+
const Pt = /^\d+$/;
|
|
667
|
+
function Gt(t) {
|
|
668
|
+
const [e, n, r] = t.split(":", 3);
|
|
669
|
+
if (n == null || r != null || !Pt.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
|
|
673
|
+
function Dt(t) {
|
|
674
674
|
const e = Mt(t);
|
|
675
|
-
function n(
|
|
676
|
-
return ct(t.name,
|
|
675
|
+
function n(r) {
|
|
676
|
+
return ct(t.name, r);
|
|
677
677
|
}
|
|
678
678
|
return {
|
|
679
|
-
plug(
|
|
679
|
+
plug(r, o, i = void 0) {
|
|
680
680
|
if (e.done) throw new Error(n("Cannot plug after plugsDone."));
|
|
681
681
|
i == null && (i = o, o = []);
|
|
682
682
|
let u = !0;
|
|
683
|
-
Array.isArray(
|
|
684
|
-
const l =
|
|
685
|
-
const g =
|
|
683
|
+
Array.isArray(r) || (r = [r], u = !1);
|
|
684
|
+
const l = r.map((f) => {
|
|
685
|
+
const g = Gt(f);
|
|
686
686
|
if (g == null)
|
|
687
687
|
throw new Error(n("Invalid contract id : " + f));
|
|
688
688
|
return g;
|
|
@@ -692,39 +692,39 @@ function Pt(t) {
|
|
|
692
692
|
plugsDone() {
|
|
693
693
|
e.done = !0;
|
|
694
694
|
},
|
|
695
|
-
use(
|
|
695
|
+
use(r, o) {
|
|
696
696
|
let i = !0;
|
|
697
|
-
Array.isArray(
|
|
697
|
+
Array.isArray(r) || (r = [r], i = !1), e.declareCallback(r, o, i);
|
|
698
698
|
},
|
|
699
|
-
exec(
|
|
699
|
+
exec(r, o) {
|
|
700
700
|
let i = !0;
|
|
701
|
-
return Array.isArray(
|
|
702
|
-
e.declareCallback(
|
|
701
|
+
return Array.isArray(r) || (r = [r], i = !1), new Promise((...u) => {
|
|
702
|
+
e.declareCallback(r, o, i, u);
|
|
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 W;
|
|
712
712
|
function Vt(t) {
|
|
713
|
-
return W != null || (W =
|
|
713
|
+
return W != null || (W = Dt(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(),
|
|
718
|
+
const n = /* @__PURE__ */ new Set(), r = (g, d) => {
|
|
719
719
|
const m = typeof g == "function" ? g(e) : g;
|
|
720
720
|
if (!Object.is(m, e)) {
|
|
721
|
-
const
|
|
722
|
-
e = d ?? (typeof m != "object" || m === null) ? m : Object.assign({}, e, m), n.forEach((y) => y(e,
|
|
721
|
+
const v = e;
|
|
722
|
+
e = d ?? (typeof m != "object" || m === null) ? m : Object.assign({}, e, m), n.forEach((y) => y(e, v));
|
|
723
723
|
}
|
|
724
|
-
}, o = () => e, l = { setState:
|
|
724
|
+
}, o = () => e, l = { setState: r, getState: o, getInitialState: () => f, subscribe: (g) => (n.add(g), () => n.delete(g)) }, f = e = t(r, o, l);
|
|
725
725
|
return l;
|
|
726
726
|
}, It = ((t) => t ? K(t) : K), jt = (t) => t;
|
|
727
|
-
function
|
|
727
|
+
function Ot(t, e = jt) {
|
|
728
728
|
const n = M.useSyncExternalStore(
|
|
729
729
|
t.subscribe,
|
|
730
730
|
M.useCallback(() => e(t.getState()), [t, e]),
|
|
@@ -733,26 +733,26 @@ function $t(t, e = jt) {
|
|
|
733
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 = (r) => Ot(e, r);
|
|
737
737
|
return Object.assign(n, e), n;
|
|
738
|
-
}, dt = ((t) => t ? X(t) : X),
|
|
739
|
-
const o =
|
|
740
|
-
return
|
|
738
|
+
}, dt = ((t) => t ? X(t) : X), $t = (t) => (e, n, r) => {
|
|
739
|
+
const o = r.subscribe;
|
|
740
|
+
return r.subscribe = ((u, l, f) => {
|
|
741
741
|
let g = u;
|
|
742
742
|
if (l) {
|
|
743
743
|
const d = f?.equalityFn || Object.is;
|
|
744
|
-
let m = u(
|
|
745
|
-
g = (
|
|
746
|
-
const y = u(
|
|
744
|
+
let m = u(r.getState());
|
|
745
|
+
g = (v) => {
|
|
746
|
+
const y = u(v);
|
|
747
747
|
if (!d(m, y)) {
|
|
748
|
-
const
|
|
749
|
-
l(m = y,
|
|
748
|
+
const E = m;
|
|
749
|
+
l(m = y, E);
|
|
750
750
|
}
|
|
751
751
|
}, f?.fireImmediately && l(m, m);
|
|
752
752
|
}
|
|
753
753
|
return o(g);
|
|
754
|
-
}), t(e, n,
|
|
755
|
-
}, Nt =
|
|
754
|
+
}), t(e, n, r);
|
|
755
|
+
}, Nt = $t, s = dt()(
|
|
756
756
|
Nt((t) => ({
|
|
757
757
|
ready: !1,
|
|
758
758
|
workflow: "current",
|
|
@@ -855,7 +855,15 @@ const X = (t) => {
|
|
|
855
855
|
incSaveCount: () => t((e) => ({
|
|
856
856
|
saveCount: e.saveCount + 1
|
|
857
857
|
})),
|
|
858
|
-
incDirtyCount: () => t((e) => ({ isDirtyCount: e.isDirtyCount + 1 }))
|
|
858
|
+
incDirtyCount: () => t((e) => ({ isDirtyCount: e.isDirtyCount + 1 })),
|
|
859
|
+
previewStartPreviewFunction: null,
|
|
860
|
+
previewStopPreviewFunction: null,
|
|
861
|
+
setPreviewStartPreviewFunction: (e) => {
|
|
862
|
+
t({ previewStartPreviewFunction: e });
|
|
863
|
+
},
|
|
864
|
+
setPreviewStopPreviewFunction: (e) => {
|
|
865
|
+
t({ previewStopPreviewFunction: e });
|
|
866
|
+
}
|
|
859
867
|
}))
|
|
860
868
|
);
|
|
861
869
|
let Z = !1;
|
|
@@ -878,7 +886,7 @@ const qt = [
|
|
|
878
886
|
], tt = {
|
|
879
887
|
"mode:1": {
|
|
880
888
|
setMode: (t) => {
|
|
881
|
-
|
|
889
|
+
s.setState({ mode: t });
|
|
882
890
|
}
|
|
883
891
|
},
|
|
884
892
|
"reload:1": {
|
|
@@ -889,75 +897,75 @@ const qt = [
|
|
|
889
897
|
"theme:1": {
|
|
890
898
|
setTheme: (t) => {
|
|
891
899
|
if (t === null) {
|
|
892
|
-
|
|
900
|
+
s.setState({ theme: null });
|
|
893
901
|
return;
|
|
894
902
|
}
|
|
895
903
|
if (t !== "light" && t !== "dark") {
|
|
896
904
|
console.warn(
|
|
897
905
|
`[React bindings] Invalid theme: ${t}. Expected 'light' or 'dark'.`
|
|
898
|
-
),
|
|
906
|
+
), s.setState({ theme: null });
|
|
899
907
|
return;
|
|
900
908
|
}
|
|
901
|
-
|
|
909
|
+
s.setState({ theme: t });
|
|
902
910
|
}
|
|
903
911
|
},
|
|
904
912
|
"workflow:1": {
|
|
905
913
|
setWorkflow: (t) => {
|
|
906
|
-
|
|
914
|
+
s.setState({ workflow: t });
|
|
907
915
|
}
|
|
908
916
|
},
|
|
909
917
|
"workflow:2": {
|
|
910
918
|
setWorkflow: (t) => {
|
|
911
|
-
|
|
919
|
+
s.setState({ workflow: t });
|
|
912
920
|
}
|
|
913
921
|
},
|
|
914
922
|
"trigger-save:1": {
|
|
915
923
|
setCanSave(t) {
|
|
916
|
-
|
|
924
|
+
s.setState({ canSave: t });
|
|
917
925
|
}
|
|
918
926
|
},
|
|
919
927
|
"simple-content(text):1": {
|
|
920
928
|
contentSaved: () => {
|
|
921
|
-
|
|
929
|
+
s.setState((t) => ({
|
|
922
930
|
afterSaveCount: t.afterSaveCount + 1
|
|
923
931
|
}));
|
|
924
932
|
},
|
|
925
|
-
getContent: () =>
|
|
933
|
+
getContent: () => s.getState().getTextContentFunction(),
|
|
926
934
|
loadContent: (t) => {
|
|
927
|
-
|
|
935
|
+
s.setState({ loadedTextContent: t });
|
|
928
936
|
}
|
|
929
937
|
},
|
|
930
938
|
"simple-content(json):1": {
|
|
931
939
|
contentSaved: () => {
|
|
932
|
-
|
|
940
|
+
s.setState((t) => ({
|
|
933
941
|
afterSaveCount: t.afterSaveCount + 1
|
|
934
942
|
}));
|
|
935
943
|
},
|
|
936
|
-
getContent: () =>
|
|
944
|
+
getContent: () => s.getState().getJsonContentFunction(),
|
|
937
945
|
loadContent: (t) => {
|
|
938
|
-
|
|
946
|
+
s.setState({ loadedJsonContent: t });
|
|
939
947
|
}
|
|
940
948
|
},
|
|
941
949
|
"simple-binary-data(text):1": {
|
|
942
950
|
contentSaved: () => {
|
|
943
|
-
|
|
951
|
+
s.setState((t) => ({
|
|
944
952
|
afterSaveCount: t.afterSaveCount + 1
|
|
945
953
|
}));
|
|
946
954
|
},
|
|
947
|
-
getContent: () =>
|
|
955
|
+
getContent: () => s.getState().getTextContentFunction(),
|
|
948
956
|
loadContent: (t) => {
|
|
949
|
-
|
|
957
|
+
s.setState({ loadedTextContent: t });
|
|
950
958
|
}
|
|
951
959
|
},
|
|
952
960
|
"simple-content-eval(text):1": {
|
|
953
961
|
contentSaved: () => {
|
|
954
|
-
|
|
962
|
+
s.setState((t) => ({
|
|
955
963
|
afterSaveCount: t.afterSaveCount + 1
|
|
956
964
|
}));
|
|
957
965
|
},
|
|
958
|
-
getContent: () =>
|
|
966
|
+
getContent: () => s.getState().getTextContentFunction(),
|
|
959
967
|
loadContent: (t) => {
|
|
960
|
-
|
|
968
|
+
s.setState({ loadedTextContent: t });
|
|
961
969
|
},
|
|
962
970
|
getAssignmentContent: () => {
|
|
963
971
|
throw new Error(
|
|
@@ -967,13 +975,13 @@ const qt = [
|
|
|
967
975
|
},
|
|
968
976
|
"simple-content-eval(json):1": {
|
|
969
977
|
contentSaved: () => {
|
|
970
|
-
|
|
978
|
+
s.setState((t) => ({
|
|
971
979
|
afterSaveCount: t.afterSaveCount + 1
|
|
972
980
|
}));
|
|
973
981
|
},
|
|
974
|
-
getContent: () =>
|
|
982
|
+
getContent: () => s.getState().getJsonContentFunction(),
|
|
975
983
|
loadContent: (t) => {
|
|
976
|
-
|
|
984
|
+
s.setState({ loadedJsonContent: t });
|
|
977
985
|
},
|
|
978
986
|
getAssignmentContent: () => {
|
|
979
987
|
throw new Error(
|
|
@@ -983,13 +991,13 @@ const qt = [
|
|
|
983
991
|
},
|
|
984
992
|
"simple-content-eval(json):2": {
|
|
985
993
|
contentSaved: () => {
|
|
986
|
-
|
|
994
|
+
s.setState((t) => ({
|
|
987
995
|
afterSaveCount: t.afterSaveCount + 1
|
|
988
996
|
}));
|
|
989
997
|
},
|
|
990
|
-
getContent: () =>
|
|
998
|
+
getContent: () => s.getState().getJsonContentFunction(),
|
|
991
999
|
loadContent: (t) => {
|
|
992
|
-
|
|
1000
|
+
s.setState({ loadedJsonContent: t });
|
|
993
1001
|
},
|
|
994
1002
|
getAssignmentContent: () => {
|
|
995
1003
|
throw new Error(
|
|
@@ -999,13 +1007,13 @@ const qt = [
|
|
|
999
1007
|
},
|
|
1000
1008
|
"simple-content-eval(text):2": {
|
|
1001
1009
|
contentSaved: () => {
|
|
1002
|
-
|
|
1010
|
+
s.setState((t) => ({
|
|
1003
1011
|
afterSaveCount: t.afterSaveCount + 1
|
|
1004
1012
|
}));
|
|
1005
1013
|
},
|
|
1006
|
-
getContent: () =>
|
|
1014
|
+
getContent: () => s.getState().getTextContentFunction(),
|
|
1007
1015
|
loadContent: (t) => {
|
|
1008
|
-
|
|
1016
|
+
s.setState({ loadedTextContent: t });
|
|
1009
1017
|
},
|
|
1010
1018
|
getAssignmentContent: () => {
|
|
1011
1019
|
throw new Error(
|
|
@@ -1015,52 +1023,52 @@ const qt = [
|
|
|
1015
1023
|
},
|
|
1016
1024
|
"separate-contents(json):1": {
|
|
1017
1025
|
contentSaved: () => {
|
|
1018
|
-
|
|
1026
|
+
s.setState((t) => ({
|
|
1019
1027
|
afterSaveCount: t.afterSaveCount + 1
|
|
1020
1028
|
}));
|
|
1021
1029
|
},
|
|
1022
1030
|
loadContent: (t, e) => {
|
|
1023
|
-
|
|
1031
|
+
s.setState({
|
|
1024
1032
|
loadedJsonActivityContent: t,
|
|
1025
1033
|
loadedJsonAssignmentContent: e
|
|
1026
1034
|
});
|
|
1027
1035
|
},
|
|
1028
|
-
getActivityContent: () =>
|
|
1029
|
-
getAssignmentContent: () =>
|
|
1036
|
+
getActivityContent: () => s.getState().getJsonActivityContentFunction(),
|
|
1037
|
+
getAssignmentContent: () => s.getState().getJsonAssignmentContentFunction()
|
|
1030
1038
|
},
|
|
1031
1039
|
"separate-contents-eval(json):1": {
|
|
1032
1040
|
contentSaved: () => {
|
|
1033
|
-
|
|
1041
|
+
s.setState((t) => ({
|
|
1034
1042
|
afterSaveCount: t.afterSaveCount + 1
|
|
1035
1043
|
}));
|
|
1036
1044
|
},
|
|
1037
1045
|
loadContent: (t, e) => {
|
|
1038
|
-
|
|
1046
|
+
s.setState({
|
|
1039
1047
|
loadedJsonActivityContent: t,
|
|
1040
1048
|
loadedJsonAssignmentContent: e
|
|
1041
1049
|
});
|
|
1042
1050
|
},
|
|
1043
|
-
getActivityContent: () =>
|
|
1044
|
-
getAssignmentContent: () =>
|
|
1051
|
+
getActivityContent: () => s.getState().getJsonActivityContentFunction(),
|
|
1052
|
+
getAssignmentContent: () => s.getState().getJsonAssignmentContentFunction()
|
|
1045
1053
|
},
|
|
1046
1054
|
"separate-contents-eval(json):2": {
|
|
1047
1055
|
contentSaved: () => {
|
|
1048
|
-
|
|
1056
|
+
s.setState((t) => ({
|
|
1049
1057
|
afterSaveCount: t.afterSaveCount + 1
|
|
1050
1058
|
}));
|
|
1051
1059
|
},
|
|
1052
1060
|
loadContent: (t, e) => {
|
|
1053
|
-
|
|
1061
|
+
s.setState({
|
|
1054
1062
|
loadedJsonActivityContent: t,
|
|
1055
1063
|
loadedJsonAssignmentContent: e
|
|
1056
1064
|
});
|
|
1057
1065
|
},
|
|
1058
|
-
getActivityContent: () =>
|
|
1059
|
-
getAssignmentContent: () =>
|
|
1066
|
+
getActivityContent: () => s.getState().getJsonActivityContentFunction(),
|
|
1067
|
+
getAssignmentContent: () => s.getState().getJsonAssignmentContentFunction()
|
|
1060
1068
|
},
|
|
1061
1069
|
"separate-dual-contents(json):1": {
|
|
1062
1070
|
contentSaved: () => {
|
|
1063
|
-
|
|
1071
|
+
s.setState((t) => ({
|
|
1064
1072
|
afterSaveCount: t.afterSaveCount + 1
|
|
1065
1073
|
}));
|
|
1066
1074
|
},
|
|
@@ -1068,19 +1076,19 @@ const qt = [
|
|
|
1068
1076
|
activityContent: t,
|
|
1069
1077
|
assignmentContent: e,
|
|
1070
1078
|
activityBinaryData: n,
|
|
1071
|
-
assignmentBinaryData:
|
|
1079
|
+
assignmentBinaryData: r
|
|
1072
1080
|
}) => {
|
|
1073
|
-
|
|
1081
|
+
s.setState({
|
|
1074
1082
|
loadedJsonActivityContent: t,
|
|
1075
1083
|
loadedJsonAssignmentContent: e,
|
|
1076
1084
|
loadedJsonActivityBinaryData: n,
|
|
1077
|
-
loadedJsonAssignmentBinaryData:
|
|
1085
|
+
loadedJsonAssignmentBinaryData: r
|
|
1078
1086
|
});
|
|
1079
1087
|
},
|
|
1080
|
-
getActivityContentAndData: () =>
|
|
1081
|
-
getAssignmentContentAndData: () =>
|
|
1088
|
+
getActivityContentAndData: () => s.getState().getJsonActivitySplitContentFunction(),
|
|
1089
|
+
getAssignmentContentAndData: () => s.getState().getJsonAssignmentSplitContentFunction()
|
|
1082
1090
|
},
|
|
1083
|
-
"
|
|
1091
|
+
"anti-cheat:1": {
|
|
1084
1092
|
lock: () => {
|
|
1085
1093
|
},
|
|
1086
1094
|
unlock: () => {
|
|
@@ -1088,25 +1096,25 @@ const qt = [
|
|
|
1088
1096
|
},
|
|
1089
1097
|
"meta-player-ui:1": {
|
|
1090
1098
|
executeAction(t) {
|
|
1091
|
-
if (
|
|
1092
|
-
const n =
|
|
1099
|
+
if (t.startsWith("qa")) {
|
|
1100
|
+
const n = s.getState().quickActions[t];
|
|
1093
1101
|
n ? n() : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1094
1102
|
} else {
|
|
1095
|
-
const n =
|
|
1103
|
+
const n = s.getState().sidebarActions[t];
|
|
1096
1104
|
n ? n() : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1097
1105
|
}
|
|
1098
1106
|
},
|
|
1099
1107
|
executeFileUpload(t, e) {
|
|
1100
1108
|
if (t.startsWith("qa")) {
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1109
|
+
const r = s.getState().quickActions[t];
|
|
1110
|
+
r ? r(e) : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1103
1111
|
} else {
|
|
1104
|
-
const
|
|
1105
|
-
|
|
1112
|
+
const r = s.getState().sidebarActions[t];
|
|
1113
|
+
r ? r(e) : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1106
1114
|
}
|
|
1107
1115
|
},
|
|
1108
1116
|
updateSettings(t) {
|
|
1109
|
-
const e =
|
|
1117
|
+
const e = s.getState().activitySettingsCallback;
|
|
1110
1118
|
e ? e(t) : console.warn(
|
|
1111
1119
|
"activitySettingsCallback is not set. Changes:",
|
|
1112
1120
|
t
|
|
@@ -1115,166 +1123,166 @@ const qt = [
|
|
|
1115
1123
|
},
|
|
1116
1124
|
"meta-player-events:1": {
|
|
1117
1125
|
handleEvent(t) {
|
|
1118
|
-
t === "all-loaded" &&
|
|
1126
|
+
t === "all-loaded" && s.setState({ ready: !0 });
|
|
1119
1127
|
}
|
|
1120
1128
|
},
|
|
1121
1129
|
"llm:1": {
|
|
1122
1130
|
getFirstMessageContext: (t) => {
|
|
1123
|
-
const e =
|
|
1131
|
+
const e = s.getState().llmGetFirstMessageContextFunction;
|
|
1124
1132
|
return e ? e(t) : "";
|
|
1125
1133
|
},
|
|
1126
1134
|
getAllMessagesContext: (t) => {
|
|
1127
|
-
const e =
|
|
1135
|
+
const e = s.getState().llmGetAllMessagesContextFunction;
|
|
1128
1136
|
return e ? e(t) : "";
|
|
1129
1137
|
},
|
|
1130
1138
|
getAvailableTools: (t) => {
|
|
1131
|
-
const e =
|
|
1139
|
+
const e = s.getState().llmGetAvailableToolsFunction;
|
|
1132
1140
|
return e ? e(t) : [];
|
|
1133
1141
|
},
|
|
1134
|
-
callTool: (t, e) => {
|
|
1135
|
-
const
|
|
1136
|
-
if (!
|
|
1142
|
+
callTool: (t, e, n) => {
|
|
1143
|
+
const r = s.getState().llmCallToolFunction;
|
|
1144
|
+
if (!r)
|
|
1137
1145
|
throw new Error("LLM call tool function is not set");
|
|
1138
|
-
return
|
|
1146
|
+
return r(t, e, n);
|
|
1139
1147
|
},
|
|
1140
|
-
getToolCallDescription: (t, e) => {
|
|
1141
|
-
const
|
|
1142
|
-
if (!
|
|
1148
|
+
getToolCallDescription: (t, e, n) => {
|
|
1149
|
+
const r = s.getState().llmDescribeToolFunction;
|
|
1150
|
+
if (!r)
|
|
1143
1151
|
throw new Error("LLM describe tool function is not set");
|
|
1144
|
-
return
|
|
1152
|
+
return r(t, e, n);
|
|
1145
1153
|
}
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
)
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
if (!qt.includes(e)) {
|
|
1158
|
-
console.warn(
|
|
1159
|
-
`[React bindings] Contract ${e} is not implemented in Capytale. Skipping plug.`
|
|
1160
|
-
);
|
|
1161
|
-
continue;
|
|
1162
|
-
}
|
|
1163
|
-
if (!(e in tt)) {
|
|
1164
|
-
console.warn(
|
|
1165
|
-
`[React bindings] Contract handler for ${e} is not defined. Skipping plug.`
|
|
1166
|
-
);
|
|
1167
|
-
continue;
|
|
1154
|
+
},
|
|
1155
|
+
"preview:1": {
|
|
1156
|
+
startPreview: () => {
|
|
1157
|
+
const t = s.getState().previewStartPreviewFunction;
|
|
1158
|
+
return t ? t() : !1;
|
|
1159
|
+
},
|
|
1160
|
+
stopPreview: () => {
|
|
1161
|
+
const t = s.getState().previewStopPreviewFunction;
|
|
1162
|
+
if (!t)
|
|
1163
|
+
throw new Error("Preview stop function is not set");
|
|
1164
|
+
return t();
|
|
1168
1165
|
}
|
|
1169
|
-
const n = tt[e];
|
|
1170
|
-
console.log(`[React bindings] Plugging contract ${e}...`), b.plug([e], ([]) => (console.log(`[React bindings] Contract ${e} plugged.`), [n]));
|
|
1171
1166
|
}
|
|
1172
|
-
|
|
1173
|
-
for
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
`[React bindings] Contract ${e} is being subscribed to content changes.`
|
|
1186
|
-
), t.includes(e)) {
|
|
1187
|
-
console.log(
|
|
1188
|
-
`[React bindings] Subscribing to content changes for contract ${e}`
|
|
1189
|
-
);
|
|
1190
|
-
const n = e.split(":")[0];
|
|
1191
|
-
b.use([n], ([s]) => {
|
|
1192
|
-
r.subscribe(
|
|
1193
|
-
(o) => o.isDirtyCount,
|
|
1194
|
-
() => {
|
|
1195
|
-
s.i?.contentChanged(), console.log(
|
|
1196
|
-
`[React bindings] Content changed for contract ${n}`
|
|
1197
|
-
);
|
|
1198
|
-
}
|
|
1167
|
+
}, A = (
|
|
1168
|
+
// Workaround for typing inference issue
|
|
1169
|
+
Vt()
|
|
1170
|
+
);
|
|
1171
|
+
function Wt(t) {
|
|
1172
|
+
if (!Z) {
|
|
1173
|
+
Z = !0;
|
|
1174
|
+
for (const e of t) {
|
|
1175
|
+
if (!qt.includes(e))
|
|
1176
|
+
continue;
|
|
1177
|
+
if (!(e in tt)) {
|
|
1178
|
+
console.warn(
|
|
1179
|
+
`[React bindings] Contract handler for ${e} is not defined. Skipping plug.`
|
|
1199
1180
|
);
|
|
1200
|
-
|
|
1181
|
+
continue;
|
|
1182
|
+
}
|
|
1183
|
+
const n = tt[e];
|
|
1184
|
+
A.plug([e], ([]) => [n]);
|
|
1201
1185
|
}
|
|
1186
|
+
A.plugsDone();
|
|
1187
|
+
for (const e of [
|
|
1188
|
+
"simple-content(text):1",
|
|
1189
|
+
"simple-content(json):1",
|
|
1190
|
+
"simple-binary-data(text):1",
|
|
1191
|
+
"simple-content-eval(text):1",
|
|
1192
|
+
"simple-content-eval(json):1",
|
|
1193
|
+
"simple-content-eval(json):2",
|
|
1194
|
+
"simple-content-eval(text):2",
|
|
1195
|
+
"separate-contents(json):1",
|
|
1196
|
+
"separate-dual-contents(json):1"
|
|
1197
|
+
])
|
|
1198
|
+
if (t.includes(e)) {
|
|
1199
|
+
const n = e.split(":")[0];
|
|
1200
|
+
A.use([n], ([r]) => {
|
|
1201
|
+
s.subscribe(
|
|
1202
|
+
(o) => o.isDirtyCount,
|
|
1203
|
+
() => {
|
|
1204
|
+
r.i?.contentChanged();
|
|
1205
|
+
}
|
|
1206
|
+
);
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1202
1210
|
}
|
|
1203
|
-
const re = () =>
|
|
1211
|
+
const re = () => s((t) => {
|
|
1204
1212
|
if (t.mode === null)
|
|
1205
1213
|
throw new Error("Mode is not set. Have you used contract 'mode'?");
|
|
1206
1214
|
return t.mode;
|
|
1207
|
-
}), se = () =>
|
|
1215
|
+
}), se = () => s((t) => {
|
|
1208
1216
|
if (t.workflow === null)
|
|
1209
1217
|
throw new Error(
|
|
1210
1218
|
"Workflow is not set. Have you used contract 'workflow'?"
|
|
1211
1219
|
);
|
|
1212
1220
|
return t.workflow;
|
|
1213
|
-
}), ie = () =>
|
|
1221
|
+
}), ie = () => s((t) => {
|
|
1214
1222
|
if (t.theme === null)
|
|
1215
1223
|
throw new Error("Theme is not set. Have you used contract 'theme'?");
|
|
1216
1224
|
return t.theme;
|
|
1217
|
-
}), ae = () =>
|
|
1225
|
+
}), ae = () => s((t) => t.incSaveCount), le = () => s((t) => t.incDirtyCount), ce = () => s((t) => t.loadedTextContent), ue = () => s((t) => t.loadedJsonContent), de = () => s((t) => t.loadedJsonActivityContent), ge = () => s((t) => t.loadedJsonAssignmentContent), fe = () => s((t) => t.loadedJsonActivityBinaryData), me = () => s((t) => t.loadedJsonAssignmentBinaryData), pe = () => b(() => s.getState().loadedTextContent, []), ve = () => b(() => s.getState().loadedJsonContent, []), Ce = () => b(() => s.getState().loadedJsonActivityContent, []), ye = () => b(() => s.getState().loadedJsonAssignmentContent, []), Se = () => b(
|
|
1218
1226
|
() => ({
|
|
1219
|
-
content:
|
|
1220
|
-
binaryData:
|
|
1227
|
+
content: s.getState().loadedJsonActivityContent,
|
|
1228
|
+
binaryData: s.getState().loadedJsonActivityBinaryData
|
|
1221
1229
|
}),
|
|
1222
1230
|
[]
|
|
1223
|
-
),
|
|
1231
|
+
), we = () => b(
|
|
1224
1232
|
() => ({
|
|
1225
|
-
content:
|
|
1226
|
-
binaryData:
|
|
1233
|
+
content: s.getState().loadedJsonAssignmentContent,
|
|
1234
|
+
binaryData: s.getState().loadedJsonAssignmentBinaryData
|
|
1227
1235
|
}),
|
|
1228
1236
|
[]
|
|
1229
|
-
),
|
|
1230
|
-
const e =
|
|
1237
|
+
), Ae = (t) => {
|
|
1238
|
+
const e = s(
|
|
1231
1239
|
(n) => n.setGetTextContentFunction
|
|
1232
1240
|
);
|
|
1233
|
-
|
|
1241
|
+
w(() => {
|
|
1234
1242
|
e(t);
|
|
1235
1243
|
}, [t, e]);
|
|
1236
|
-
},
|
|
1237
|
-
const e =
|
|
1244
|
+
}, be = (t) => {
|
|
1245
|
+
const e = s(
|
|
1238
1246
|
(n) => n.setGetJsonContentFunction
|
|
1239
1247
|
);
|
|
1240
|
-
|
|
1248
|
+
w(() => {
|
|
1241
1249
|
e(t);
|
|
1242
1250
|
}, [t, e]);
|
|
1243
1251
|
}, he = (t) => {
|
|
1244
|
-
const e =
|
|
1252
|
+
const e = s(
|
|
1245
1253
|
(n) => n.setGetJsonActivityContentFunction
|
|
1246
1254
|
);
|
|
1247
|
-
|
|
1255
|
+
w(() => {
|
|
1248
1256
|
e(t);
|
|
1249
1257
|
}, [t, e]);
|
|
1250
1258
|
}, Fe = (t) => {
|
|
1251
|
-
const e =
|
|
1259
|
+
const e = s(
|
|
1252
1260
|
(n) => n.setGetJsonAssignmentContentFunction
|
|
1253
1261
|
);
|
|
1254
|
-
|
|
1262
|
+
w(() => {
|
|
1255
1263
|
e(t);
|
|
1256
1264
|
}, [t, e]);
|
|
1257
|
-
},
|
|
1258
|
-
const e =
|
|
1265
|
+
}, Ee = (t) => {
|
|
1266
|
+
const e = s(
|
|
1259
1267
|
(n) => n.setGetJsonActivitySplitContentFunction
|
|
1260
1268
|
);
|
|
1261
|
-
|
|
1269
|
+
w(() => {
|
|
1262
1270
|
e(t);
|
|
1263
1271
|
}, [t, e]);
|
|
1264
|
-
},
|
|
1265
|
-
const e =
|
|
1272
|
+
}, Re = (t) => {
|
|
1273
|
+
const e = s(
|
|
1266
1274
|
(n) => n.setGetJsonAssignmentSplitContentFunction
|
|
1267
1275
|
);
|
|
1268
|
-
|
|
1276
|
+
w(() => {
|
|
1269
1277
|
e(t);
|
|
1270
1278
|
}, [t, e]);
|
|
1271
1279
|
}, Je = (t) => {
|
|
1272
|
-
const e =
|
|
1273
|
-
|
|
1280
|
+
const e = s((n) => n.afterSaveCount);
|
|
1281
|
+
w(() => {
|
|
1274
1282
|
e > 0 && t();
|
|
1275
1283
|
}, [e]);
|
|
1276
1284
|
}, Te = () => (t, e) => {
|
|
1277
|
-
|
|
1285
|
+
A.use(["meta-player-ui"], ([n]) => {
|
|
1278
1286
|
if (n.version === 0) {
|
|
1279
1287
|
console.error(
|
|
1280
1288
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1284,7 +1292,7 @@ const re = () => r((t) => {
|
|
|
1284
1292
|
n.i?.previewTextFile(t, e);
|
|
1285
1293
|
});
|
|
1286
1294
|
}, ke = () => (t, e) => {
|
|
1287
|
-
|
|
1295
|
+
A.use(["meta-player-ui"], ([n]) => {
|
|
1288
1296
|
if (n.version === 0) {
|
|
1289
1297
|
console.error(
|
|
1290
1298
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1294,15 +1302,15 @@ const re = () => r((t) => {
|
|
|
1294
1302
|
n.i?.previewImageFile(t, e);
|
|
1295
1303
|
});
|
|
1296
1304
|
};
|
|
1297
|
-
let
|
|
1305
|
+
let G = 0, B = 0;
|
|
1298
1306
|
const xe = (t, e) => {
|
|
1299
|
-
const n =
|
|
1300
|
-
|
|
1307
|
+
const n = _(t, e), r = s((o) => o.setSidebarActions);
|
|
1308
|
+
w(() => (G++, G > 1 && console.error(
|
|
1301
1309
|
"[React bindings] Capytale iframe React: Multiple sidebar actions registered: ",
|
|
1302
|
-
|
|
1310
|
+
G
|
|
1303
1311
|
), () => {
|
|
1304
|
-
|
|
1305
|
-
}), []),
|
|
1312
|
+
G--;
|
|
1313
|
+
}), []), w(() => (A.use(["meta-player-ui"], ([o]) => {
|
|
1306
1314
|
if (o.version === 0) {
|
|
1307
1315
|
console.error(
|
|
1308
1316
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1319,9 +1327,9 @@ const xe = (t, e) => {
|
|
|
1319
1327
|
})), u = {};
|
|
1320
1328
|
n.forEach((l, f) => {
|
|
1321
1329
|
u[`sa-${B}-${f}`] = l.action;
|
|
1322
|
-
}), o.i?.setSidebarActionButtons(i),
|
|
1330
|
+
}), o.i?.setSidebarActionButtons(i), r(u);
|
|
1323
1331
|
}), () => {
|
|
1324
|
-
|
|
1332
|
+
r({}), A.use(["meta-player-ui"], ([o]) => {
|
|
1325
1333
|
if (o.version === 0) {
|
|
1326
1334
|
console.error(
|
|
1327
1335
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1332,15 +1340,15 @@ const xe = (t, e) => {
|
|
|
1332
1340
|
});
|
|
1333
1341
|
}), [n]);
|
|
1334
1342
|
};
|
|
1335
|
-
let
|
|
1343
|
+
let D = 0, H = 0;
|
|
1336
1344
|
const Le = (t, e) => {
|
|
1337
|
-
const n =
|
|
1338
|
-
|
|
1345
|
+
const n = _(t, e), r = s((o) => o.setQuickActions);
|
|
1346
|
+
w(() => (D++, D > 1 && console.error(
|
|
1339
1347
|
"[React bindings] Capytale iframe React: Multiple quick actions registered: ",
|
|
1340
|
-
|
|
1348
|
+
D
|
|
1341
1349
|
), () => {
|
|
1342
|
-
|
|
1343
|
-
}), []),
|
|
1350
|
+
D--;
|
|
1351
|
+
}), []), w(() => (A.use(["meta-player-ui"], ([o]) => {
|
|
1344
1352
|
if (o.version === 0) {
|
|
1345
1353
|
console.error(
|
|
1346
1354
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1357,9 +1365,9 @@ const Le = (t, e) => {
|
|
|
1357
1365
|
})), u = {};
|
|
1358
1366
|
n.forEach((l, f) => {
|
|
1359
1367
|
u[`qa-${H}-${f}`] = l.action;
|
|
1360
|
-
}), o.i?.setQuickActionButtons(i),
|
|
1368
|
+
}), o.i?.setQuickActionButtons(i), r(u);
|
|
1361
1369
|
}), () => {
|
|
1362
|
-
|
|
1370
|
+
r({}), A.use(["meta-player-ui"], ([o]) => {
|
|
1363
1371
|
if (o.version === 0) {
|
|
1364
1372
|
console.error(
|
|
1365
1373
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1372,31 +1380,28 @@ const Le = (t, e) => {
|
|
|
1372
1380
|
};
|
|
1373
1381
|
let V = 0;
|
|
1374
1382
|
const Bt = (t, e, n) => {
|
|
1375
|
-
const
|
|
1383
|
+
const r = _(t, n), o = s(
|
|
1376
1384
|
(i) => i.setActivitySettingsCallback
|
|
1377
1385
|
);
|
|
1378
|
-
|
|
1386
|
+
w(() => (V++, V > 1 && console.error(
|
|
1379
1387
|
"[React bindings] Capytale iframe React: Multiple settings registered: ",
|
|
1380
1388
|
V
|
|
1381
1389
|
), () => {
|
|
1382
|
-
|
|
1383
|
-
}), []),
|
|
1390
|
+
V--;
|
|
1391
|
+
}), []), w(() => (A.use(["meta-player-ui"], ([i]) => {
|
|
1384
1392
|
if (i.version === 0) {
|
|
1385
1393
|
console.error(
|
|
1386
1394
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1387
1395
|
);
|
|
1388
1396
|
return;
|
|
1389
1397
|
}
|
|
1390
|
-
|
|
1391
|
-
"[React bindings] Updating settings UI in MetaPlayer",
|
|
1392
|
-
s
|
|
1393
|
-
), i.i?.setSettingsUI(s);
|
|
1398
|
+
i.i?.setSettingsUI(r);
|
|
1394
1399
|
}), o(
|
|
1395
1400
|
e
|
|
1396
1401
|
), () => {
|
|
1397
1402
|
o(null);
|
|
1398
|
-
}), [
|
|
1399
|
-
}, Ht = () =>
|
|
1403
|
+
}), [r]);
|
|
1404
|
+
}, Ht = () => b((e) => A.exec(["meta-player-ui"], ([n]) => {
|
|
1400
1405
|
if (n.version === 0)
|
|
1401
1406
|
throw console.error(
|
|
1402
1407
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1404,8 +1409,8 @@ const Bt = (t, e, n) => {
|
|
|
1404
1409
|
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1405
1410
|
);
|
|
1406
1411
|
return n.i?.showToast(e);
|
|
1407
|
-
}), []), zt = () =>
|
|
1408
|
-
(e) =>
|
|
1412
|
+
}), []), zt = () => b(
|
|
1413
|
+
(e) => A.exec(["meta-player-ui"], ([n]) => {
|
|
1409
1414
|
if (n.version === 0)
|
|
1410
1415
|
throw console.error(
|
|
1411
1416
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1415,8 +1420,8 @@ const Bt = (t, e, n) => {
|
|
|
1415
1420
|
return n.i?.clearToast(e);
|
|
1416
1421
|
}),
|
|
1417
1422
|
[]
|
|
1418
|
-
), Me = () =>
|
|
1419
|
-
() =>
|
|
1423
|
+
), Me = () => b(
|
|
1424
|
+
() => A.exec(["meta-player-ui"], ([e]) => {
|
|
1420
1425
|
if (e.version === 0)
|
|
1421
1426
|
throw console.error(
|
|
1422
1427
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1426,19 +1431,19 @@ const Bt = (t, e, n) => {
|
|
|
1426
1431
|
return e.i?.clearToasts();
|
|
1427
1432
|
}),
|
|
1428
1433
|
[]
|
|
1429
|
-
),
|
|
1430
|
-
const n = Ht(),
|
|
1431
|
-
return
|
|
1434
|
+
), _t = (t, e) => {
|
|
1435
|
+
const n = Ht(), r = zt();
|
|
1436
|
+
return w(() => {
|
|
1432
1437
|
if (t == null)
|
|
1433
1438
|
return;
|
|
1434
1439
|
const o = n(t);
|
|
1435
1440
|
return () => {
|
|
1436
1441
|
o.then((i) => {
|
|
1437
|
-
i != null &&
|
|
1442
|
+
i != null && r(i);
|
|
1438
1443
|
});
|
|
1439
1444
|
};
|
|
1440
|
-
}, [n,
|
|
1441
|
-
},
|
|
1445
|
+
}, [n, r, ...e]), null;
|
|
1446
|
+
}, Pe = () => b(() => A.exec(["trigger-save"], ([e]) => {
|
|
1442
1447
|
if (e.version === 0)
|
|
1443
1448
|
throw console.error(
|
|
1444
1449
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
@@ -1446,44 +1451,44 @@ const Bt = (t, e, n) => {
|
|
|
1446
1451
|
"Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
1447
1452
|
);
|
|
1448
1453
|
return e.i?.triggerSave();
|
|
1449
|
-
}), []),
|
|
1450
|
-
const n =
|
|
1451
|
-
(
|
|
1454
|
+
}), []), Ge = () => s((t) => t.canSave), De = (t, e) => {
|
|
1455
|
+
const n = s(
|
|
1456
|
+
(r) => r.setLlmGetFirstMessageContextFunction
|
|
1452
1457
|
);
|
|
1453
|
-
|
|
1458
|
+
w(() => (n(t), () => {
|
|
1454
1459
|
n(null);
|
|
1455
1460
|
}), [e, n]);
|
|
1456
1461
|
}, Ve = (t, e) => {
|
|
1457
|
-
const n =
|
|
1458
|
-
(
|
|
1462
|
+
const n = s(
|
|
1463
|
+
(r) => r.setLlmGetAllMessagesContextFunction
|
|
1459
1464
|
);
|
|
1460
|
-
|
|
1465
|
+
w(() => (n(t), () => {
|
|
1461
1466
|
n(null);
|
|
1462
1467
|
}), [e, n]);
|
|
1463
|
-
}, Ie = (t, e, n,
|
|
1464
|
-
const o =
|
|
1468
|
+
}, Ie = (t, e, n, r) => {
|
|
1469
|
+
const o = s(
|
|
1465
1470
|
(l) => l.setLlmGetAvailableToolsFunction
|
|
1466
|
-
), i =
|
|
1471
|
+
), i = s(
|
|
1467
1472
|
(l) => l.setLlmCallToolFunction
|
|
1468
|
-
), u =
|
|
1473
|
+
), u = s(
|
|
1469
1474
|
(l) => l.setLlmDescribeToolFunction
|
|
1470
1475
|
);
|
|
1471
|
-
|
|
1476
|
+
w(() => (o(t), i(e), u(n), () => {
|
|
1472
1477
|
o(null), i(null), u(null);
|
|
1473
1478
|
}), [
|
|
1474
|
-
|
|
1479
|
+
r,
|
|
1475
1480
|
o,
|
|
1476
1481
|
i,
|
|
1477
1482
|
u
|
|
1478
1483
|
]);
|
|
1479
1484
|
};
|
|
1480
|
-
function
|
|
1485
|
+
function Qt(t) {
|
|
1481
1486
|
const e = {};
|
|
1482
1487
|
for (const n of t.fields)
|
|
1483
1488
|
e[n.name] = n.defaultValue;
|
|
1484
1489
|
return e;
|
|
1485
1490
|
}
|
|
1486
|
-
function
|
|
1491
|
+
function Ut(t) {
|
|
1487
1492
|
return { [t.name]: t.defaultValues };
|
|
1488
1493
|
}
|
|
1489
1494
|
function Yt(t) {
|
|
@@ -1492,10 +1497,10 @@ function Yt(t) {
|
|
|
1492
1497
|
function Kt(t) {
|
|
1493
1498
|
switch (t.type) {
|
|
1494
1499
|
case "form":
|
|
1495
|
-
return
|
|
1500
|
+
return Qt(t);
|
|
1496
1501
|
case "checkboxes":
|
|
1497
1502
|
case "switches":
|
|
1498
|
-
return
|
|
1503
|
+
return Ut(t);
|
|
1499
1504
|
case "radio":
|
|
1500
1505
|
return Yt(t);
|
|
1501
1506
|
default:
|
|
@@ -1509,7 +1514,7 @@ function Xt(t) {
|
|
|
1509
1514
|
return e;
|
|
1510
1515
|
}
|
|
1511
1516
|
function je(t) {
|
|
1512
|
-
const n = dt()((
|
|
1517
|
+
const n = dt()((r) => ({
|
|
1513
1518
|
...Xt(t)
|
|
1514
1519
|
}));
|
|
1515
1520
|
return n.activitySettings = t, n;
|
|
@@ -1534,47 +1539,47 @@ const ee = [
|
|
|
1534
1539
|
"mode:1",
|
|
1535
1540
|
"workflow:1"
|
|
1536
1541
|
];
|
|
1537
|
-
function
|
|
1542
|
+
function Oe({
|
|
1538
1543
|
children: t,
|
|
1539
1544
|
contracts: e,
|
|
1540
1545
|
loadOnlyWhenReady: n = !0,
|
|
1541
|
-
activitySettingsStore:
|
|
1546
|
+
activitySettingsStore: r
|
|
1542
1547
|
}) {
|
|
1543
|
-
const o =
|
|
1544
|
-
return
|
|
1548
|
+
const o = s((i) => i.ready);
|
|
1549
|
+
return w(() => {
|
|
1545
1550
|
const i = [...e];
|
|
1546
1551
|
for (const u of ee)
|
|
1547
1552
|
i.includes(u) || i.push(u);
|
|
1548
1553
|
Wt(i);
|
|
1549
|
-
}, []), n && !o ? /* @__PURE__ */
|
|
1550
|
-
|
|
1554
|
+
}, []), n && !o ? /* @__PURE__ */ U("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */ ft(mt, { children: [
|
|
1555
|
+
r && /* @__PURE__ */ U(te, { store: r }),
|
|
1551
1556
|
t
|
|
1552
1557
|
] });
|
|
1553
1558
|
}
|
|
1554
|
-
function
|
|
1555
|
-
return
|
|
1559
|
+
function $e({ message: t }) {
|
|
1560
|
+
return _t(t, [t]), null;
|
|
1556
1561
|
}
|
|
1557
1562
|
export {
|
|
1558
|
-
|
|
1559
|
-
|
|
1563
|
+
Oe as Capytale,
|
|
1564
|
+
$e as TemporaryToast,
|
|
1560
1565
|
je as createActivitySettingsStore,
|
|
1561
1566
|
Je as useAfterSaveAction,
|
|
1562
|
-
|
|
1567
|
+
Ge as useCanSave,
|
|
1563
1568
|
zt as useClearToast,
|
|
1564
1569
|
Me as useClearToasts,
|
|
1565
|
-
|
|
1570
|
+
Ce as useGetLoadedJsonActivityContent,
|
|
1566
1571
|
Se as useGetLoadedJsonActivitySplitContent,
|
|
1567
1572
|
ye as useGetLoadedJsonAssignmentContent,
|
|
1568
|
-
|
|
1569
|
-
|
|
1573
|
+
we as useGetLoadedJsonAssignmentSplitContent,
|
|
1574
|
+
ve as useGetLoadedJsonContent,
|
|
1570
1575
|
pe as useGetLoadedTextContent,
|
|
1571
1576
|
he as useJsonActivityContentSaveFunction,
|
|
1572
|
-
|
|
1577
|
+
Ee as useJsonActivitySplitContentSaveFunction,
|
|
1573
1578
|
Fe as useJsonAssignmentContentSaveFunction,
|
|
1574
|
-
|
|
1575
|
-
|
|
1579
|
+
Re as useJsonAssignmentSplitContentSaveFunction,
|
|
1580
|
+
be as useJsonContentSaveFunction,
|
|
1576
1581
|
Ve as useLLMAllMessagesContext,
|
|
1577
|
-
|
|
1582
|
+
De as useLLMFirstMessageContext,
|
|
1578
1583
|
Ie as useLLMTools,
|
|
1579
1584
|
fe as useLoadedJsonActivityBinaryData,
|
|
1580
1585
|
de as useLoadedJsonActivityContent,
|
|
@@ -1591,9 +1596,9 @@ export {
|
|
|
1591
1596
|
Bt as useSettings,
|
|
1592
1597
|
Ht as useShowToast,
|
|
1593
1598
|
xe as useSidebarActions,
|
|
1594
|
-
|
|
1599
|
+
Ae as useTextContentSaveFunction,
|
|
1595
1600
|
ie as useTheme,
|
|
1596
|
-
|
|
1597
|
-
|
|
1601
|
+
_t as useToast,
|
|
1602
|
+
Pe as useTriggerSave,
|
|
1598
1603
|
se as useWorkflow
|
|
1599
1604
|
};
|