@capytale/iframe-react 1.1.16 → 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 +292 -236
- 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
|
},
|
|
@@ -845,11 +869,12 @@ const qt = [
|
|
|
845
869
|
"simple-content-eval(text):1",
|
|
846
870
|
"simple-content-eval(json):1",
|
|
847
871
|
"separate-contents(json):1",
|
|
848
|
-
"separate-dual-contents(json):1"
|
|
872
|
+
"separate-dual-contents(json):1",
|
|
873
|
+
"llm:1"
|
|
849
874
|
], tt = {
|
|
850
875
|
"mode:1": {
|
|
851
876
|
setMode: (t) => {
|
|
852
|
-
|
|
877
|
+
i.setState({ mode: t });
|
|
853
878
|
}
|
|
854
879
|
},
|
|
855
880
|
"reload:1": {
|
|
@@ -860,68 +885,70 @@ const qt = [
|
|
|
860
885
|
"theme:1": {
|
|
861
886
|
setTheme: (t) => {
|
|
862
887
|
if (t === null) {
|
|
863
|
-
|
|
888
|
+
i.setState({ theme: null });
|
|
864
889
|
return;
|
|
865
890
|
}
|
|
866
891
|
if (t !== "light" && t !== "dark") {
|
|
867
|
-
console.warn(
|
|
892
|
+
console.warn(
|
|
893
|
+
`[React bindings] Invalid theme: ${t}. Expected 'light' or 'dark'.`
|
|
894
|
+
), i.setState({ theme: null });
|
|
868
895
|
return;
|
|
869
896
|
}
|
|
870
|
-
|
|
897
|
+
i.setState({ theme: t });
|
|
871
898
|
}
|
|
872
899
|
},
|
|
873
900
|
"workflow:1": {
|
|
874
901
|
setWorkflow: (t) => {
|
|
875
|
-
|
|
902
|
+
i.setState({ workflow: t });
|
|
876
903
|
}
|
|
877
904
|
},
|
|
878
905
|
"trigger-save:1": {
|
|
879
906
|
setCanSave(t) {
|
|
880
|
-
|
|
907
|
+
i.setState({ canSave: t });
|
|
881
908
|
}
|
|
882
909
|
},
|
|
883
910
|
"simple-content(text):1": {
|
|
884
911
|
contentSaved: () => {
|
|
885
|
-
|
|
912
|
+
i.setState((t) => ({
|
|
886
913
|
afterSaveCount: t.afterSaveCount + 1
|
|
887
914
|
}));
|
|
888
915
|
},
|
|
889
|
-
getContent: () =>
|
|
916
|
+
getContent: () => i.getState().getTextContentFunction(),
|
|
890
917
|
loadContent: (t) => {
|
|
891
|
-
|
|
918
|
+
i.setState({ loadedTextContent: t });
|
|
892
919
|
}
|
|
893
920
|
},
|
|
894
921
|
"simple-content(json):1": {
|
|
895
922
|
contentSaved: () => {
|
|
896
|
-
|
|
923
|
+
i.setState((t) => ({
|
|
897
924
|
afterSaveCount: t.afterSaveCount + 1
|
|
898
925
|
}));
|
|
899
926
|
},
|
|
900
|
-
getContent: () =>
|
|
927
|
+
getContent: () => i.getState().getJsonContentFunction(),
|
|
901
928
|
loadContent: (t) => {
|
|
902
|
-
|
|
929
|
+
i.setState({ loadedJsonContent: t });
|
|
903
930
|
}
|
|
904
931
|
},
|
|
905
932
|
"simple-binary-data(text):1": {
|
|
906
933
|
contentSaved: () => {
|
|
907
|
-
|
|
934
|
+
i.setState((t) => ({
|
|
908
935
|
afterSaveCount: t.afterSaveCount + 1
|
|
909
936
|
}));
|
|
910
937
|
},
|
|
911
|
-
getContent: () =>
|
|
938
|
+
getContent: () => i.getState().getTextContentFunction(),
|
|
912
939
|
loadContent: (t) => {
|
|
913
|
-
|
|
940
|
+
i.setState({ loadedTextContent: t });
|
|
914
941
|
}
|
|
915
942
|
},
|
|
916
943
|
"simple-content-eval(text):1": {
|
|
917
944
|
contentSaved: () => {
|
|
918
|
-
|
|
945
|
+
i.setState((t) => ({
|
|
919
946
|
afterSaveCount: t.afterSaveCount + 1
|
|
920
947
|
}));
|
|
921
948
|
},
|
|
922
|
-
getContent: () =>
|
|
949
|
+
getContent: () => i.getState().getTextContentFunction(),
|
|
923
950
|
loadContent: (t) => {
|
|
924
|
-
|
|
951
|
+
i.setState({ loadedTextContent: t });
|
|
925
952
|
},
|
|
926
953
|
getAssignmentContent: () => {
|
|
927
954
|
throw new Error(
|
|
@@ -931,13 +958,13 @@ const qt = [
|
|
|
931
958
|
},
|
|
932
959
|
"simple-content-eval(json):1": {
|
|
933
960
|
contentSaved: () => {
|
|
934
|
-
|
|
961
|
+
i.setState((t) => ({
|
|
935
962
|
afterSaveCount: t.afterSaveCount + 1
|
|
936
963
|
}));
|
|
937
964
|
},
|
|
938
|
-
getContent: () =>
|
|
965
|
+
getContent: () => i.getState().getJsonContentFunction(),
|
|
939
966
|
loadContent: (t) => {
|
|
940
|
-
|
|
967
|
+
i.setState({ loadedJsonContent: t });
|
|
941
968
|
},
|
|
942
969
|
getAssignmentContent: () => {
|
|
943
970
|
throw new Error(
|
|
@@ -947,13 +974,13 @@ const qt = [
|
|
|
947
974
|
},
|
|
948
975
|
"simple-content-eval(json):2": {
|
|
949
976
|
contentSaved: () => {
|
|
950
|
-
|
|
977
|
+
i.setState((t) => ({
|
|
951
978
|
afterSaveCount: t.afterSaveCount + 1
|
|
952
979
|
}));
|
|
953
980
|
},
|
|
954
|
-
getContent: () =>
|
|
981
|
+
getContent: () => i.getState().getJsonContentFunction(),
|
|
955
982
|
loadContent: (t) => {
|
|
956
|
-
|
|
983
|
+
i.setState({ loadedJsonContent: t });
|
|
957
984
|
},
|
|
958
985
|
getAssignmentContent: () => {
|
|
959
986
|
throw new Error(
|
|
@@ -963,13 +990,13 @@ const qt = [
|
|
|
963
990
|
},
|
|
964
991
|
"simple-content-eval(text):2": {
|
|
965
992
|
contentSaved: () => {
|
|
966
|
-
|
|
993
|
+
i.setState((t) => ({
|
|
967
994
|
afterSaveCount: t.afterSaveCount + 1
|
|
968
995
|
}));
|
|
969
996
|
},
|
|
970
|
-
getContent: () =>
|
|
997
|
+
getContent: () => i.getState().getTextContentFunction(),
|
|
971
998
|
loadContent: (t) => {
|
|
972
|
-
|
|
999
|
+
i.setState({ loadedTextContent: t });
|
|
973
1000
|
},
|
|
974
1001
|
getAssignmentContent: () => {
|
|
975
1002
|
throw new Error(
|
|
@@ -979,22 +1006,22 @@ const qt = [
|
|
|
979
1006
|
},
|
|
980
1007
|
"separate-contents(json):1": {
|
|
981
1008
|
contentSaved: () => {
|
|
982
|
-
|
|
1009
|
+
i.setState((t) => ({
|
|
983
1010
|
afterSaveCount: t.afterSaveCount + 1
|
|
984
1011
|
}));
|
|
985
1012
|
},
|
|
986
1013
|
loadContent: (t, e) => {
|
|
987
|
-
|
|
1014
|
+
i.setState({
|
|
988
1015
|
loadedJsonActivityContent: t,
|
|
989
1016
|
loadedJsonAssignmentContent: e
|
|
990
1017
|
});
|
|
991
1018
|
},
|
|
992
|
-
getActivityContent: () =>
|
|
993
|
-
getAssignmentContent: () =>
|
|
1019
|
+
getActivityContent: () => i.getState().getJsonActivityContentFunction(),
|
|
1020
|
+
getAssignmentContent: () => i.getState().getJsonAssignmentContentFunction()
|
|
994
1021
|
},
|
|
995
1022
|
"separate-dual-contents(json):1": {
|
|
996
1023
|
contentSaved: () => {
|
|
997
|
-
|
|
1024
|
+
i.setState((t) => ({
|
|
998
1025
|
afterSaveCount: t.afterSaveCount + 1
|
|
999
1026
|
}));
|
|
1000
1027
|
},
|
|
@@ -1004,15 +1031,15 @@ const qt = [
|
|
|
1004
1031
|
activityBinaryData: n,
|
|
1005
1032
|
assignmentBinaryData: r
|
|
1006
1033
|
}) => {
|
|
1007
|
-
|
|
1034
|
+
i.setState({
|
|
1008
1035
|
loadedJsonActivityContent: t,
|
|
1009
1036
|
loadedJsonAssignmentContent: e,
|
|
1010
1037
|
loadedJsonActivityBinaryData: n,
|
|
1011
1038
|
loadedJsonAssignmentBinaryData: r
|
|
1012
1039
|
});
|
|
1013
1040
|
},
|
|
1014
|
-
getActivityContentAndData: () => (console.log("[React bindings] Getting activity content and data"),
|
|
1015
|
-
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())
|
|
1016
1043
|
},
|
|
1017
1044
|
"meta-player-anti-cheat:1": {
|
|
1018
1045
|
lock: () => {
|
|
@@ -1023,24 +1050,24 @@ const qt = [
|
|
|
1023
1050
|
"meta-player-ui:1": {
|
|
1024
1051
|
executeAction(t) {
|
|
1025
1052
|
if (console.log("[React bindings] Executing action:", t), t.startsWith("qa")) {
|
|
1026
|
-
const n =
|
|
1053
|
+
const n = i.getState().quickActions[t];
|
|
1027
1054
|
n ? n() : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1028
1055
|
} else {
|
|
1029
|
-
const n =
|
|
1056
|
+
const n = i.getState().sidebarActions[t];
|
|
1030
1057
|
n ? n() : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1031
1058
|
}
|
|
1032
1059
|
},
|
|
1033
1060
|
executeFileUpload(t, e) {
|
|
1034
1061
|
if (t.startsWith("qa")) {
|
|
1035
|
-
const r =
|
|
1062
|
+
const r = i.getState().quickActions[t];
|
|
1036
1063
|
r ? r(e) : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1037
1064
|
} else {
|
|
1038
|
-
const r =
|
|
1065
|
+
const r = i.getState().sidebarActions[t];
|
|
1039
1066
|
r ? r(e) : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1040
1067
|
}
|
|
1041
1068
|
},
|
|
1042
1069
|
updateSettings(t) {
|
|
1043
|
-
const e =
|
|
1070
|
+
const e = i.getState().activitySettingsCallback;
|
|
1044
1071
|
e ? e(t) : console.warn(
|
|
1045
1072
|
"activitySettingsCallback is not set. Changes:",
|
|
1046
1073
|
t
|
|
@@ -1049,27 +1076,35 @@ const qt = [
|
|
|
1049
1076
|
},
|
|
1050
1077
|
"meta-player-events:1": {
|
|
1051
1078
|
handleEvent(t) {
|
|
1052
|
-
t === "all-loaded" &&
|
|
1079
|
+
t === "all-loaded" && i.setState({ ready: !0 });
|
|
1053
1080
|
}
|
|
1054
1081
|
},
|
|
1055
1082
|
"llm:1": {
|
|
1056
1083
|
getFirstMessageContext: (t) => {
|
|
1057
|
-
const e =
|
|
1058
|
-
|
|
1059
|
-
throw new Error("LLM first message context function is not set");
|
|
1060
|
-
return e(t);
|
|
1084
|
+
const e = i.getState().llmGetFirstMessageContextFunction;
|
|
1085
|
+
return e ? e(t) : "";
|
|
1061
1086
|
},
|
|
1062
1087
|
getAllMessagesContext: (t) => {
|
|
1063
|
-
const e =
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
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);
|
|
1067
1100
|
}
|
|
1068
1101
|
}
|
|
1069
1102
|
}, b = Dt();
|
|
1070
1103
|
function Bt(t) {
|
|
1071
1104
|
if (console.log("[React bindings] Contracts to plug:", t), Z) {
|
|
1072
|
-
console.warn(
|
|
1105
|
+
console.warn(
|
|
1106
|
+
"[React bindings] Contracts have already been plugged. Skipping."
|
|
1107
|
+
);
|
|
1073
1108
|
return;
|
|
1074
1109
|
}
|
|
1075
1110
|
Z = !0;
|
|
@@ -1101,11 +1136,15 @@ function Bt(t) {
|
|
|
1101
1136
|
"separate-contents(json):1",
|
|
1102
1137
|
"separate-dual-contents(json):1"
|
|
1103
1138
|
])
|
|
1104
|
-
if (console.log(
|
|
1105
|
-
|
|
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
|
+
);
|
|
1106
1145
|
const n = e.split(":")[0];
|
|
1107
1146
|
b.use([n], ([r]) => {
|
|
1108
|
-
|
|
1147
|
+
i.subscribe(
|
|
1109
1148
|
(o) => o.isDirtyCount,
|
|
1110
1149
|
() => {
|
|
1111
1150
|
r.i?.contentChanged(), console.log(
|
|
@@ -1116,76 +1155,76 @@ function Bt(t) {
|
|
|
1116
1155
|
});
|
|
1117
1156
|
}
|
|
1118
1157
|
}
|
|
1119
|
-
const re = () =>
|
|
1158
|
+
const re = () => i((t) => {
|
|
1120
1159
|
if (t.mode === null)
|
|
1121
1160
|
throw new Error("Mode is not set. Have you used contract 'mode'?");
|
|
1122
1161
|
return t.mode;
|
|
1123
|
-
}), se = () =>
|
|
1162
|
+
}), se = () => i((t) => {
|
|
1124
1163
|
if (t.workflow === null)
|
|
1125
1164
|
throw new Error(
|
|
1126
1165
|
"Workflow is not set. Have you used contract 'workflow'?"
|
|
1127
1166
|
);
|
|
1128
1167
|
return t.workflow;
|
|
1129
|
-
}), ie = () =>
|
|
1168
|
+
}), ie = () => i((t) => {
|
|
1130
1169
|
if (t.theme === null)
|
|
1131
1170
|
throw new Error("Theme is not set. Have you used contract 'theme'?");
|
|
1132
1171
|
return t.theme;
|
|
1133
|
-
}), 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(
|
|
1134
1173
|
() => ({
|
|
1135
|
-
content:
|
|
1136
|
-
binaryData:
|
|
1174
|
+
content: i.getState().loadedJsonActivityContent,
|
|
1175
|
+
binaryData: i.getState().loadedJsonActivityBinaryData
|
|
1137
1176
|
}),
|
|
1138
1177
|
[]
|
|
1139
|
-
), we = () =>
|
|
1178
|
+
), we = () => A(
|
|
1140
1179
|
() => ({
|
|
1141
|
-
content:
|
|
1142
|
-
binaryData:
|
|
1180
|
+
content: i.getState().loadedJsonAssignmentContent,
|
|
1181
|
+
binaryData: i.getState().loadedJsonAssignmentBinaryData
|
|
1143
1182
|
}),
|
|
1144
1183
|
[]
|
|
1145
1184
|
), be = (t) => {
|
|
1146
|
-
const e =
|
|
1185
|
+
const e = i(
|
|
1147
1186
|
(n) => n.setGetTextContentFunction
|
|
1148
1187
|
);
|
|
1149
1188
|
w(() => {
|
|
1150
1189
|
e(t);
|
|
1151
1190
|
}, [t, e]);
|
|
1152
|
-
},
|
|
1153
|
-
const e =
|
|
1191
|
+
}, Ae = (t) => {
|
|
1192
|
+
const e = i(
|
|
1154
1193
|
(n) => n.setGetJsonContentFunction
|
|
1155
1194
|
);
|
|
1156
1195
|
w(() => {
|
|
1157
1196
|
e(t);
|
|
1158
1197
|
}, [t, e]);
|
|
1159
|
-
},
|
|
1160
|
-
const e =
|
|
1198
|
+
}, he = (t) => {
|
|
1199
|
+
const e = i(
|
|
1161
1200
|
(n) => n.setGetJsonActivityContentFunction
|
|
1162
1201
|
);
|
|
1163
1202
|
w(() => {
|
|
1164
1203
|
e(t);
|
|
1165
1204
|
}, [t, e]);
|
|
1166
1205
|
}, Re = (t) => {
|
|
1167
|
-
const e =
|
|
1206
|
+
const e = i(
|
|
1168
1207
|
(n) => n.setGetJsonAssignmentContentFunction
|
|
1169
1208
|
);
|
|
1170
1209
|
w(() => {
|
|
1171
1210
|
e(t);
|
|
1172
1211
|
}, [t, e]);
|
|
1173
|
-
},
|
|
1174
|
-
const e =
|
|
1212
|
+
}, Fe = (t) => {
|
|
1213
|
+
const e = i(
|
|
1175
1214
|
(n) => n.setGetJsonActivitySplitContentFunction
|
|
1176
1215
|
);
|
|
1177
1216
|
w(() => {
|
|
1178
1217
|
e(t);
|
|
1179
1218
|
}, [t, e]);
|
|
1180
|
-
},
|
|
1181
|
-
const e =
|
|
1219
|
+
}, Ee = (t) => {
|
|
1220
|
+
const e = i(
|
|
1182
1221
|
(n) => n.setGetJsonAssignmentSplitContentFunction
|
|
1183
1222
|
);
|
|
1184
1223
|
w(() => {
|
|
1185
1224
|
e(t);
|
|
1186
1225
|
}, [t, e]);
|
|
1187
1226
|
}, xe = (t) => {
|
|
1188
|
-
const e =
|
|
1227
|
+
const e = i((n) => n.afterSaveCount);
|
|
1189
1228
|
w(() => {
|
|
1190
1229
|
e > 0 && t();
|
|
1191
1230
|
}, [e]);
|
|
@@ -1211,8 +1250,8 @@ const re = () => a((t) => {
|
|
|
1211
1250
|
});
|
|
1212
1251
|
};
|
|
1213
1252
|
let P = 0, W = 0;
|
|
1214
|
-
const
|
|
1215
|
-
const n = U(t, e), r =
|
|
1253
|
+
const Te = (t, e) => {
|
|
1254
|
+
const n = U(t, e), r = i((o) => o.setSidebarActions);
|
|
1216
1255
|
w(() => (P++, P > 1 && console.error(
|
|
1217
1256
|
"[React bindings] Capytale iframe React: Multiple sidebar actions registered: ",
|
|
1218
1257
|
P
|
|
@@ -1249,8 +1288,8 @@ const Me = (t, e) => {
|
|
|
1249
1288
|
}), [n]);
|
|
1250
1289
|
};
|
|
1251
1290
|
let V = 0, H = 0;
|
|
1252
|
-
const
|
|
1253
|
-
const n = U(t, e), r =
|
|
1291
|
+
const Me = (t, e) => {
|
|
1292
|
+
const n = U(t, e), r = i((o) => o.setQuickActions);
|
|
1254
1293
|
w(() => (V++, V > 1 && console.error(
|
|
1255
1294
|
"[React bindings] Capytale iframe React: Multiple quick actions registered: ",
|
|
1256
1295
|
V
|
|
@@ -1288,7 +1327,7 @@ const Te = (t, e) => {
|
|
|
1288
1327
|
};
|
|
1289
1328
|
let D = 0;
|
|
1290
1329
|
const Wt = (t, e, n) => {
|
|
1291
|
-
const r = U(t, n), o =
|
|
1330
|
+
const r = U(t, n), o = i(
|
|
1292
1331
|
(s) => s.setActivitySettingsCallback
|
|
1293
1332
|
);
|
|
1294
1333
|
w(() => (console.log("[React bindings] Mounting useSettings"), D++, D > 1 && console.error(
|
|
@@ -1303,31 +1342,46 @@ const Wt = (t, e, n) => {
|
|
|
1303
1342
|
);
|
|
1304
1343
|
return;
|
|
1305
1344
|
}
|
|
1306
|
-
console.log(
|
|
1345
|
+
console.log(
|
|
1346
|
+
"[React bindings] Updating settings UI in MetaPlayer",
|
|
1347
|
+
r
|
|
1348
|
+
), s.i?.setSettingsUI(r);
|
|
1307
1349
|
}), o(
|
|
1308
1350
|
e
|
|
1309
1351
|
), () => {
|
|
1310
1352
|
o(null);
|
|
1311
1353
|
}), [r]);
|
|
1312
|
-
}, Ht = () =>
|
|
1354
|
+
}, Ht = () => A((e) => b.exec(["meta-player-ui"], ([n]) => {
|
|
1313
1355
|
if (n.version === 0)
|
|
1314
1356
|
throw console.error(
|
|
1315
1357
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1316
|
-
), new Error(
|
|
1358
|
+
), new Error(
|
|
1359
|
+
"Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1360
|
+
);
|
|
1317
1361
|
return n.i?.showToast(e);
|
|
1318
|
-
}), []), zt = () =>
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
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) => {
|
|
1331
1385
|
const n = Ht(), r = zt();
|
|
1332
1386
|
return w(() => {
|
|
1333
1387
|
if (t == null)
|
|
@@ -1339,21 +1393,23 @@ const Wt = (t, e, n) => {
|
|
|
1339
1393
|
});
|
|
1340
1394
|
};
|
|
1341
1395
|
}, [n, r, ...e]), null;
|
|
1342
|
-
},
|
|
1396
|
+
}, Le = () => A(() => b.exec(["trigger-save"], ([e]) => {
|
|
1343
1397
|
if (e.version === 0)
|
|
1344
1398
|
throw console.error(
|
|
1345
1399
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
1346
|
-
), new Error(
|
|
1400
|
+
), new Error(
|
|
1401
|
+
"Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
1402
|
+
);
|
|
1347
1403
|
return e.i?.triggerSave();
|
|
1348
|
-
}), []), Pe = () =>
|
|
1349
|
-
const n =
|
|
1404
|
+
}), []), Pe = () => i((t) => t.canSave), Ve = (t, e) => {
|
|
1405
|
+
const n = i(
|
|
1350
1406
|
(r) => r.setLlmGetFirstMessageContextFunction
|
|
1351
1407
|
);
|
|
1352
1408
|
w(() => (n(t), () => {
|
|
1353
1409
|
n(null);
|
|
1354
1410
|
}), [e, n]);
|
|
1355
1411
|
}, De = (t, e) => {
|
|
1356
|
-
const n =
|
|
1412
|
+
const n = i(
|
|
1357
1413
|
(r) => r.setLlmGetAllMessagesContextFunction
|
|
1358
1414
|
);
|
|
1359
1415
|
w(() => (n(t), () => {
|
|
@@ -1423,7 +1479,7 @@ function je({
|
|
|
1423
1479
|
loadOnlyWhenReady: n = !0,
|
|
1424
1480
|
activitySettingsStore: r
|
|
1425
1481
|
}) {
|
|
1426
|
-
const o =
|
|
1482
|
+
const o = i((s) => s.ready);
|
|
1427
1483
|
return w(() => {
|
|
1428
1484
|
const s = [...e];
|
|
1429
1485
|
for (const f of ee)
|
|
@@ -1444,18 +1500,18 @@ export {
|
|
|
1444
1500
|
xe as useAfterSaveAction,
|
|
1445
1501
|
Pe as useCanSave,
|
|
1446
1502
|
zt as useClearToast,
|
|
1447
|
-
|
|
1503
|
+
Ge as useClearToasts,
|
|
1448
1504
|
ve as useGetLoadedJsonActivityContent,
|
|
1449
1505
|
Se as useGetLoadedJsonActivitySplitContent,
|
|
1450
1506
|
Ce as useGetLoadedJsonAssignmentContent,
|
|
1451
1507
|
we as useGetLoadedJsonAssignmentSplitContent,
|
|
1452
1508
|
ye as useGetLoadedJsonContent,
|
|
1453
1509
|
me as useGetLoadedTextContent,
|
|
1454
|
-
|
|
1455
|
-
|
|
1510
|
+
he as useJsonActivityContentSaveFunction,
|
|
1511
|
+
Fe as useJsonActivitySplitContentSaveFunction,
|
|
1456
1512
|
Re as useJsonAssignmentContentSaveFunction,
|
|
1457
|
-
|
|
1458
|
-
|
|
1513
|
+
Ee as useJsonAssignmentSplitContentSaveFunction,
|
|
1514
|
+
Ae as useJsonContentSaveFunction,
|
|
1459
1515
|
De as useLLMAllMessagesContext,
|
|
1460
1516
|
Ve as useLLMFirstMessageContext,
|
|
1461
1517
|
fe as useLoadedJsonActivityBinaryData,
|
|
@@ -1468,14 +1524,14 @@ export {
|
|
|
1468
1524
|
ce as useNotifyIsDirty,
|
|
1469
1525
|
Je as usePreviewImageFile,
|
|
1470
1526
|
ke as usePreviewTextFile,
|
|
1471
|
-
|
|
1527
|
+
Me as useQuickActions,
|
|
1472
1528
|
ae as useRequestSave,
|
|
1473
1529
|
Wt as useSettings,
|
|
1474
1530
|
Ht as useShowToast,
|
|
1475
|
-
|
|
1531
|
+
Te as useSidebarActions,
|
|
1476
1532
|
be as useTextContentSaveFunction,
|
|
1477
1533
|
ie as useTheme,
|
|
1478
1534
|
Ut as useToast,
|
|
1479
|
-
|
|
1535
|
+
Le as useTriggerSave,
|
|
1480
1536
|
se as useWorkflow
|
|
1481
1537
|
};
|