@capytale/iframe-react 1.1.17 → 1.1.18
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 +59 -0
- package/dist/index.es.js +290 -235
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as Q, jsxs as ft, Fragment as pt } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import G, { useCallback as A, 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) {
|
|
@@ -111,12 +111,12 @@ function st(t, e) {
|
|
|
111
111
|
}
|
|
112
112
|
}), z(t, n, [], e);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function L(t) {
|
|
115
115
|
if (t)
|
|
116
116
|
throw new Error("Proxy has been released and is not useable");
|
|
117
117
|
}
|
|
118
118
|
function it(t) {
|
|
119
|
-
return
|
|
119
|
+
return T(t, /* @__PURE__ */ new Map(), {
|
|
120
120
|
type: "RELEASE"
|
|
121
121
|
}).then(() => {
|
|
122
122
|
rt(t);
|
|
@@ -130,7 +130,7 @@ 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 At(t) {
|
|
134
134
|
$ && $.unregister(t);
|
|
135
135
|
}
|
|
136
136
|
function z(t, e, n = [], r = function() {
|
|
@@ -138,14 +138,14 @@ function z(t, e, n = [], r = function() {
|
|
|
138
138
|
let o = !1;
|
|
139
139
|
const s = new Proxy(r, {
|
|
140
140
|
get(f, c) {
|
|
141
|
-
if (
|
|
141
|
+
if (L(o), c === yt)
|
|
142
142
|
return () => {
|
|
143
|
-
|
|
143
|
+
At(s), it(t), e.clear(), o = !0;
|
|
144
144
|
};
|
|
145
145
|
if (c === "then") {
|
|
146
146
|
if (n.length === 0)
|
|
147
147
|
return { then: () => s };
|
|
148
|
-
const g =
|
|
148
|
+
const g = T(t, e, {
|
|
149
149
|
type: "GET",
|
|
150
150
|
path: n.map((d) => d.toString())
|
|
151
151
|
}).then(x);
|
|
@@ -154,34 +154,34 @@ function z(t, e, n = [], r = function() {
|
|
|
154
154
|
return z(t, e, [...n, c]);
|
|
155
155
|
},
|
|
156
156
|
set(f, c, g) {
|
|
157
|
-
|
|
157
|
+
L(o);
|
|
158
158
|
const [d, u] = O(g);
|
|
159
|
-
return
|
|
159
|
+
return T(t, e, {
|
|
160
160
|
type: "SET",
|
|
161
161
|
path: [...n, c].map((p) => p.toString()),
|
|
162
162
|
value: d
|
|
163
163
|
}, u).then(x);
|
|
164
164
|
},
|
|
165
165
|
apply(f, c, g) {
|
|
166
|
-
|
|
166
|
+
L(o);
|
|
167
167
|
const d = n[n.length - 1];
|
|
168
168
|
if (d === mt)
|
|
169
|
-
return
|
|
169
|
+
return T(t, e, {
|
|
170
170
|
type: "ENDPOINT"
|
|
171
171
|
}).then(x);
|
|
172
172
|
if (d === "bind")
|
|
173
173
|
return z(t, e, n.slice(0, -1));
|
|
174
174
|
const [u, p] = Y(g);
|
|
175
|
-
return
|
|
175
|
+
return T(t, e, {
|
|
176
176
|
type: "APPLY",
|
|
177
177
|
path: n.map((y) => y.toString()),
|
|
178
178
|
argumentList: u
|
|
179
179
|
}, p).then(x);
|
|
180
180
|
},
|
|
181
181
|
construct(f, c) {
|
|
182
|
-
|
|
182
|
+
L(o);
|
|
183
183
|
const [g, d] = Y(c);
|
|
184
|
-
return
|
|
184
|
+
return T(t, e, {
|
|
185
185
|
type: "CONSTRUCT",
|
|
186
186
|
path: n.map((u) => u.toString()),
|
|
187
187
|
argumentList: g
|
|
@@ -190,12 +190,12 @@ function z(t, e, n = [], r = function() {
|
|
|
190
190
|
});
|
|
191
191
|
return bt(s, t), s;
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function ht(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]), ht(e.map((n) => n[1]))];
|
|
199
199
|
}
|
|
200
200
|
const at = /* @__PURE__ */ new WeakMap();
|
|
201
201
|
function Rt(t, e) {
|
|
@@ -204,7 +204,7 @@ function Rt(t, e) {
|
|
|
204
204
|
function ct(t) {
|
|
205
205
|
return Object.assign(t, { [et]: !0 });
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Ft(t, e = globalThis, n = "*") {
|
|
208
208
|
return {
|
|
209
209
|
postMessage: (r, o) => t.postMessage(r, n, o),
|
|
210
210
|
addEventListener: e.addEventListener.bind(e),
|
|
@@ -240,13 +240,13 @@ function x(t) {
|
|
|
240
240
|
return t.value;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function T(t, e, n, r) {
|
|
244
244
|
return new Promise((o) => {
|
|
245
|
-
const s =
|
|
245
|
+
const s = Et();
|
|
246
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 Et() {
|
|
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 xt(t, e) {
|
|
@@ -274,7 +274,7 @@ function kt(t, e) {
|
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
276
|
else {
|
|
277
|
-
const u =
|
|
277
|
+
const u = Ft(window.parent, void 0, e);
|
|
278
278
|
_({
|
|
279
279
|
declare(p) {
|
|
280
280
|
if (r == null) throw new Error(f("No handler for declare"));
|
|
@@ -324,13 +324,13 @@ function Jt(t) {
|
|
|
324
324
|
if (s != null && s !== 0 && f != null)
|
|
325
325
|
return f;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
if (s != null && f != null && !(
|
|
327
|
+
function F(a) {
|
|
328
|
+
if (s != null && f != null && !(a > s))
|
|
329
329
|
return f;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
332
|
-
return p ?? (g ? p = Promise.resolve() : p = new Promise((
|
|
333
|
-
y =
|
|
331
|
+
function h() {
|
|
332
|
+
return p ?? (g ? p = Promise.resolve() : p = new Promise((a, l) => {
|
|
333
|
+
y = a;
|
|
334
334
|
}));
|
|
335
335
|
}
|
|
336
336
|
function k() {
|
|
@@ -344,10 +344,10 @@ function Jt(t) {
|
|
|
344
344
|
get i() {
|
|
345
345
|
return C();
|
|
346
346
|
},
|
|
347
|
-
v: (
|
|
347
|
+
v: (a) => F(a)
|
|
348
348
|
}), d;
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function M() {
|
|
351
351
|
return u === void 0 && (u = {
|
|
352
352
|
get name() {
|
|
353
353
|
return e;
|
|
@@ -358,16 +358,16 @@ function Jt(t) {
|
|
|
358
358
|
get i() {
|
|
359
359
|
return g ? C() : void 0;
|
|
360
360
|
},
|
|
361
|
-
v: (
|
|
361
|
+
v: (a) => g ? F(a) : void 0,
|
|
362
362
|
get promise() {
|
|
363
|
-
return s === 0 ? Promise.reject(t("Remote interface not provided")) :
|
|
363
|
+
return s === 0 ? Promise.reject(t("Remote interface not provided")) : h().then(() => {
|
|
364
364
|
if (s === 0) throw new Error(t("Remote interface not provided"));
|
|
365
365
|
return k();
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
368
|
}), u;
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function E() {
|
|
371
371
|
y != null && (y(), y = void 0);
|
|
372
372
|
}
|
|
373
373
|
return {
|
|
@@ -378,44 +378,44 @@ function Jt(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(a) {
|
|
382
|
+
if (n != null && n !== a) throw new Error(t("A different local version is already set"));
|
|
383
|
+
n = a;
|
|
384
384
|
},
|
|
385
385
|
get localVersionSent() {
|
|
386
386
|
return r;
|
|
387
387
|
},
|
|
388
|
-
set localVersionSent(
|
|
389
|
-
if (!
|
|
390
|
-
r =
|
|
388
|
+
set localVersionSent(a) {
|
|
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;
|
|
394
394
|
},
|
|
395
|
-
set localInterfaceSent(
|
|
395
|
+
set localInterfaceSent(a) {
|
|
396
396
|
if (n == null) throw new Error(t("Local version not set"));
|
|
397
|
-
if (!
|
|
398
|
-
o =
|
|
397
|
+
if (!a && o) throw new Error(t("Local interface already sent."));
|
|
398
|
+
o = a;
|
|
399
399
|
},
|
|
400
400
|
get remoteVersion() {
|
|
401
401
|
if (s != null)
|
|
402
402
|
return s;
|
|
403
403
|
},
|
|
404
|
-
set remoteVersion(
|
|
405
|
-
if (s != null && s !==
|
|
406
|
-
s =
|
|
404
|
+
set remoteVersion(a) {
|
|
405
|
+
if (s != null && s !== a) throw new Error(t("A different remote version is already set for " + e + `(${s} -> ${a})`));
|
|
406
|
+
s = a, a === 0 && (c = !0);
|
|
407
407
|
},
|
|
408
408
|
get remoteVersionReceived() {
|
|
409
409
|
return s != null;
|
|
410
410
|
},
|
|
411
|
-
setRemoteInterface: (
|
|
411
|
+
setRemoteInterface: (a) => {
|
|
412
412
|
if (s == null) throw new Error(t("Remote version not set"));
|
|
413
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
|
-
f =
|
|
418
|
+
f = a, c = !0;
|
|
419
419
|
},
|
|
420
420
|
get remoteInterfaceReceived() {
|
|
421
421
|
return c;
|
|
@@ -431,18 +431,18 @@ function Jt(t) {
|
|
|
431
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
|
-
g = !0,
|
|
434
|
+
g = !0, E();
|
|
435
435
|
}
|
|
436
436
|
},
|
|
437
437
|
getRemote: () => k(),
|
|
438
|
-
getLazyRemote: () =>
|
|
438
|
+
getLazyRemote: () => M(),
|
|
439
439
|
get activationPromise() {
|
|
440
|
-
return
|
|
440
|
+
return h();
|
|
441
441
|
}
|
|
442
442
|
};
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function Tt(t) {
|
|
446
446
|
return function(e, n, r, o) {
|
|
447
447
|
let s = r, f = !1, c = !1;
|
|
448
448
|
function g() {
|
|
@@ -490,7 +490,7 @@ function Mt(t) {
|
|
|
490
490
|
};
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function Mt(t) {
|
|
494
494
|
return function(e, n, r, o) {
|
|
495
495
|
let s = n, f = !1;
|
|
496
496
|
function c() {
|
|
@@ -528,23 +528,23 @@ function Tt(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 Gt(t) {
|
|
532
|
+
function e(a) {
|
|
533
|
+
return lt(t.name, a);
|
|
534
534
|
}
|
|
535
|
-
const n =
|
|
535
|
+
const n = Mt(e), r = Jt(e), o = Tt(e), s = {}, f = [];
|
|
536
536
|
let c = [], g;
|
|
537
537
|
const d = () => (g == null ? g = 0 : g++, g);
|
|
538
|
-
function u(
|
|
539
|
-
let l = s[
|
|
540
|
-
return l == null && (l = r(
|
|
538
|
+
function u(a) {
|
|
539
|
+
let l = s[a];
|
|
540
|
+
return l == null && (l = r(a), l.localVersion == null && (h && (l.localVersion = 0), k && (l.localVersionSent = !0)), l.remoteVersion == null && M && (l.remoteVersion = 0), s[a] = l), l;
|
|
541
541
|
}
|
|
542
|
-
function p(
|
|
543
|
-
return
|
|
542
|
+
function p(a) {
|
|
543
|
+
return a.map(u);
|
|
544
544
|
}
|
|
545
|
-
function y(...
|
|
545
|
+
function y(...a) {
|
|
546
546
|
const l = d(), m = Array(l).fill(!1);
|
|
547
|
-
|
|
547
|
+
a.forEach((v) => {
|
|
548
548
|
v.forEach((S) => {
|
|
549
549
|
S.depGroup != null && (m[S.depGroup] = !0), S.depGroup = l;
|
|
550
550
|
});
|
|
@@ -552,50 +552,50 @@ function Lt(t) {
|
|
|
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 = (a) => {
|
|
556
|
+
const l = p(a.map((m) => m.name));
|
|
557
|
+
for (let m = 0; m < a.length; m++)
|
|
558
|
+
a[m].version != null && (l[m].remoteVersion = a[m].version);
|
|
559
|
+
y(l), E();
|
|
560
560
|
}, t.onDone = () => {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
}),
|
|
564
|
-
}, t.onProvide = (
|
|
565
|
-
let v = s[
|
|
561
|
+
M || (M = !0, Object.values(s).forEach((a) => {
|
|
562
|
+
a.remoteVersion == null && (a.remoteVersion = 0);
|
|
563
|
+
}), E());
|
|
564
|
+
}, t.onProvide = (a, l, m) => {
|
|
565
|
+
let v = s[a];
|
|
566
566
|
if (v == null)
|
|
567
|
-
throw new Error(e(`Contract not declared : ${
|
|
567
|
+
throw new Error(e(`Contract not declared : ${a}`));
|
|
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 "${a}" 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 "${a}" is already provided.`));
|
|
572
|
+
v.setRemoteInterface(m), E();
|
|
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, F = !1, h = !1, k = !1, M = !1;
|
|
575
|
+
async function E() {
|
|
576
|
+
if (F = !0, !C) {
|
|
577
|
+
for (C = !0; F; ) {
|
|
578
|
+
if (F = !1, t.isReady) {
|
|
579
|
+
const a = f.filter((l) => !l.isDeclared);
|
|
580
|
+
if (a.length > 0)
|
|
581
|
+
for (const l of a) {
|
|
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 && h && f.every((a) => a.isDeclared)) {
|
|
589
|
+
const a = Object.values(s).filter((l) => !l.localVersionSent && l.localVersion != null);
|
|
590
|
+
if (a.length > 0)
|
|
591
|
+
for (const l of a)
|
|
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 a = f.filter((l) => !l.isDone && l.isReady);
|
|
597
|
+
if (a.length > 0)
|
|
598
|
+
for (const l of a) {
|
|
599
599
|
const m = l.invoke();
|
|
600
600
|
for (let v = 0; v < l.args.length; v++) {
|
|
601
601
|
const S = l.args[v];
|
|
@@ -604,22 +604,22 @@ function Lt(t) {
|
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
if (g != null) {
|
|
607
|
-
const
|
|
607
|
+
const a = Array(g + 1).fill(null);
|
|
608
608
|
for (const l in s) {
|
|
609
609
|
const m = s[l];
|
|
610
|
-
m.depGroup != null && (m.isActivable ?
|
|
610
|
+
m.depGroup != null && (m.isActivable ? a[m.depGroup] == null && !m.isActivated && (a[m.depGroup] = !0) : a[m.depGroup] = !1);
|
|
611
611
|
}
|
|
612
|
-
if (
|
|
612
|
+
if (a.some((l) => l === !0))
|
|
613
613
|
for (const l in s) {
|
|
614
614
|
const m = s[l];
|
|
615
|
-
m.depGroup != null &&
|
|
615
|
+
m.depGroup != null && a[m.depGroup] && m.activate();
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
if (t.isReady) {
|
|
619
|
-
const
|
|
619
|
+
const a = c;
|
|
620
620
|
c = [];
|
|
621
621
|
const l = [];
|
|
622
|
-
for (const m of
|
|
622
|
+
for (const m of a)
|
|
623
623
|
!m.isDone && m.isReady ? m.invoke() : l.push(m);
|
|
624
624
|
l.push(...c), c = l;
|
|
625
625
|
}
|
|
@@ -628,50 +628,50 @@ function Lt(t) {
|
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
630
|
return {
|
|
631
|
-
get(
|
|
632
|
-
return u(
|
|
631
|
+
get(a) {
|
|
632
|
+
return u(a);
|
|
633
633
|
},
|
|
634
|
-
declareFactory: (
|
|
635
|
-
if (
|
|
636
|
-
const S = p(
|
|
634
|
+
declareFactory: (a, l, m, v) => {
|
|
635
|
+
if (h) throw new Error(e("Cannot declare a factory after done has been set to true."));
|
|
636
|
+
const S = p(a.map((R) => R.name));
|
|
637
637
|
{
|
|
638
638
|
const R = S.filter((N) => N.localVersion != null);
|
|
639
639
|
if (R.length > 0)
|
|
640
640
|
throw new Error(e("Cannot declare a factory for already implemented contracts : " + R.map((N) => N.name).join(", ")));
|
|
641
641
|
}
|
|
642
|
-
for (let R = 0; R <
|
|
643
|
-
S[R].localVersion =
|
|
642
|
+
for (let R = 0; R < a.length; R++)
|
|
643
|
+
S[R].localVersion = a[R].version;
|
|
644
644
|
const J = p(l);
|
|
645
645
|
y(S, J);
|
|
646
646
|
const gt = o(S, J, m, v);
|
|
647
|
-
f.push(gt),
|
|
647
|
+
f.push(gt), E();
|
|
648
648
|
},
|
|
649
|
-
declareCallback(
|
|
650
|
-
const S = p(
|
|
651
|
-
!C && c.length === 0 && J.isReady ? J.invoke() : (c.push(J),
|
|
649
|
+
declareCallback(a, l, m, v) {
|
|
650
|
+
const S = p(a), J = n(S, l, m, v);
|
|
651
|
+
!C && c.length === 0 && J.isReady ? J.invoke() : (c.push(J), E());
|
|
652
652
|
},
|
|
653
653
|
get done() {
|
|
654
|
-
return
|
|
654
|
+
return h;
|
|
655
655
|
},
|
|
656
|
-
set done(
|
|
657
|
-
if (
|
|
658
|
-
if (!
|
|
656
|
+
set done(a) {
|
|
657
|
+
if (h) {
|
|
658
|
+
if (!a) throw new Error(e("Cannot set done to false after it has been set to true."));
|
|
659
659
|
} else
|
|
660
|
-
|
|
660
|
+
a && (h = !0, Object.values(s).forEach((l) => {
|
|
661
661
|
l.localVersion == null && (l.localVersion = 0);
|
|
662
|
-
}),
|
|
662
|
+
}), E());
|
|
663
663
|
}
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
|
-
const
|
|
666
|
+
const Lt = /^\d+$/;
|
|
667
667
|
function Pt(t) {
|
|
668
668
|
const [e, n, r] = t.split(":", 3);
|
|
669
|
-
if (n == null || r != null || !
|
|
669
|
+
if (n == null || r != null || !Lt.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
673
|
function Vt(t) {
|
|
674
|
-
const e =
|
|
674
|
+
const e = Gt(t);
|
|
675
675
|
function n(r) {
|
|
676
676
|
return lt(t.name, r);
|
|
677
677
|
}
|
|
@@ -725,12 +725,12 @@ const K = (t) => {
|
|
|
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 = G.useSyncExternalStore(
|
|
729
729
|
t.subscribe,
|
|
730
|
-
|
|
731
|
-
|
|
730
|
+
G.useCallback(() => e(t.getState()), [t, e]),
|
|
731
|
+
G.useCallback(() => e(t.getInitialState()), [t, e])
|
|
732
732
|
);
|
|
733
|
-
return
|
|
733
|
+
return G.useDebugValue(n), n;
|
|
734
734
|
}
|
|
735
735
|
const X = (t) => {
|
|
736
736
|
const e = It(t), n = (r) => $t(e, r);
|
|
@@ -745,14 +745,14 @@ const X = (t) => {
|
|
|
745
745
|
d = (y) => {
|
|
746
746
|
const C = f(y);
|
|
747
747
|
if (!u(p, C)) {
|
|
748
|
-
const
|
|
749
|
-
c(p = C,
|
|
748
|
+
const F = p;
|
|
749
|
+
c(p = C, F);
|
|
750
750
|
}
|
|
751
751
|
}, g?.fireImmediately && c(p, p);
|
|
752
752
|
}
|
|
753
753
|
return o(d);
|
|
754
754
|
}, t(e, n, r);
|
|
755
|
-
}, Nt = Ot,
|
|
755
|
+
}, Nt = Ot, i = dt()(
|
|
756
756
|
Nt((t) => ({
|
|
757
757
|
ready: !1,
|
|
758
758
|
workflow: "current",
|
|
@@ -775,16 +775,32 @@ const X = (t) => {
|
|
|
775
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(
|
|
778
|
+
throw console.error(
|
|
779
|
+
"[React bindings] getJsonActivityContentFunction is not set"
|
|
780
|
+
), new Error(
|
|
781
|
+
"[React bindings] getJsonActivityContentFunction is not set"
|
|
782
|
+
);
|
|
779
783
|
},
|
|
780
784
|
getJsonAssignmentContentFunction: () => {
|
|
781
|
-
throw console.error(
|
|
785
|
+
throw console.error(
|
|
786
|
+
"[React bindings] getJsonAssignmentContentFunction is not set"
|
|
787
|
+
), new Error(
|
|
788
|
+
"[React bindings] getJsonAssignmentContentFunction is not set"
|
|
789
|
+
);
|
|
782
790
|
},
|
|
783
791
|
getJsonActivitySplitContentFunction: () => {
|
|
784
|
-
throw console.error(
|
|
792
|
+
throw console.error(
|
|
793
|
+
"[React bindings] getJsonActivitySplitContentFunction is not set"
|
|
794
|
+
), new Error(
|
|
795
|
+
"[React bindings] getJsonActivitySplitContentFunction is not set"
|
|
796
|
+
);
|
|
785
797
|
},
|
|
786
798
|
getJsonAssignmentSplitContentFunction: () => {
|
|
787
|
-
throw console.error(
|
|
799
|
+
throw console.error(
|
|
800
|
+
"[React bindings] getJsonAssignmentSplitContentFunction is not set"
|
|
801
|
+
), new Error(
|
|
802
|
+
"[React bindings] getJsonAssignmentSplitContentFunction is not set"
|
|
803
|
+
);
|
|
788
804
|
},
|
|
789
805
|
sidebarActions: {},
|
|
790
806
|
quickActions: {},
|
|
@@ -797,6 +813,14 @@ const X = (t) => {
|
|
|
797
813
|
setLlmGetAllMessagesContextFunction: (e) => {
|
|
798
814
|
t({ llmGetAllMessagesContextFunction: e });
|
|
799
815
|
},
|
|
816
|
+
llmGetAvailableToolsFunction: null,
|
|
817
|
+
setLlmGetAvailableToolsFunction: (e) => {
|
|
818
|
+
t({ llmGetAvailableToolsFunction: e });
|
|
819
|
+
},
|
|
820
|
+
llmCallToolFunction: null,
|
|
821
|
+
setLlmCallToolFunction: (e) => {
|
|
822
|
+
t({ llmCallToolFunction: e });
|
|
823
|
+
},
|
|
800
824
|
setGetTextContentFunction: (e) => {
|
|
801
825
|
t({ getTextContentFunction: e });
|
|
802
826
|
},
|
|
@@ -850,7 +874,7 @@ const qt = [
|
|
|
850
874
|
], tt = {
|
|
851
875
|
"mode:1": {
|
|
852
876
|
setMode: (t) => {
|
|
853
|
-
|
|
877
|
+
i.setState({ mode: t });
|
|
854
878
|
}
|
|
855
879
|
},
|
|
856
880
|
"reload:1": {
|
|
@@ -861,68 +885,70 @@ const qt = [
|
|
|
861
885
|
"theme:1": {
|
|
862
886
|
setTheme: (t) => {
|
|
863
887
|
if (t === null) {
|
|
864
|
-
|
|
888
|
+
i.setState({ theme: null });
|
|
865
889
|
return;
|
|
866
890
|
}
|
|
867
891
|
if (t !== "light" && t !== "dark") {
|
|
868
|
-
console.warn(
|
|
892
|
+
console.warn(
|
|
893
|
+
`[React bindings] Invalid theme: ${t}. Expected 'light' or 'dark'.`
|
|
894
|
+
), i.setState({ theme: null });
|
|
869
895
|
return;
|
|
870
896
|
}
|
|
871
|
-
|
|
897
|
+
i.setState({ theme: t });
|
|
872
898
|
}
|
|
873
899
|
},
|
|
874
900
|
"workflow:1": {
|
|
875
901
|
setWorkflow: (t) => {
|
|
876
|
-
|
|
902
|
+
i.setState({ workflow: t });
|
|
877
903
|
}
|
|
878
904
|
},
|
|
879
905
|
"trigger-save:1": {
|
|
880
906
|
setCanSave(t) {
|
|
881
|
-
|
|
907
|
+
i.setState({ canSave: t });
|
|
882
908
|
}
|
|
883
909
|
},
|
|
884
910
|
"simple-content(text):1": {
|
|
885
911
|
contentSaved: () => {
|
|
886
|
-
|
|
912
|
+
i.setState((t) => ({
|
|
887
913
|
afterSaveCount: t.afterSaveCount + 1
|
|
888
914
|
}));
|
|
889
915
|
},
|
|
890
|
-
getContent: () =>
|
|
916
|
+
getContent: () => i.getState().getTextContentFunction(),
|
|
891
917
|
loadContent: (t) => {
|
|
892
|
-
|
|
918
|
+
i.setState({ loadedTextContent: t });
|
|
893
919
|
}
|
|
894
920
|
},
|
|
895
921
|
"simple-content(json):1": {
|
|
896
922
|
contentSaved: () => {
|
|
897
|
-
|
|
923
|
+
i.setState((t) => ({
|
|
898
924
|
afterSaveCount: t.afterSaveCount + 1
|
|
899
925
|
}));
|
|
900
926
|
},
|
|
901
|
-
getContent: () =>
|
|
927
|
+
getContent: () => i.getState().getJsonContentFunction(),
|
|
902
928
|
loadContent: (t) => {
|
|
903
|
-
|
|
929
|
+
i.setState({ loadedJsonContent: t });
|
|
904
930
|
}
|
|
905
931
|
},
|
|
906
932
|
"simple-binary-data(text):1": {
|
|
907
933
|
contentSaved: () => {
|
|
908
|
-
|
|
934
|
+
i.setState((t) => ({
|
|
909
935
|
afterSaveCount: t.afterSaveCount + 1
|
|
910
936
|
}));
|
|
911
937
|
},
|
|
912
|
-
getContent: () =>
|
|
938
|
+
getContent: () => i.getState().getTextContentFunction(),
|
|
913
939
|
loadContent: (t) => {
|
|
914
|
-
|
|
940
|
+
i.setState({ loadedTextContent: t });
|
|
915
941
|
}
|
|
916
942
|
},
|
|
917
943
|
"simple-content-eval(text):1": {
|
|
918
944
|
contentSaved: () => {
|
|
919
|
-
|
|
945
|
+
i.setState((t) => ({
|
|
920
946
|
afterSaveCount: t.afterSaveCount + 1
|
|
921
947
|
}));
|
|
922
948
|
},
|
|
923
|
-
getContent: () =>
|
|
949
|
+
getContent: () => i.getState().getTextContentFunction(),
|
|
924
950
|
loadContent: (t) => {
|
|
925
|
-
|
|
951
|
+
i.setState({ loadedTextContent: t });
|
|
926
952
|
},
|
|
927
953
|
getAssignmentContent: () => {
|
|
928
954
|
throw new Error(
|
|
@@ -932,13 +958,13 @@ const qt = [
|
|
|
932
958
|
},
|
|
933
959
|
"simple-content-eval(json):1": {
|
|
934
960
|
contentSaved: () => {
|
|
935
|
-
|
|
961
|
+
i.setState((t) => ({
|
|
936
962
|
afterSaveCount: t.afterSaveCount + 1
|
|
937
963
|
}));
|
|
938
964
|
},
|
|
939
|
-
getContent: () =>
|
|
965
|
+
getContent: () => i.getState().getJsonContentFunction(),
|
|
940
966
|
loadContent: (t) => {
|
|
941
|
-
|
|
967
|
+
i.setState({ loadedJsonContent: t });
|
|
942
968
|
},
|
|
943
969
|
getAssignmentContent: () => {
|
|
944
970
|
throw new Error(
|
|
@@ -948,13 +974,13 @@ const qt = [
|
|
|
948
974
|
},
|
|
949
975
|
"simple-content-eval(json):2": {
|
|
950
976
|
contentSaved: () => {
|
|
951
|
-
|
|
977
|
+
i.setState((t) => ({
|
|
952
978
|
afterSaveCount: t.afterSaveCount + 1
|
|
953
979
|
}));
|
|
954
980
|
},
|
|
955
|
-
getContent: () =>
|
|
981
|
+
getContent: () => i.getState().getJsonContentFunction(),
|
|
956
982
|
loadContent: (t) => {
|
|
957
|
-
|
|
983
|
+
i.setState({ loadedJsonContent: t });
|
|
958
984
|
},
|
|
959
985
|
getAssignmentContent: () => {
|
|
960
986
|
throw new Error(
|
|
@@ -964,13 +990,13 @@ const qt = [
|
|
|
964
990
|
},
|
|
965
991
|
"simple-content-eval(text):2": {
|
|
966
992
|
contentSaved: () => {
|
|
967
|
-
|
|
993
|
+
i.setState((t) => ({
|
|
968
994
|
afterSaveCount: t.afterSaveCount + 1
|
|
969
995
|
}));
|
|
970
996
|
},
|
|
971
|
-
getContent: () =>
|
|
997
|
+
getContent: () => i.getState().getTextContentFunction(),
|
|
972
998
|
loadContent: (t) => {
|
|
973
|
-
|
|
999
|
+
i.setState({ loadedTextContent: t });
|
|
974
1000
|
},
|
|
975
1001
|
getAssignmentContent: () => {
|
|
976
1002
|
throw new Error(
|
|
@@ -980,22 +1006,22 @@ const qt = [
|
|
|
980
1006
|
},
|
|
981
1007
|
"separate-contents(json):1": {
|
|
982
1008
|
contentSaved: () => {
|
|
983
|
-
|
|
1009
|
+
i.setState((t) => ({
|
|
984
1010
|
afterSaveCount: t.afterSaveCount + 1
|
|
985
1011
|
}));
|
|
986
1012
|
},
|
|
987
1013
|
loadContent: (t, e) => {
|
|
988
|
-
|
|
1014
|
+
i.setState({
|
|
989
1015
|
loadedJsonActivityContent: t,
|
|
990
1016
|
loadedJsonAssignmentContent: e
|
|
991
1017
|
});
|
|
992
1018
|
},
|
|
993
|
-
getActivityContent: () =>
|
|
994
|
-
getAssignmentContent: () =>
|
|
1019
|
+
getActivityContent: () => i.getState().getJsonActivityContentFunction(),
|
|
1020
|
+
getAssignmentContent: () => i.getState().getJsonAssignmentContentFunction()
|
|
995
1021
|
},
|
|
996
1022
|
"separate-dual-contents(json):1": {
|
|
997
1023
|
contentSaved: () => {
|
|
998
|
-
|
|
1024
|
+
i.setState((t) => ({
|
|
999
1025
|
afterSaveCount: t.afterSaveCount + 1
|
|
1000
1026
|
}));
|
|
1001
1027
|
},
|
|
@@ -1005,15 +1031,15 @@ const qt = [
|
|
|
1005
1031
|
activityBinaryData: n,
|
|
1006
1032
|
assignmentBinaryData: r
|
|
1007
1033
|
}) => {
|
|
1008
|
-
|
|
1034
|
+
i.setState({
|
|
1009
1035
|
loadedJsonActivityContent: t,
|
|
1010
1036
|
loadedJsonAssignmentContent: e,
|
|
1011
1037
|
loadedJsonActivityBinaryData: n,
|
|
1012
1038
|
loadedJsonAssignmentBinaryData: r
|
|
1013
1039
|
});
|
|
1014
1040
|
},
|
|
1015
|
-
getActivityContentAndData: () => (console.log("[React bindings] Getting activity content and data"),
|
|
1016
|
-
getAssignmentContentAndData: () => (console.log("[React bindings] Getting assignment content and data"),
|
|
1041
|
+
getActivityContentAndData: () => (console.log("[React bindings] Getting activity content and data"), i.getState().getJsonActivitySplitContentFunction()),
|
|
1042
|
+
getAssignmentContentAndData: () => (console.log("[React bindings] Getting assignment content and data"), i.getState().getJsonAssignmentSplitContentFunction())
|
|
1017
1043
|
},
|
|
1018
1044
|
"meta-player-anti-cheat:1": {
|
|
1019
1045
|
lock: () => {
|
|
@@ -1024,24 +1050,24 @@ const qt = [
|
|
|
1024
1050
|
"meta-player-ui:1": {
|
|
1025
1051
|
executeAction(t) {
|
|
1026
1052
|
if (console.log("[React bindings] Executing action:", t), t.startsWith("qa")) {
|
|
1027
|
-
const n =
|
|
1053
|
+
const n = i.getState().quickActions[t];
|
|
1028
1054
|
n ? n() : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1029
1055
|
} else {
|
|
1030
|
-
const n =
|
|
1056
|
+
const n = i.getState().sidebarActions[t];
|
|
1031
1057
|
n ? n() : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1032
1058
|
}
|
|
1033
1059
|
},
|
|
1034
1060
|
executeFileUpload(t, e) {
|
|
1035
1061
|
if (t.startsWith("qa")) {
|
|
1036
|
-
const r =
|
|
1062
|
+
const r = i.getState().quickActions[t];
|
|
1037
1063
|
r ? r(e) : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1038
1064
|
} else {
|
|
1039
|
-
const r =
|
|
1065
|
+
const r = i.getState().sidebarActions[t];
|
|
1040
1066
|
r ? r(e) : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1041
1067
|
}
|
|
1042
1068
|
},
|
|
1043
1069
|
updateSettings(t) {
|
|
1044
|
-
const e =
|
|
1070
|
+
const e = i.getState().activitySettingsCallback;
|
|
1045
1071
|
e ? e(t) : console.warn(
|
|
1046
1072
|
"activitySettingsCallback is not set. Changes:",
|
|
1047
1073
|
t
|
|
@@ -1050,27 +1076,35 @@ const qt = [
|
|
|
1050
1076
|
},
|
|
1051
1077
|
"meta-player-events:1": {
|
|
1052
1078
|
handleEvent(t) {
|
|
1053
|
-
t === "all-loaded" &&
|
|
1079
|
+
t === "all-loaded" && i.setState({ ready: !0 });
|
|
1054
1080
|
}
|
|
1055
1081
|
},
|
|
1056
1082
|
"llm:1": {
|
|
1057
1083
|
getFirstMessageContext: (t) => {
|
|
1058
|
-
const e =
|
|
1059
|
-
|
|
1060
|
-
throw new Error("LLM first message context function is not set");
|
|
1061
|
-
return e(t);
|
|
1084
|
+
const e = i.getState().llmGetFirstMessageContextFunction;
|
|
1085
|
+
return e ? e(t) : "";
|
|
1062
1086
|
},
|
|
1063
1087
|
getAllMessagesContext: (t) => {
|
|
1064
|
-
const e =
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1088
|
+
const e = i.getState().llmGetAllMessagesContextFunction;
|
|
1089
|
+
return e ? e(t) : "";
|
|
1090
|
+
},
|
|
1091
|
+
getAvailableTools: (t) => {
|
|
1092
|
+
const e = i.getState().llmGetAvailableToolsFunction;
|
|
1093
|
+
return e ? e(t) : [];
|
|
1094
|
+
},
|
|
1095
|
+
callTool: (t, e) => {
|
|
1096
|
+
const n = i.getState().llmCallToolFunction;
|
|
1097
|
+
if (!n)
|
|
1098
|
+
throw new Error("LLM call tool function is not set");
|
|
1099
|
+
return n(t, e);
|
|
1068
1100
|
}
|
|
1069
1101
|
}
|
|
1070
1102
|
}, b = Dt();
|
|
1071
1103
|
function Bt(t) {
|
|
1072
1104
|
if (console.log("[React bindings] Contracts to plug:", t), Z) {
|
|
1073
|
-
console.warn(
|
|
1105
|
+
console.warn(
|
|
1106
|
+
"[React bindings] Contracts have already been plugged. Skipping."
|
|
1107
|
+
);
|
|
1074
1108
|
return;
|
|
1075
1109
|
}
|
|
1076
1110
|
Z = !0;
|
|
@@ -1102,11 +1136,15 @@ function Bt(t) {
|
|
|
1102
1136
|
"separate-contents(json):1",
|
|
1103
1137
|
"separate-dual-contents(json):1"
|
|
1104
1138
|
])
|
|
1105
|
-
if (console.log(
|
|
1106
|
-
|
|
1139
|
+
if (console.log(
|
|
1140
|
+
`[React bindings] Contract ${e} is being subscribed to content changes.`
|
|
1141
|
+
), t.includes(e)) {
|
|
1142
|
+
console.log(
|
|
1143
|
+
`[React bindings] Subscribing to content changes for contract ${e}`
|
|
1144
|
+
);
|
|
1107
1145
|
const n = e.split(":")[0];
|
|
1108
1146
|
b.use([n], ([r]) => {
|
|
1109
|
-
|
|
1147
|
+
i.subscribe(
|
|
1110
1148
|
(o) => o.isDirtyCount,
|
|
1111
1149
|
() => {
|
|
1112
1150
|
r.i?.contentChanged(), console.log(
|
|
@@ -1117,76 +1155,76 @@ function Bt(t) {
|
|
|
1117
1155
|
});
|
|
1118
1156
|
}
|
|
1119
1157
|
}
|
|
1120
|
-
const re = () =>
|
|
1158
|
+
const re = () => i((t) => {
|
|
1121
1159
|
if (t.mode === null)
|
|
1122
1160
|
throw new Error("Mode is not set. Have you used contract 'mode'?");
|
|
1123
1161
|
return t.mode;
|
|
1124
|
-
}), se = () =>
|
|
1162
|
+
}), se = () => i((t) => {
|
|
1125
1163
|
if (t.workflow === null)
|
|
1126
1164
|
throw new Error(
|
|
1127
1165
|
"Workflow is not set. Have you used contract 'workflow'?"
|
|
1128
1166
|
);
|
|
1129
1167
|
return t.workflow;
|
|
1130
|
-
}), ie = () =>
|
|
1168
|
+
}), ie = () => i((t) => {
|
|
1131
1169
|
if (t.theme === null)
|
|
1132
1170
|
throw new Error("Theme is not set. Have you used contract 'theme'?");
|
|
1133
1171
|
return t.theme;
|
|
1134
|
-
}), ae = () =>
|
|
1172
|
+
}), ae = () => i((t) => t.incSaveCount), ce = () => i((t) => t.incDirtyCount), le = () => i((t) => t.loadedTextContent), ue = () => i((t) => t.loadedJsonContent), de = () => i((t) => t.loadedJsonActivityContent), ge = () => i((t) => t.loadedJsonAssignmentContent), fe = () => i((t) => t.loadedJsonActivityBinaryData), pe = () => i((t) => t.loadedJsonAssignmentBinaryData), me = () => A(() => i.getState().loadedTextContent, []), ye = () => A(() => i.getState().loadedJsonContent, []), ve = () => A(() => i.getState().loadedJsonActivityContent, []), Ce = () => A(() => i.getState().loadedJsonAssignmentContent, []), Se = () => A(
|
|
1135
1173
|
() => ({
|
|
1136
|
-
content:
|
|
1137
|
-
binaryData:
|
|
1174
|
+
content: i.getState().loadedJsonActivityContent,
|
|
1175
|
+
binaryData: i.getState().loadedJsonActivityBinaryData
|
|
1138
1176
|
}),
|
|
1139
1177
|
[]
|
|
1140
|
-
), we = () =>
|
|
1178
|
+
), we = () => A(
|
|
1141
1179
|
() => ({
|
|
1142
|
-
content:
|
|
1143
|
-
binaryData:
|
|
1180
|
+
content: i.getState().loadedJsonAssignmentContent,
|
|
1181
|
+
binaryData: i.getState().loadedJsonAssignmentBinaryData
|
|
1144
1182
|
}),
|
|
1145
1183
|
[]
|
|
1146
1184
|
), be = (t) => {
|
|
1147
|
-
const e =
|
|
1185
|
+
const e = i(
|
|
1148
1186
|
(n) => n.setGetTextContentFunction
|
|
1149
1187
|
);
|
|
1150
1188
|
w(() => {
|
|
1151
1189
|
e(t);
|
|
1152
1190
|
}, [t, e]);
|
|
1153
|
-
},
|
|
1154
|
-
const e =
|
|
1191
|
+
}, Ae = (t) => {
|
|
1192
|
+
const e = i(
|
|
1155
1193
|
(n) => n.setGetJsonContentFunction
|
|
1156
1194
|
);
|
|
1157
1195
|
w(() => {
|
|
1158
1196
|
e(t);
|
|
1159
1197
|
}, [t, e]);
|
|
1160
|
-
},
|
|
1161
|
-
const e =
|
|
1198
|
+
}, he = (t) => {
|
|
1199
|
+
const e = i(
|
|
1162
1200
|
(n) => n.setGetJsonActivityContentFunction
|
|
1163
1201
|
);
|
|
1164
1202
|
w(() => {
|
|
1165
1203
|
e(t);
|
|
1166
1204
|
}, [t, e]);
|
|
1167
1205
|
}, Re = (t) => {
|
|
1168
|
-
const e =
|
|
1206
|
+
const e = i(
|
|
1169
1207
|
(n) => n.setGetJsonAssignmentContentFunction
|
|
1170
1208
|
);
|
|
1171
1209
|
w(() => {
|
|
1172
1210
|
e(t);
|
|
1173
1211
|
}, [t, e]);
|
|
1174
|
-
},
|
|
1175
|
-
const e =
|
|
1212
|
+
}, Fe = (t) => {
|
|
1213
|
+
const e = i(
|
|
1176
1214
|
(n) => n.setGetJsonActivitySplitContentFunction
|
|
1177
1215
|
);
|
|
1178
1216
|
w(() => {
|
|
1179
1217
|
e(t);
|
|
1180
1218
|
}, [t, e]);
|
|
1181
|
-
},
|
|
1182
|
-
const e =
|
|
1219
|
+
}, Ee = (t) => {
|
|
1220
|
+
const e = i(
|
|
1183
1221
|
(n) => n.setGetJsonAssignmentSplitContentFunction
|
|
1184
1222
|
);
|
|
1185
1223
|
w(() => {
|
|
1186
1224
|
e(t);
|
|
1187
1225
|
}, [t, e]);
|
|
1188
1226
|
}, xe = (t) => {
|
|
1189
|
-
const e =
|
|
1227
|
+
const e = i((n) => n.afterSaveCount);
|
|
1190
1228
|
w(() => {
|
|
1191
1229
|
e > 0 && t();
|
|
1192
1230
|
}, [e]);
|
|
@@ -1212,8 +1250,8 @@ const re = () => a((t) => {
|
|
|
1212
1250
|
});
|
|
1213
1251
|
};
|
|
1214
1252
|
let P = 0, W = 0;
|
|
1215
|
-
const
|
|
1216
|
-
const n = U(t, e), r =
|
|
1253
|
+
const Te = (t, e) => {
|
|
1254
|
+
const n = U(t, e), r = i((o) => o.setSidebarActions);
|
|
1217
1255
|
w(() => (P++, P > 1 && console.error(
|
|
1218
1256
|
"[React bindings] Capytale iframe React: Multiple sidebar actions registered: ",
|
|
1219
1257
|
P
|
|
@@ -1250,8 +1288,8 @@ const Me = (t, e) => {
|
|
|
1250
1288
|
}), [n]);
|
|
1251
1289
|
};
|
|
1252
1290
|
let V = 0, H = 0;
|
|
1253
|
-
const
|
|
1254
|
-
const n = U(t, e), r =
|
|
1291
|
+
const Me = (t, e) => {
|
|
1292
|
+
const n = U(t, e), r = i((o) => o.setQuickActions);
|
|
1255
1293
|
w(() => (V++, V > 1 && console.error(
|
|
1256
1294
|
"[React bindings] Capytale iframe React: Multiple quick actions registered: ",
|
|
1257
1295
|
V
|
|
@@ -1289,7 +1327,7 @@ const Te = (t, e) => {
|
|
|
1289
1327
|
};
|
|
1290
1328
|
let D = 0;
|
|
1291
1329
|
const Wt = (t, e, n) => {
|
|
1292
|
-
const r = U(t, n), o =
|
|
1330
|
+
const r = U(t, n), o = i(
|
|
1293
1331
|
(s) => s.setActivitySettingsCallback
|
|
1294
1332
|
);
|
|
1295
1333
|
w(() => (console.log("[React bindings] Mounting useSettings"), D++, D > 1 && console.error(
|
|
@@ -1304,31 +1342,46 @@ const Wt = (t, e, n) => {
|
|
|
1304
1342
|
);
|
|
1305
1343
|
return;
|
|
1306
1344
|
}
|
|
1307
|
-
console.log(
|
|
1345
|
+
console.log(
|
|
1346
|
+
"[React bindings] Updating settings UI in MetaPlayer",
|
|
1347
|
+
r
|
|
1348
|
+
), s.i?.setSettingsUI(r);
|
|
1308
1349
|
}), o(
|
|
1309
1350
|
e
|
|
1310
1351
|
), () => {
|
|
1311
1352
|
o(null);
|
|
1312
1353
|
}), [r]);
|
|
1313
|
-
}, Ht = () =>
|
|
1354
|
+
}, Ht = () => A((e) => b.exec(["meta-player-ui"], ([n]) => {
|
|
1314
1355
|
if (n.version === 0)
|
|
1315
1356
|
throw console.error(
|
|
1316
1357
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1317
|
-
), new Error(
|
|
1358
|
+
), new Error(
|
|
1359
|
+
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1360
|
+
);
|
|
1318
1361
|
return n.i?.showToast(e);
|
|
1319
|
-
}), []), zt = () =>
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1362
|
+
}), []), zt = () => A(
|
|
1363
|
+
(e) => b.exec(["meta-player-ui"], ([n]) => {
|
|
1364
|
+
if (n.version === 0)
|
|
1365
|
+
throw console.error(
|
|
1366
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1367
|
+
), new Error(
|
|
1368
|
+
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1369
|
+
);
|
|
1370
|
+
return n.i?.clearToast(e);
|
|
1371
|
+
}),
|
|
1372
|
+
[]
|
|
1373
|
+
), Ge = () => A(
|
|
1374
|
+
() => b.exec(["meta-player-ui"], ([e]) => {
|
|
1375
|
+
if (e.version === 0)
|
|
1376
|
+
throw console.error(
|
|
1377
|
+
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1378
|
+
), new Error(
|
|
1379
|
+
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1380
|
+
);
|
|
1381
|
+
return e.i?.clearToasts();
|
|
1382
|
+
}),
|
|
1383
|
+
[]
|
|
1384
|
+
), Ut = (t, e) => {
|
|
1332
1385
|
const n = Ht(), r = zt();
|
|
1333
1386
|
return w(() => {
|
|
1334
1387
|
if (t == null)
|
|
@@ -1340,21 +1393,23 @@ const Wt = (t, e, n) => {
|
|
|
1340
1393
|
});
|
|
1341
1394
|
};
|
|
1342
1395
|
}, [n, r, ...e]), null;
|
|
1343
|
-
},
|
|
1396
|
+
}, Le = () => A(() => b.exec(["trigger-save"], ([e]) => {
|
|
1344
1397
|
if (e.version === 0)
|
|
1345
1398
|
throw console.error(
|
|
1346
1399
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
1347
|
-
), new Error(
|
|
1400
|
+
), new Error(
|
|
1401
|
+
"Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
1402
|
+
);
|
|
1348
1403
|
return e.i?.triggerSave();
|
|
1349
|
-
}), []), Pe = () =>
|
|
1350
|
-
const n =
|
|
1404
|
+
}), []), Pe = () => i((t) => t.canSave), Ve = (t, e) => {
|
|
1405
|
+
const n = i(
|
|
1351
1406
|
(r) => r.setLlmGetFirstMessageContextFunction
|
|
1352
1407
|
);
|
|
1353
1408
|
w(() => (n(t), () => {
|
|
1354
1409
|
n(null);
|
|
1355
1410
|
}), [e, n]);
|
|
1356
1411
|
}, De = (t, e) => {
|
|
1357
|
-
const n =
|
|
1412
|
+
const n = i(
|
|
1358
1413
|
(r) => r.setLlmGetAllMessagesContextFunction
|
|
1359
1414
|
);
|
|
1360
1415
|
w(() => (n(t), () => {
|
|
@@ -1424,7 +1479,7 @@ function je({
|
|
|
1424
1479
|
loadOnlyWhenReady: n = !0,
|
|
1425
1480
|
activitySettingsStore: r
|
|
1426
1481
|
}) {
|
|
1427
|
-
const o =
|
|
1482
|
+
const o = i((s) => s.ready);
|
|
1428
1483
|
return w(() => {
|
|
1429
1484
|
const s = [...e];
|
|
1430
1485
|
for (const f of ee)
|
|
@@ -1445,18 +1500,18 @@ export {
|
|
|
1445
1500
|
xe as useAfterSaveAction,
|
|
1446
1501
|
Pe as useCanSave,
|
|
1447
1502
|
zt as useClearToast,
|
|
1448
|
-
|
|
1503
|
+
Ge as useClearToasts,
|
|
1449
1504
|
ve as useGetLoadedJsonActivityContent,
|
|
1450
1505
|
Se as useGetLoadedJsonActivitySplitContent,
|
|
1451
1506
|
Ce as useGetLoadedJsonAssignmentContent,
|
|
1452
1507
|
we as useGetLoadedJsonAssignmentSplitContent,
|
|
1453
1508
|
ye as useGetLoadedJsonContent,
|
|
1454
1509
|
me as useGetLoadedTextContent,
|
|
1455
|
-
|
|
1456
|
-
|
|
1510
|
+
he as useJsonActivityContentSaveFunction,
|
|
1511
|
+
Fe as useJsonActivitySplitContentSaveFunction,
|
|
1457
1512
|
Re as useJsonAssignmentContentSaveFunction,
|
|
1458
|
-
|
|
1459
|
-
|
|
1513
|
+
Ee as useJsonAssignmentSplitContentSaveFunction,
|
|
1514
|
+
Ae as useJsonContentSaveFunction,
|
|
1460
1515
|
De as useLLMAllMessagesContext,
|
|
1461
1516
|
Ve as useLLMFirstMessageContext,
|
|
1462
1517
|
fe as useLoadedJsonActivityBinaryData,
|
|
@@ -1469,14 +1524,14 @@ export {
|
|
|
1469
1524
|
ce as useNotifyIsDirty,
|
|
1470
1525
|
Je as usePreviewImageFile,
|
|
1471
1526
|
ke as usePreviewTextFile,
|
|
1472
|
-
|
|
1527
|
+
Me as useQuickActions,
|
|
1473
1528
|
ae as useRequestSave,
|
|
1474
1529
|
Wt as useSettings,
|
|
1475
1530
|
Ht as useShowToast,
|
|
1476
|
-
|
|
1531
|
+
Te as useSidebarActions,
|
|
1477
1532
|
be as useTextContentSaveFunction,
|
|
1478
1533
|
ie as useTheme,
|
|
1479
1534
|
Ut as useToast,
|
|
1480
|
-
|
|
1535
|
+
Le as useTriggerSave,
|
|
1481
1536
|
se as useWorkflow
|
|
1482
1537
|
};
|