@capytale/iframe-react 1.2.2 → 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/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +10 -140
- package/dist/index.es.js +290 -267
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as U, jsxs as ft, Fragment as mt } from "react/jsx-runtime";
|
|
2
|
-
import M, { useCallback as b, useEffect as
|
|
2
|
+
import M, { useCallback as b, useEffect as w, useMemo as _ } from "react";
|
|
3
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) {
|
|
@@ -36,14 +36,14 @@ function St(t, e) {
|
|
|
36
36
|
return !1;
|
|
37
37
|
}
|
|
38
38
|
function Q(t, e = globalThis, n = ["*"]) {
|
|
39
|
-
e.addEventListener("message", function
|
|
39
|
+
e.addEventListener("message", function r(o) {
|
|
40
40
|
if (!o || !o.data)
|
|
41
41
|
return;
|
|
42
42
|
if (!St(n, o.origin)) {
|
|
43
43
|
console.warn(`Invalid origin '${o.origin}' for comlink proxy`);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
const { id:
|
|
46
|
+
const { id: i, type: u, path: l } = Object.assign({ path: [] }, o.data), f = (o.data.argumentList || []).map(J);
|
|
47
47
|
let g;
|
|
48
48
|
try {
|
|
49
49
|
const d = l.slice(0, -1).reduce((v, y) => v[y], t), m = l.reduce((v, y) => v[y], t);
|
|
@@ -80,38 +80,38 @@ function Q(t, e = globalThis, n = ["*"]) {
|
|
|
80
80
|
}
|
|
81
81
|
Promise.resolve(g).catch((d) => ({ value: d, [I]: 0 })).then((d) => {
|
|
82
82
|
const [m, v] = $(d);
|
|
83
|
-
e.postMessage(Object.assign(Object.assign({}, m), { id:
|
|
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
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:
|
|
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();
|
|
101
101
|
return t.addEventListener("message", function(o) {
|
|
102
|
-
const { data:
|
|
103
|
-
if (!
|
|
102
|
+
const { data: i } = o;
|
|
103
|
+
if (!i || !i.id)
|
|
104
104
|
return;
|
|
105
|
-
const u = n.get(
|
|
105
|
+
const u = n.get(i.id);
|
|
106
106
|
if (u)
|
|
107
107
|
try {
|
|
108
|
-
u(
|
|
108
|
+
u(i);
|
|
109
109
|
} finally {
|
|
110
|
-
n.delete(
|
|
110
|
+
n.delete(i.id);
|
|
111
111
|
}
|
|
112
112
|
}), z(t, n, [], e);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function P(t) {
|
|
115
115
|
if (t)
|
|
116
116
|
throw new Error("Proxy has been released and is not useable");
|
|
117
117
|
}
|
|
@@ -126,25 +126,25 @@ const j = /* @__PURE__ */ new WeakMap(), O = "FinalizationRegistry" in globalThi
|
|
|
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
131
|
j.set(e, n), O && O.register(t, e, t);
|
|
132
132
|
}
|
|
133
133
|
function bt(t) {
|
|
134
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
|
|
139
|
+
const i = new Proxy(r, {
|
|
140
140
|
get(u, l) {
|
|
141
|
-
if (
|
|
141
|
+
if (P(o), l === vt)
|
|
142
142
|
return () => {
|
|
143
|
-
bt(
|
|
143
|
+
bt(i), it(t), e.clear(), o = !0;
|
|
144
144
|
};
|
|
145
145
|
if (l === "then") {
|
|
146
146
|
if (n.length === 0)
|
|
147
|
-
return { then: () =>
|
|
147
|
+
return { then: () => i };
|
|
148
148
|
const f = x(t, e, {
|
|
149
149
|
type: "GET",
|
|
150
150
|
path: n.map((g) => g.toString())
|
|
@@ -154,7 +154,7 @@ function z(t, e, n = [], i = function() {
|
|
|
154
154
|
return z(t, e, [...n, l]);
|
|
155
155
|
},
|
|
156
156
|
set(u, l, f) {
|
|
157
|
-
|
|
157
|
+
P(o);
|
|
158
158
|
const [g, d] = $(f);
|
|
159
159
|
return x(t, e, {
|
|
160
160
|
type: "SET",
|
|
@@ -163,7 +163,7 @@ function z(t, e, n = [], i = 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, {
|
|
@@ -179,7 +179,7 @@ function z(t, e, n = [], i = function() {
|
|
|
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,7 +188,7 @@ function z(t, e, n = [], i = 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);
|
|
@@ -206,7 +206,7 @@ function lt(t) {
|
|
|
206
206
|
}
|
|
207
207
|
function Et(t, e = globalThis, n = "*") {
|
|
208
208
|
return {
|
|
209
|
-
postMessage: (
|
|
209
|
+
postMessage: (r, o) => t.postMessage(r, n, o),
|
|
210
210
|
addEventListener: e.addEventListener.bind(e),
|
|
211
211
|
removeEventListener: e.removeEventListener.bind(e)
|
|
212
212
|
};
|
|
@@ -214,12 +214,12 @@ function Et(t, e = globalThis, n = "*") {
|
|
|
214
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,10 +240,10 @@ 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
|
|
246
|
-
e.set(
|
|
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
249
|
function Rt() {
|
|
@@ -253,7 +253,7 @@ 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
|
}
|
|
@@ -277,22 +277,22 @@ function Tt(t, e) {
|
|
|
277
277
|
const d = Et(window.parent, void 0, e);
|
|
278
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
287
|
provide(m, v, y) {
|
|
288
|
-
if (
|
|
289
|
-
|
|
288
|
+
if (i == null) throw new Error(u("No handler for provide"));
|
|
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
|
};
|
|
@@ -307,25 +307,25 @@ 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();
|
|
314
314
|
},
|
|
315
315
|
set onProvide(d) {
|
|
316
|
-
|
|
316
|
+
i = d, g();
|
|
317
317
|
}
|
|
318
318
|
};
|
|
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
|
-
if (
|
|
324
|
+
if (i != null && i !== 0 && u != null)
|
|
325
325
|
return u;
|
|
326
326
|
}
|
|
327
327
|
function E(a) {
|
|
328
|
-
if (
|
|
328
|
+
if (i != null && u != null && !(a > i))
|
|
329
329
|
return u;
|
|
330
330
|
}
|
|
331
331
|
function h() {
|
|
@@ -339,7 +339,7 @@ function kt(t) {
|
|
|
339
339
|
return e;
|
|
340
340
|
},
|
|
341
341
|
get version() {
|
|
342
|
-
return
|
|
342
|
+
return i;
|
|
343
343
|
},
|
|
344
344
|
get i() {
|
|
345
345
|
return y();
|
|
@@ -353,15 +353,15 @@ function kt(t) {
|
|
|
353
353
|
return e;
|
|
354
354
|
},
|
|
355
355
|
get version() {
|
|
356
|
-
return f ?
|
|
356
|
+
return f ? i : void 0;
|
|
357
357
|
},
|
|
358
358
|
get i() {
|
|
359
359
|
return f ? y() : void 0;
|
|
360
360
|
},
|
|
361
361
|
v: (a) => f ? E(a) : void 0,
|
|
362
362
|
get promise() {
|
|
363
|
-
return
|
|
364
|
-
if (
|
|
363
|
+
return i === 0 ? Promise.reject(t("Remote interface not provided")) : h().then(() => {
|
|
364
|
+
if (i === 0) throw new Error(t("Remote interface not provided"));
|
|
365
365
|
return T();
|
|
366
366
|
});
|
|
367
367
|
}
|
|
@@ -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;
|
|
@@ -398,19 +398,19 @@ function kt(t) {
|
|
|
398
398
|
o = a;
|
|
399
399
|
},
|
|
400
400
|
get remoteVersion() {
|
|
401
|
-
if (
|
|
402
|
-
return
|
|
401
|
+
if (i != null)
|
|
402
|
+
return i;
|
|
403
403
|
},
|
|
404
404
|
set remoteVersion(a) {
|
|
405
|
-
if (
|
|
406
|
-
|
|
405
|
+
if (i != null && i !== a) throw new Error(t("A different remote version is already set for " + e + `(${i} -> ${a})`));
|
|
406
|
+
i = a, a === 0 && (l = !0);
|
|
407
407
|
},
|
|
408
408
|
get remoteVersionReceived() {
|
|
409
|
-
return
|
|
409
|
+
return i != null;
|
|
410
410
|
},
|
|
411
411
|
setRemoteInterface: (a) => {
|
|
412
|
-
if (
|
|
413
|
-
if (
|
|
412
|
+
if (i == null) throw new Error(t("Remote version not set"));
|
|
413
|
+
if (i === 0) {
|
|
414
414
|
console.warn(t("Remote version is 0, remote interface is ignored."));
|
|
415
415
|
return;
|
|
416
416
|
}
|
|
@@ -443,8 +443,8 @@ function kt(t) {
|
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
445
|
function xt(t) {
|
|
446
|
-
return function(e, n,
|
|
447
|
-
let
|
|
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
|
}
|
|
@@ -479,20 +479,20 @@ function xt(t) {
|
|
|
479
479
|
let d;
|
|
480
480
|
const m = n.length > 0 ? n.map((v) => v.getRemote()) : null;
|
|
481
481
|
try {
|
|
482
|
-
d = m == null ?
|
|
482
|
+
d = m == null ? i(g) : i(g, m);
|
|
483
483
|
} catch (v) {
|
|
484
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"));
|
|
488
|
-
return u = !0,
|
|
488
|
+
return u = !0, i = null, d;
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
493
|
function Lt(t) {
|
|
494
|
-
return function(e, n,
|
|
495
|
-
let
|
|
494
|
+
return function(e, n, r, o) {
|
|
495
|
+
let i = n, u = !1;
|
|
496
496
|
function l() {
|
|
497
497
|
return e.every((f) => f.isActivated);
|
|
498
498
|
}
|
|
@@ -511,10 +511,10 @@ 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
|
-
g =
|
|
517
|
+
g = i(f);
|
|
518
518
|
} catch (d) {
|
|
519
519
|
o == null ? console.error(t("error in callback:"), d) : o[1](d);
|
|
520
520
|
} finally {
|
|
@@ -532,12 +532,12 @@ 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
|
-
let c =
|
|
540
|
-
return c == null && (c =
|
|
539
|
+
let c = i[a];
|
|
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);
|
|
@@ -548,7 +548,7 @@ function Mt(t) {
|
|
|
548
548
|
C.forEach((S) => {
|
|
549
549
|
S.depGroup != null && (p[S.depGroup] = !0), S.depGroup = c;
|
|
550
550
|
});
|
|
551
|
-
}), Object.values(
|
|
551
|
+
}), Object.values(i).forEach((C) => {
|
|
552
552
|
C.depGroup != null && C.depGroup !== c && p[C.depGroup] && (C.depGroup = c);
|
|
553
553
|
});
|
|
554
554
|
}
|
|
@@ -558,11 +558,11 @@ function Mt(t) {
|
|
|
558
558
|
a[p].version != null && (c[p].remoteVersion = a[p].version);
|
|
559
559
|
v(c), R();
|
|
560
560
|
}, t.onDone = () => {
|
|
561
|
-
L || (L = !0, Object.values(
|
|
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 C =
|
|
565
|
+
let C = i[a];
|
|
566
566
|
if (C == null)
|
|
567
567
|
throw new Error(e(`Contract not declared : ${a}`));
|
|
568
568
|
if (C.remoteVersion != c)
|
|
@@ -586,7 +586,7 @@ function Mt(t) {
|
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
if (t.isReady && h && u.every((a) => a.isDeclared)) {
|
|
589
|
-
const a = Object.values(
|
|
589
|
+
const a = Object.values(i).filter((c) => !c.localVersionSent && c.localVersion != null);
|
|
590
590
|
if (a.length > 0)
|
|
591
591
|
for (const c of a)
|
|
592
592
|
await t.declare([{ name: c.name, version: c.localVersion }]), c.localVersionSent = !0;
|
|
@@ -605,13 +605,13 @@ function Mt(t) {
|
|
|
605
605
|
}
|
|
606
606
|
if (f != null) {
|
|
607
607
|
const a = Array(f + 1).fill(null);
|
|
608
|
-
for (const c in
|
|
609
|
-
const p =
|
|
608
|
+
for (const c in i) {
|
|
609
|
+
const p = i[c];
|
|
610
610
|
p.depGroup != null && (p.isActivable ? a[p.depGroup] == null && !p.isActivated && (a[p.depGroup] = !0) : a[p.depGroup] = !1);
|
|
611
611
|
}
|
|
612
612
|
if (a.some((c) => c === !0))
|
|
613
|
-
for (const c in
|
|
614
|
-
const p =
|
|
613
|
+
for (const c in i) {
|
|
614
|
+
const p = i[c];
|
|
615
615
|
p.depGroup != null && a[p.depGroup] && p.activate();
|
|
616
616
|
}
|
|
617
617
|
}
|
|
@@ -657,71 +657,71 @@ function Mt(t) {
|
|
|
657
657
|
if (h) {
|
|
658
658
|
if (!a) throw new Error(e("Cannot set done to false after it has been set to true."));
|
|
659
659
|
} else
|
|
660
|
-
a && (h = !0, Object.values(
|
|
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;
|
|
689
689
|
});
|
|
690
|
-
e.declareFactory(l, o,
|
|
690
|
+
e.declareFactory(l, o, i, u);
|
|
691
691
|
},
|
|
692
692
|
plugsDone() {
|
|
693
693
|
e.done = !0;
|
|
694
694
|
},
|
|
695
|
-
use(
|
|
696
|
-
let
|
|
697
|
-
Array.isArray(
|
|
695
|
+
use(r, o) {
|
|
696
|
+
let i = !0;
|
|
697
|
+
Array.isArray(r) || (r = [r], i = !1), e.declareCallback(r, o, i);
|
|
698
698
|
},
|
|
699
|
-
exec(
|
|
700
|
-
let
|
|
701
|
-
return Array.isArray(
|
|
702
|
-
e.declareCallback(
|
|
699
|
+
exec(r, o) {
|
|
700
|
+
let i = !0;
|
|
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
721
|
const v = e;
|
|
722
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
727
|
function Ot(t, e = jt) {
|
|
@@ -733,15 +733,15 @@ function Ot(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), $t = (t) => (e, n,
|
|
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(
|
|
744
|
+
let m = u(r.getState());
|
|
745
745
|
g = (v) => {
|
|
746
746
|
const y = u(v);
|
|
747
747
|
if (!d(m, y)) {
|
|
@@ -751,8 +751,8 @@ const X = (t) => {
|
|
|
751
751
|
}, f?.fireImmediately && l(m, m);
|
|
752
752
|
}
|
|
753
753
|
return o(g);
|
|
754
|
-
}), t(e, n,
|
|
755
|
-
}, Nt = $t,
|
|
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: () => {
|
|
@@ -1089,24 +1097,24 @@ const qt = [
|
|
|
1089
1097
|
"meta-player-ui:1": {
|
|
1090
1098
|
executeAction(t) {
|
|
1091
1099
|
if (t.startsWith("qa")) {
|
|
1092
|
-
const n =
|
|
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,36 +1123,51 @@ 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);
|
|
1153
|
+
}
|
|
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();
|
|
1145
1165
|
}
|
|
1146
1166
|
}
|
|
1147
|
-
},
|
|
1167
|
+
}, A = (
|
|
1168
|
+
// Workaround for typing inference issue
|
|
1169
|
+
Vt()
|
|
1170
|
+
);
|
|
1148
1171
|
function Wt(t) {
|
|
1149
1172
|
if (!Z) {
|
|
1150
1173
|
Z = !0;
|
|
@@ -1158,9 +1181,9 @@ function Wt(t) {
|
|
|
1158
1181
|
continue;
|
|
1159
1182
|
}
|
|
1160
1183
|
const n = tt[e];
|
|
1161
|
-
|
|
1184
|
+
A.plug([e], ([]) => [n]);
|
|
1162
1185
|
}
|
|
1163
|
-
|
|
1186
|
+
A.plugsDone();
|
|
1164
1187
|
for (const e of [
|
|
1165
1188
|
"simple-content(text):1",
|
|
1166
1189
|
"simple-content(json):1",
|
|
@@ -1174,92 +1197,92 @@ function Wt(t) {
|
|
|
1174
1197
|
])
|
|
1175
1198
|
if (t.includes(e)) {
|
|
1176
1199
|
const n = e.split(":")[0];
|
|
1177
|
-
|
|
1178
|
-
|
|
1200
|
+
A.use([n], ([r]) => {
|
|
1201
|
+
s.subscribe(
|
|
1179
1202
|
(o) => o.isDirtyCount,
|
|
1180
1203
|
() => {
|
|
1181
|
-
|
|
1204
|
+
r.i?.contentChanged();
|
|
1182
1205
|
}
|
|
1183
1206
|
);
|
|
1184
1207
|
});
|
|
1185
1208
|
}
|
|
1186
1209
|
}
|
|
1187
1210
|
}
|
|
1188
|
-
const re = () =>
|
|
1211
|
+
const re = () => s((t) => {
|
|
1189
1212
|
if (t.mode === null)
|
|
1190
1213
|
throw new Error("Mode is not set. Have you used contract 'mode'?");
|
|
1191
1214
|
return t.mode;
|
|
1192
|
-
}), se = () =>
|
|
1215
|
+
}), se = () => s((t) => {
|
|
1193
1216
|
if (t.workflow === null)
|
|
1194
1217
|
throw new Error(
|
|
1195
1218
|
"Workflow is not set. Have you used contract 'workflow'?"
|
|
1196
1219
|
);
|
|
1197
1220
|
return t.workflow;
|
|
1198
|
-
}), ie = () =>
|
|
1221
|
+
}), ie = () => s((t) => {
|
|
1199
1222
|
if (t.theme === null)
|
|
1200
1223
|
throw new Error("Theme is not set. Have you used contract 'theme'?");
|
|
1201
1224
|
return t.theme;
|
|
1202
|
-
}), 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(
|
|
1203
1226
|
() => ({
|
|
1204
|
-
content:
|
|
1205
|
-
binaryData:
|
|
1227
|
+
content: s.getState().loadedJsonActivityContent,
|
|
1228
|
+
binaryData: s.getState().loadedJsonActivityBinaryData
|
|
1206
1229
|
}),
|
|
1207
1230
|
[]
|
|
1208
|
-
),
|
|
1231
|
+
), we = () => b(
|
|
1209
1232
|
() => ({
|
|
1210
|
-
content:
|
|
1211
|
-
binaryData:
|
|
1233
|
+
content: s.getState().loadedJsonAssignmentContent,
|
|
1234
|
+
binaryData: s.getState().loadedJsonAssignmentBinaryData
|
|
1212
1235
|
}),
|
|
1213
1236
|
[]
|
|
1214
|
-
),
|
|
1215
|
-
const e =
|
|
1237
|
+
), Ae = (t) => {
|
|
1238
|
+
const e = s(
|
|
1216
1239
|
(n) => n.setGetTextContentFunction
|
|
1217
1240
|
);
|
|
1218
|
-
|
|
1241
|
+
w(() => {
|
|
1219
1242
|
e(t);
|
|
1220
1243
|
}, [t, e]);
|
|
1221
1244
|
}, be = (t) => {
|
|
1222
|
-
const e =
|
|
1245
|
+
const e = s(
|
|
1223
1246
|
(n) => n.setGetJsonContentFunction
|
|
1224
1247
|
);
|
|
1225
|
-
|
|
1248
|
+
w(() => {
|
|
1226
1249
|
e(t);
|
|
1227
1250
|
}, [t, e]);
|
|
1228
1251
|
}, he = (t) => {
|
|
1229
|
-
const e =
|
|
1252
|
+
const e = s(
|
|
1230
1253
|
(n) => n.setGetJsonActivityContentFunction
|
|
1231
1254
|
);
|
|
1232
|
-
|
|
1255
|
+
w(() => {
|
|
1233
1256
|
e(t);
|
|
1234
1257
|
}, [t, e]);
|
|
1235
1258
|
}, Fe = (t) => {
|
|
1236
|
-
const e =
|
|
1259
|
+
const e = s(
|
|
1237
1260
|
(n) => n.setGetJsonAssignmentContentFunction
|
|
1238
1261
|
);
|
|
1239
|
-
|
|
1262
|
+
w(() => {
|
|
1240
1263
|
e(t);
|
|
1241
1264
|
}, [t, e]);
|
|
1242
1265
|
}, Ee = (t) => {
|
|
1243
|
-
const e =
|
|
1266
|
+
const e = s(
|
|
1244
1267
|
(n) => n.setGetJsonActivitySplitContentFunction
|
|
1245
1268
|
);
|
|
1246
|
-
|
|
1269
|
+
w(() => {
|
|
1247
1270
|
e(t);
|
|
1248
1271
|
}, [t, e]);
|
|
1249
1272
|
}, Re = (t) => {
|
|
1250
|
-
const e =
|
|
1273
|
+
const e = s(
|
|
1251
1274
|
(n) => n.setGetJsonAssignmentSplitContentFunction
|
|
1252
1275
|
);
|
|
1253
|
-
|
|
1276
|
+
w(() => {
|
|
1254
1277
|
e(t);
|
|
1255
1278
|
}, [t, e]);
|
|
1256
1279
|
}, Je = (t) => {
|
|
1257
|
-
const e =
|
|
1258
|
-
|
|
1280
|
+
const e = s((n) => n.afterSaveCount);
|
|
1281
|
+
w(() => {
|
|
1259
1282
|
e > 0 && t();
|
|
1260
1283
|
}, [e]);
|
|
1261
1284
|
}, Te = () => (t, e) => {
|
|
1262
|
-
|
|
1285
|
+
A.use(["meta-player-ui"], ([n]) => {
|
|
1263
1286
|
if (n.version === 0) {
|
|
1264
1287
|
console.error(
|
|
1265
1288
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1269,7 +1292,7 @@ const re = () => r((t) => {
|
|
|
1269
1292
|
n.i?.previewTextFile(t, e);
|
|
1270
1293
|
});
|
|
1271
1294
|
}, ke = () => (t, e) => {
|
|
1272
|
-
|
|
1295
|
+
A.use(["meta-player-ui"], ([n]) => {
|
|
1273
1296
|
if (n.version === 0) {
|
|
1274
1297
|
console.error(
|
|
1275
1298
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1279,15 +1302,15 @@ const re = () => r((t) => {
|
|
|
1279
1302
|
n.i?.previewImageFile(t, e);
|
|
1280
1303
|
});
|
|
1281
1304
|
};
|
|
1282
|
-
let
|
|
1305
|
+
let G = 0, B = 0;
|
|
1283
1306
|
const xe = (t, e) => {
|
|
1284
|
-
const n = _(t, e),
|
|
1285
|
-
|
|
1307
|
+
const n = _(t, e), r = s((o) => o.setSidebarActions);
|
|
1308
|
+
w(() => (G++, G > 1 && console.error(
|
|
1286
1309
|
"[React bindings] Capytale iframe React: Multiple sidebar actions registered: ",
|
|
1287
|
-
|
|
1310
|
+
G
|
|
1288
1311
|
), () => {
|
|
1289
|
-
|
|
1290
|
-
}), []),
|
|
1312
|
+
G--;
|
|
1313
|
+
}), []), w(() => (A.use(["meta-player-ui"], ([o]) => {
|
|
1291
1314
|
if (o.version === 0) {
|
|
1292
1315
|
console.error(
|
|
1293
1316
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1295,7 +1318,7 @@ const xe = (t, e) => {
|
|
|
1295
1318
|
return;
|
|
1296
1319
|
}
|
|
1297
1320
|
B++;
|
|
1298
|
-
const
|
|
1321
|
+
const i = n.map((l, f) => ({
|
|
1299
1322
|
type: l.type,
|
|
1300
1323
|
title: l.title,
|
|
1301
1324
|
icon: l.icon,
|
|
@@ -1304,9 +1327,9 @@ const xe = (t, e) => {
|
|
|
1304
1327
|
})), u = {};
|
|
1305
1328
|
n.forEach((l, f) => {
|
|
1306
1329
|
u[`sa-${B}-${f}`] = l.action;
|
|
1307
|
-
}), o.i?.setSidebarActionButtons(
|
|
1330
|
+
}), o.i?.setSidebarActionButtons(i), r(u);
|
|
1308
1331
|
}), () => {
|
|
1309
|
-
|
|
1332
|
+
r({}), A.use(["meta-player-ui"], ([o]) => {
|
|
1310
1333
|
if (o.version === 0) {
|
|
1311
1334
|
console.error(
|
|
1312
1335
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1317,15 +1340,15 @@ const xe = (t, e) => {
|
|
|
1317
1340
|
});
|
|
1318
1341
|
}), [n]);
|
|
1319
1342
|
};
|
|
1320
|
-
let
|
|
1343
|
+
let D = 0, H = 0;
|
|
1321
1344
|
const Le = (t, e) => {
|
|
1322
|
-
const n = _(t, e),
|
|
1323
|
-
|
|
1345
|
+
const n = _(t, e), r = s((o) => o.setQuickActions);
|
|
1346
|
+
w(() => (D++, D > 1 && console.error(
|
|
1324
1347
|
"[React bindings] Capytale iframe React: Multiple quick actions registered: ",
|
|
1325
|
-
|
|
1348
|
+
D
|
|
1326
1349
|
), () => {
|
|
1327
|
-
|
|
1328
|
-
}), []),
|
|
1350
|
+
D--;
|
|
1351
|
+
}), []), w(() => (A.use(["meta-player-ui"], ([o]) => {
|
|
1329
1352
|
if (o.version === 0) {
|
|
1330
1353
|
console.error(
|
|
1331
1354
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1333,7 +1356,7 @@ const Le = (t, e) => {
|
|
|
1333
1356
|
return;
|
|
1334
1357
|
}
|
|
1335
1358
|
H++;
|
|
1336
|
-
const
|
|
1359
|
+
const i = n.map((l, f) => ({
|
|
1337
1360
|
type: l.type,
|
|
1338
1361
|
title: l.title,
|
|
1339
1362
|
icon: l.icon,
|
|
@@ -1342,9 +1365,9 @@ const Le = (t, e) => {
|
|
|
1342
1365
|
})), u = {};
|
|
1343
1366
|
n.forEach((l, f) => {
|
|
1344
1367
|
u[`qa-${H}-${f}`] = l.action;
|
|
1345
|
-
}), o.i?.setQuickActionButtons(
|
|
1368
|
+
}), o.i?.setQuickActionButtons(i), r(u);
|
|
1346
1369
|
}), () => {
|
|
1347
|
-
|
|
1370
|
+
r({}), A.use(["meta-player-ui"], ([o]) => {
|
|
1348
1371
|
if (o.version === 0) {
|
|
1349
1372
|
console.error(
|
|
1350
1373
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1357,28 +1380,28 @@ const Le = (t, e) => {
|
|
|
1357
1380
|
};
|
|
1358
1381
|
let V = 0;
|
|
1359
1382
|
const Bt = (t, e, n) => {
|
|
1360
|
-
const
|
|
1361
|
-
(
|
|
1383
|
+
const r = _(t, n), o = s(
|
|
1384
|
+
(i) => i.setActivitySettingsCallback
|
|
1362
1385
|
);
|
|
1363
|
-
|
|
1386
|
+
w(() => (V++, V > 1 && console.error(
|
|
1364
1387
|
"[React bindings] Capytale iframe React: Multiple settings registered: ",
|
|
1365
1388
|
V
|
|
1366
1389
|
), () => {
|
|
1367
1390
|
V--;
|
|
1368
|
-
}), []),
|
|
1369
|
-
if (
|
|
1391
|
+
}), []), w(() => (A.use(["meta-player-ui"], ([i]) => {
|
|
1392
|
+
if (i.version === 0) {
|
|
1370
1393
|
console.error(
|
|
1371
1394
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1372
1395
|
);
|
|
1373
1396
|
return;
|
|
1374
1397
|
}
|
|
1375
|
-
|
|
1398
|
+
i.i?.setSettingsUI(r);
|
|
1376
1399
|
}), o(
|
|
1377
1400
|
e
|
|
1378
1401
|
), () => {
|
|
1379
1402
|
o(null);
|
|
1380
|
-
}), [
|
|
1381
|
-
}, Ht = () => b((e) =>
|
|
1403
|
+
}), [r]);
|
|
1404
|
+
}, Ht = () => b((e) => A.exec(["meta-player-ui"], ([n]) => {
|
|
1382
1405
|
if (n.version === 0)
|
|
1383
1406
|
throw console.error(
|
|
1384
1407
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1387,7 +1410,7 @@ const Bt = (t, e, n) => {
|
|
|
1387
1410
|
);
|
|
1388
1411
|
return n.i?.showToast(e);
|
|
1389
1412
|
}), []), zt = () => b(
|
|
1390
|
-
(e) =>
|
|
1413
|
+
(e) => A.exec(["meta-player-ui"], ([n]) => {
|
|
1391
1414
|
if (n.version === 0)
|
|
1392
1415
|
throw console.error(
|
|
1393
1416
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1398,7 +1421,7 @@ const Bt = (t, e, n) => {
|
|
|
1398
1421
|
}),
|
|
1399
1422
|
[]
|
|
1400
1423
|
), Me = () => b(
|
|
1401
|
-
() =>
|
|
1424
|
+
() => A.exec(["meta-player-ui"], ([e]) => {
|
|
1402
1425
|
if (e.version === 0)
|
|
1403
1426
|
throw console.error(
|
|
1404
1427
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1409,18 +1432,18 @@ const Bt = (t, e, n) => {
|
|
|
1409
1432
|
}),
|
|
1410
1433
|
[]
|
|
1411
1434
|
), _t = (t, e) => {
|
|
1412
|
-
const n = Ht(),
|
|
1413
|
-
return
|
|
1435
|
+
const n = Ht(), r = zt();
|
|
1436
|
+
return w(() => {
|
|
1414
1437
|
if (t == null)
|
|
1415
1438
|
return;
|
|
1416
1439
|
const o = n(t);
|
|
1417
1440
|
return () => {
|
|
1418
|
-
o.then((
|
|
1419
|
-
|
|
1441
|
+
o.then((i) => {
|
|
1442
|
+
i != null && r(i);
|
|
1420
1443
|
});
|
|
1421
1444
|
};
|
|
1422
|
-
}, [n,
|
|
1423
|
-
},
|
|
1445
|
+
}, [n, r, ...e]), null;
|
|
1446
|
+
}, Pe = () => b(() => A.exec(["trigger-save"], ([e]) => {
|
|
1424
1447
|
if (e.version === 0)
|
|
1425
1448
|
throw console.error(
|
|
1426
1449
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
@@ -1428,34 +1451,34 @@ const Bt = (t, e, n) => {
|
|
|
1428
1451
|
"Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
1429
1452
|
);
|
|
1430
1453
|
return e.i?.triggerSave();
|
|
1431
|
-
}), []),
|
|
1432
|
-
const n =
|
|
1433
|
-
(
|
|
1454
|
+
}), []), Ge = () => s((t) => t.canSave), De = (t, e) => {
|
|
1455
|
+
const n = s(
|
|
1456
|
+
(r) => r.setLlmGetFirstMessageContextFunction
|
|
1434
1457
|
);
|
|
1435
|
-
|
|
1458
|
+
w(() => (n(t), () => {
|
|
1436
1459
|
n(null);
|
|
1437
1460
|
}), [e, n]);
|
|
1438
1461
|
}, Ve = (t, e) => {
|
|
1439
|
-
const n =
|
|
1440
|
-
(
|
|
1462
|
+
const n = s(
|
|
1463
|
+
(r) => r.setLlmGetAllMessagesContextFunction
|
|
1441
1464
|
);
|
|
1442
|
-
|
|
1465
|
+
w(() => (n(t), () => {
|
|
1443
1466
|
n(null);
|
|
1444
1467
|
}), [e, n]);
|
|
1445
|
-
}, Ie = (t, e, n,
|
|
1446
|
-
const o =
|
|
1468
|
+
}, Ie = (t, e, n, r) => {
|
|
1469
|
+
const o = s(
|
|
1447
1470
|
(l) => l.setLlmGetAvailableToolsFunction
|
|
1448
|
-
),
|
|
1471
|
+
), i = s(
|
|
1449
1472
|
(l) => l.setLlmCallToolFunction
|
|
1450
|
-
), u =
|
|
1473
|
+
), u = s(
|
|
1451
1474
|
(l) => l.setLlmDescribeToolFunction
|
|
1452
1475
|
);
|
|
1453
|
-
|
|
1454
|
-
o(null),
|
|
1476
|
+
w(() => (o(t), i(e), u(n), () => {
|
|
1477
|
+
o(null), i(null), u(null);
|
|
1455
1478
|
}), [
|
|
1456
|
-
|
|
1479
|
+
r,
|
|
1457
1480
|
o,
|
|
1458
|
-
|
|
1481
|
+
i,
|
|
1459
1482
|
u
|
|
1460
1483
|
]);
|
|
1461
1484
|
};
|
|
@@ -1491,7 +1514,7 @@ function Xt(t) {
|
|
|
1491
1514
|
return e;
|
|
1492
1515
|
}
|
|
1493
1516
|
function je(t) {
|
|
1494
|
-
const n = dt()((
|
|
1517
|
+
const n = dt()((r) => ({
|
|
1495
1518
|
...Xt(t)
|
|
1496
1519
|
}));
|
|
1497
1520
|
return n.activitySettings = t, n;
|
|
@@ -1520,16 +1543,16 @@ function Oe({
|
|
|
1520
1543
|
children: t,
|
|
1521
1544
|
contracts: e,
|
|
1522
1545
|
loadOnlyWhenReady: n = !0,
|
|
1523
|
-
activitySettingsStore:
|
|
1546
|
+
activitySettingsStore: r
|
|
1524
1547
|
}) {
|
|
1525
|
-
const o =
|
|
1526
|
-
return
|
|
1527
|
-
const
|
|
1548
|
+
const o = s((i) => i.ready);
|
|
1549
|
+
return w(() => {
|
|
1550
|
+
const i = [...e];
|
|
1528
1551
|
for (const u of ee)
|
|
1529
|
-
|
|
1530
|
-
Wt(
|
|
1552
|
+
i.includes(u) || i.push(u);
|
|
1553
|
+
Wt(i);
|
|
1531
1554
|
}, []), n && !o ? /* @__PURE__ */ U("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */ ft(mt, { children: [
|
|
1532
|
-
|
|
1555
|
+
r && /* @__PURE__ */ U(te, { store: r }),
|
|
1533
1556
|
t
|
|
1534
1557
|
] });
|
|
1535
1558
|
}
|
|
@@ -1541,13 +1564,13 @@ export {
|
|
|
1541
1564
|
$e as TemporaryToast,
|
|
1542
1565
|
je as createActivitySettingsStore,
|
|
1543
1566
|
Je as useAfterSaveAction,
|
|
1544
|
-
|
|
1567
|
+
Ge as useCanSave,
|
|
1545
1568
|
zt as useClearToast,
|
|
1546
1569
|
Me as useClearToasts,
|
|
1547
1570
|
Ce as useGetLoadedJsonActivityContent,
|
|
1548
1571
|
Se as useGetLoadedJsonActivitySplitContent,
|
|
1549
1572
|
ye as useGetLoadedJsonAssignmentContent,
|
|
1550
|
-
|
|
1573
|
+
we as useGetLoadedJsonAssignmentSplitContent,
|
|
1551
1574
|
ve as useGetLoadedJsonContent,
|
|
1552
1575
|
pe as useGetLoadedTextContent,
|
|
1553
1576
|
he as useJsonActivityContentSaveFunction,
|
|
@@ -1556,7 +1579,7 @@ export {
|
|
|
1556
1579
|
Re as useJsonAssignmentSplitContentSaveFunction,
|
|
1557
1580
|
be as useJsonContentSaveFunction,
|
|
1558
1581
|
Ve as useLLMAllMessagesContext,
|
|
1559
|
-
|
|
1582
|
+
De as useLLMFirstMessageContext,
|
|
1560
1583
|
Ie as useLLMTools,
|
|
1561
1584
|
fe as useLoadedJsonActivityBinaryData,
|
|
1562
1585
|
de as useLoadedJsonActivityContent,
|
|
@@ -1573,9 +1596,9 @@ export {
|
|
|
1573
1596
|
Bt as useSettings,
|
|
1574
1597
|
Ht as useShowToast,
|
|
1575
1598
|
xe as useSidebarActions,
|
|
1576
|
-
|
|
1599
|
+
Ae as useTextContentSaveFunction,
|
|
1577
1600
|
ie as useTheme,
|
|
1578
1601
|
_t as useToast,
|
|
1579
|
-
|
|
1602
|
+
Pe as useTriggerSave,
|
|
1580
1603
|
se as useWorkflow
|
|
1581
1604
|
};
|