@capytale/iframe-react 1.2.2 → 1.3.1
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 +291 -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;
|
|
@@ -866,6 +874,7 @@ const qt = [
|
|
|
866
874
|
"reload:1",
|
|
867
875
|
"theme:1",
|
|
868
876
|
"workflow:1",
|
|
877
|
+
"preview:1",
|
|
869
878
|
"trigger-save:1",
|
|
870
879
|
"simple-content(text):1",
|
|
871
880
|
"simple-content(json):1",
|
|
@@ -878,7 +887,7 @@ const qt = [
|
|
|
878
887
|
], tt = {
|
|
879
888
|
"mode:1": {
|
|
880
889
|
setMode: (t) => {
|
|
881
|
-
|
|
890
|
+
s.setState({ mode: t });
|
|
882
891
|
}
|
|
883
892
|
},
|
|
884
893
|
"reload:1": {
|
|
@@ -889,75 +898,87 @@ const qt = [
|
|
|
889
898
|
"theme:1": {
|
|
890
899
|
setTheme: (t) => {
|
|
891
900
|
if (t === null) {
|
|
892
|
-
|
|
901
|
+
s.setState({ theme: null });
|
|
893
902
|
return;
|
|
894
903
|
}
|
|
895
904
|
if (t !== "light" && t !== "dark") {
|
|
896
905
|
console.warn(
|
|
897
906
|
`[React bindings] Invalid theme: ${t}. Expected 'light' or 'dark'.`
|
|
898
|
-
),
|
|
907
|
+
), s.setState({ theme: null });
|
|
899
908
|
return;
|
|
900
909
|
}
|
|
901
|
-
|
|
910
|
+
s.setState({ theme: t });
|
|
902
911
|
}
|
|
903
912
|
},
|
|
904
913
|
"workflow:1": {
|
|
905
914
|
setWorkflow: (t) => {
|
|
906
|
-
|
|
915
|
+
s.setState({ workflow: t });
|
|
907
916
|
}
|
|
908
917
|
},
|
|
909
918
|
"workflow:2": {
|
|
910
919
|
setWorkflow: (t) => {
|
|
911
|
-
|
|
920
|
+
s.setState({ workflow: t });
|
|
921
|
+
}
|
|
922
|
+
},
|
|
923
|
+
"preview:1": {
|
|
924
|
+
startPreview: () => {
|
|
925
|
+
const t = s.getState().previewStartPreviewFunction;
|
|
926
|
+
return t ? t() : !1;
|
|
927
|
+
},
|
|
928
|
+
stopPreview: () => {
|
|
929
|
+
const t = s.getState().previewStopPreviewFunction;
|
|
930
|
+
if (!t)
|
|
931
|
+
throw new Error("Preview stop function is not set");
|
|
932
|
+
return t();
|
|
912
933
|
}
|
|
913
934
|
},
|
|
914
935
|
"trigger-save:1": {
|
|
915
936
|
setCanSave(t) {
|
|
916
|
-
|
|
937
|
+
s.setState({ canSave: t });
|
|
917
938
|
}
|
|
918
939
|
},
|
|
919
940
|
"simple-content(text):1": {
|
|
920
941
|
contentSaved: () => {
|
|
921
|
-
|
|
942
|
+
s.setState((t) => ({
|
|
922
943
|
afterSaveCount: t.afterSaveCount + 1
|
|
923
944
|
}));
|
|
924
945
|
},
|
|
925
|
-
getContent: () =>
|
|
946
|
+
getContent: () => s.getState().getTextContentFunction(),
|
|
926
947
|
loadContent: (t) => {
|
|
927
|
-
|
|
948
|
+
s.setState({ loadedTextContent: t });
|
|
928
949
|
}
|
|
929
950
|
},
|
|
930
951
|
"simple-content(json):1": {
|
|
931
952
|
contentSaved: () => {
|
|
932
|
-
|
|
953
|
+
s.setState((t) => ({
|
|
933
954
|
afterSaveCount: t.afterSaveCount + 1
|
|
934
955
|
}));
|
|
935
956
|
},
|
|
936
|
-
getContent: () =>
|
|
957
|
+
getContent: () => s.getState().getJsonContentFunction(),
|
|
937
958
|
loadContent: (t) => {
|
|
938
|
-
|
|
959
|
+
s.setState({ loadedJsonContent: t });
|
|
939
960
|
}
|
|
940
961
|
},
|
|
941
962
|
"simple-binary-data(text):1": {
|
|
942
963
|
contentSaved: () => {
|
|
943
|
-
|
|
964
|
+
s.setState((t) => ({
|
|
944
965
|
afterSaveCount: t.afterSaveCount + 1
|
|
945
966
|
}));
|
|
946
967
|
},
|
|
947
|
-
getContent: () =>
|
|
968
|
+
getContent: () => s.getState().getTextContentFunction(),
|
|
948
969
|
loadContent: (t) => {
|
|
949
|
-
|
|
970
|
+
s.setState({ loadedTextContent: t });
|
|
950
971
|
}
|
|
951
972
|
},
|
|
952
973
|
"simple-content-eval(text):1": {
|
|
953
974
|
contentSaved: () => {
|
|
954
|
-
|
|
975
|
+
s.setState((t) => ({
|
|
955
976
|
afterSaveCount: t.afterSaveCount + 1
|
|
956
977
|
}));
|
|
957
978
|
},
|
|
958
|
-
getContent: () =>
|
|
979
|
+
getContent: () => s.getState().getTextContentFunction(),
|
|
959
980
|
loadContent: (t) => {
|
|
960
|
-
|
|
981
|
+
s.setState({ loadedTextContent: t });
|
|
961
982
|
},
|
|
962
983
|
getAssignmentContent: () => {
|
|
963
984
|
throw new Error(
|
|
@@ -967,13 +988,13 @@ const qt = [
|
|
|
967
988
|
},
|
|
968
989
|
"simple-content-eval(json):1": {
|
|
969
990
|
contentSaved: () => {
|
|
970
|
-
|
|
991
|
+
s.setState((t) => ({
|
|
971
992
|
afterSaveCount: t.afterSaveCount + 1
|
|
972
993
|
}));
|
|
973
994
|
},
|
|
974
|
-
getContent: () =>
|
|
995
|
+
getContent: () => s.getState().getJsonContentFunction(),
|
|
975
996
|
loadContent: (t) => {
|
|
976
|
-
|
|
997
|
+
s.setState({ loadedJsonContent: t });
|
|
977
998
|
},
|
|
978
999
|
getAssignmentContent: () => {
|
|
979
1000
|
throw new Error(
|
|
@@ -983,13 +1004,13 @@ const qt = [
|
|
|
983
1004
|
},
|
|
984
1005
|
"simple-content-eval(json):2": {
|
|
985
1006
|
contentSaved: () => {
|
|
986
|
-
|
|
1007
|
+
s.setState((t) => ({
|
|
987
1008
|
afterSaveCount: t.afterSaveCount + 1
|
|
988
1009
|
}));
|
|
989
1010
|
},
|
|
990
|
-
getContent: () =>
|
|
1011
|
+
getContent: () => s.getState().getJsonContentFunction(),
|
|
991
1012
|
loadContent: (t) => {
|
|
992
|
-
|
|
1013
|
+
s.setState({ loadedJsonContent: t });
|
|
993
1014
|
},
|
|
994
1015
|
getAssignmentContent: () => {
|
|
995
1016
|
throw new Error(
|
|
@@ -999,13 +1020,13 @@ const qt = [
|
|
|
999
1020
|
},
|
|
1000
1021
|
"simple-content-eval(text):2": {
|
|
1001
1022
|
contentSaved: () => {
|
|
1002
|
-
|
|
1023
|
+
s.setState((t) => ({
|
|
1003
1024
|
afterSaveCount: t.afterSaveCount + 1
|
|
1004
1025
|
}));
|
|
1005
1026
|
},
|
|
1006
|
-
getContent: () =>
|
|
1027
|
+
getContent: () => s.getState().getTextContentFunction(),
|
|
1007
1028
|
loadContent: (t) => {
|
|
1008
|
-
|
|
1029
|
+
s.setState({ loadedTextContent: t });
|
|
1009
1030
|
},
|
|
1010
1031
|
getAssignmentContent: () => {
|
|
1011
1032
|
throw new Error(
|
|
@@ -1015,52 +1036,52 @@ const qt = [
|
|
|
1015
1036
|
},
|
|
1016
1037
|
"separate-contents(json):1": {
|
|
1017
1038
|
contentSaved: () => {
|
|
1018
|
-
|
|
1039
|
+
s.setState((t) => ({
|
|
1019
1040
|
afterSaveCount: t.afterSaveCount + 1
|
|
1020
1041
|
}));
|
|
1021
1042
|
},
|
|
1022
1043
|
loadContent: (t, e) => {
|
|
1023
|
-
|
|
1044
|
+
s.setState({
|
|
1024
1045
|
loadedJsonActivityContent: t,
|
|
1025
1046
|
loadedJsonAssignmentContent: e
|
|
1026
1047
|
});
|
|
1027
1048
|
},
|
|
1028
|
-
getActivityContent: () =>
|
|
1029
|
-
getAssignmentContent: () =>
|
|
1049
|
+
getActivityContent: () => s.getState().getJsonActivityContentFunction(),
|
|
1050
|
+
getAssignmentContent: () => s.getState().getJsonAssignmentContentFunction()
|
|
1030
1051
|
},
|
|
1031
1052
|
"separate-contents-eval(json):1": {
|
|
1032
1053
|
contentSaved: () => {
|
|
1033
|
-
|
|
1054
|
+
s.setState((t) => ({
|
|
1034
1055
|
afterSaveCount: t.afterSaveCount + 1
|
|
1035
1056
|
}));
|
|
1036
1057
|
},
|
|
1037
1058
|
loadContent: (t, e) => {
|
|
1038
|
-
|
|
1059
|
+
s.setState({
|
|
1039
1060
|
loadedJsonActivityContent: t,
|
|
1040
1061
|
loadedJsonAssignmentContent: e
|
|
1041
1062
|
});
|
|
1042
1063
|
},
|
|
1043
|
-
getActivityContent: () =>
|
|
1044
|
-
getAssignmentContent: () =>
|
|
1064
|
+
getActivityContent: () => s.getState().getJsonActivityContentFunction(),
|
|
1065
|
+
getAssignmentContent: () => s.getState().getJsonAssignmentContentFunction()
|
|
1045
1066
|
},
|
|
1046
1067
|
"separate-contents-eval(json):2": {
|
|
1047
1068
|
contentSaved: () => {
|
|
1048
|
-
|
|
1069
|
+
s.setState((t) => ({
|
|
1049
1070
|
afterSaveCount: t.afterSaveCount + 1
|
|
1050
1071
|
}));
|
|
1051
1072
|
},
|
|
1052
1073
|
loadContent: (t, e) => {
|
|
1053
|
-
|
|
1074
|
+
s.setState({
|
|
1054
1075
|
loadedJsonActivityContent: t,
|
|
1055
1076
|
loadedJsonAssignmentContent: e
|
|
1056
1077
|
});
|
|
1057
1078
|
},
|
|
1058
|
-
getActivityContent: () =>
|
|
1059
|
-
getAssignmentContent: () =>
|
|
1079
|
+
getActivityContent: () => s.getState().getJsonActivityContentFunction(),
|
|
1080
|
+
getAssignmentContent: () => s.getState().getJsonAssignmentContentFunction()
|
|
1060
1081
|
},
|
|
1061
1082
|
"separate-dual-contents(json):1": {
|
|
1062
1083
|
contentSaved: () => {
|
|
1063
|
-
|
|
1084
|
+
s.setState((t) => ({
|
|
1064
1085
|
afterSaveCount: t.afterSaveCount + 1
|
|
1065
1086
|
}));
|
|
1066
1087
|
},
|
|
@@ -1068,19 +1089,19 @@ const qt = [
|
|
|
1068
1089
|
activityContent: t,
|
|
1069
1090
|
assignmentContent: e,
|
|
1070
1091
|
activityBinaryData: n,
|
|
1071
|
-
assignmentBinaryData:
|
|
1092
|
+
assignmentBinaryData: r
|
|
1072
1093
|
}) => {
|
|
1073
|
-
|
|
1094
|
+
s.setState({
|
|
1074
1095
|
loadedJsonActivityContent: t,
|
|
1075
1096
|
loadedJsonAssignmentContent: e,
|
|
1076
1097
|
loadedJsonActivityBinaryData: n,
|
|
1077
|
-
loadedJsonAssignmentBinaryData:
|
|
1098
|
+
loadedJsonAssignmentBinaryData: r
|
|
1078
1099
|
});
|
|
1079
1100
|
},
|
|
1080
|
-
getActivityContentAndData: () =>
|
|
1081
|
-
getAssignmentContentAndData: () =>
|
|
1101
|
+
getActivityContentAndData: () => s.getState().getJsonActivitySplitContentFunction(),
|
|
1102
|
+
getAssignmentContentAndData: () => s.getState().getJsonAssignmentSplitContentFunction()
|
|
1082
1103
|
},
|
|
1083
|
-
"
|
|
1104
|
+
"anti-cheat:1": {
|
|
1084
1105
|
lock: () => {
|
|
1085
1106
|
},
|
|
1086
1107
|
unlock: () => {
|
|
@@ -1089,24 +1110,24 @@ const qt = [
|
|
|
1089
1110
|
"meta-player-ui:1": {
|
|
1090
1111
|
executeAction(t) {
|
|
1091
1112
|
if (t.startsWith("qa")) {
|
|
1092
|
-
const n =
|
|
1113
|
+
const n = s.getState().quickActions[t];
|
|
1093
1114
|
n ? n() : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1094
1115
|
} else {
|
|
1095
|
-
const n =
|
|
1116
|
+
const n = s.getState().sidebarActions[t];
|
|
1096
1117
|
n ? n() : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1097
1118
|
}
|
|
1098
1119
|
},
|
|
1099
1120
|
executeFileUpload(t, e) {
|
|
1100
1121
|
if (t.startsWith("qa")) {
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1122
|
+
const r = s.getState().quickActions[t];
|
|
1123
|
+
r ? r(e) : console.error(`[React bindings] Quick action not found: ${t}`);
|
|
1103
1124
|
} else {
|
|
1104
|
-
const
|
|
1105
|
-
|
|
1125
|
+
const r = s.getState().sidebarActions[t];
|
|
1126
|
+
r ? r(e) : console.error(`[React bindings] Sidebar action not found: ${t}`);
|
|
1106
1127
|
}
|
|
1107
1128
|
},
|
|
1108
1129
|
updateSettings(t) {
|
|
1109
|
-
const e =
|
|
1130
|
+
const e = s.getState().activitySettingsCallback;
|
|
1110
1131
|
e ? e(t) : console.warn(
|
|
1111
1132
|
"activitySettingsCallback is not set. Changes:",
|
|
1112
1133
|
t
|
|
@@ -1115,36 +1136,39 @@ const qt = [
|
|
|
1115
1136
|
},
|
|
1116
1137
|
"meta-player-events:1": {
|
|
1117
1138
|
handleEvent(t) {
|
|
1118
|
-
t === "all-loaded" &&
|
|
1139
|
+
t === "all-loaded" && s.setState({ ready: !0 });
|
|
1119
1140
|
}
|
|
1120
1141
|
},
|
|
1121
1142
|
"llm:1": {
|
|
1122
1143
|
getFirstMessageContext: (t) => {
|
|
1123
|
-
const e =
|
|
1144
|
+
const e = s.getState().llmGetFirstMessageContextFunction;
|
|
1124
1145
|
return e ? e(t) : "";
|
|
1125
1146
|
},
|
|
1126
1147
|
getAllMessagesContext: (t) => {
|
|
1127
|
-
const e =
|
|
1148
|
+
const e = s.getState().llmGetAllMessagesContextFunction;
|
|
1128
1149
|
return e ? e(t) : "";
|
|
1129
1150
|
},
|
|
1130
1151
|
getAvailableTools: (t) => {
|
|
1131
|
-
const e =
|
|
1152
|
+
const e = s.getState().llmGetAvailableToolsFunction;
|
|
1132
1153
|
return e ? e(t) : [];
|
|
1133
1154
|
},
|
|
1134
|
-
callTool: (t, e) => {
|
|
1135
|
-
const
|
|
1136
|
-
if (!
|
|
1155
|
+
callTool: (t, e, n) => {
|
|
1156
|
+
const r = s.getState().llmCallToolFunction;
|
|
1157
|
+
if (!r)
|
|
1137
1158
|
throw new Error("LLM call tool function is not set");
|
|
1138
|
-
return
|
|
1159
|
+
return r(t, e, n);
|
|
1139
1160
|
},
|
|
1140
|
-
getToolCallDescription: (t, e) => {
|
|
1141
|
-
const
|
|
1142
|
-
if (!
|
|
1161
|
+
getToolCallDescription: (t, e, n) => {
|
|
1162
|
+
const r = s.getState().llmDescribeToolFunction;
|
|
1163
|
+
if (!r)
|
|
1143
1164
|
throw new Error("LLM describe tool function is not set");
|
|
1144
|
-
return
|
|
1165
|
+
return r(t, e, n);
|
|
1145
1166
|
}
|
|
1146
1167
|
}
|
|
1147
|
-
},
|
|
1168
|
+
}, A = (
|
|
1169
|
+
// Workaround for typing inference issue
|
|
1170
|
+
Vt()
|
|
1171
|
+
);
|
|
1148
1172
|
function Wt(t) {
|
|
1149
1173
|
if (!Z) {
|
|
1150
1174
|
Z = !0;
|
|
@@ -1158,9 +1182,9 @@ function Wt(t) {
|
|
|
1158
1182
|
continue;
|
|
1159
1183
|
}
|
|
1160
1184
|
const n = tt[e];
|
|
1161
|
-
|
|
1185
|
+
A.plug([e], ([]) => [n]);
|
|
1162
1186
|
}
|
|
1163
|
-
|
|
1187
|
+
A.plugsDone();
|
|
1164
1188
|
for (const e of [
|
|
1165
1189
|
"simple-content(text):1",
|
|
1166
1190
|
"simple-content(json):1",
|
|
@@ -1174,92 +1198,92 @@ function Wt(t) {
|
|
|
1174
1198
|
])
|
|
1175
1199
|
if (t.includes(e)) {
|
|
1176
1200
|
const n = e.split(":")[0];
|
|
1177
|
-
|
|
1178
|
-
|
|
1201
|
+
A.use([n], ([r]) => {
|
|
1202
|
+
s.subscribe(
|
|
1179
1203
|
(o) => o.isDirtyCount,
|
|
1180
1204
|
() => {
|
|
1181
|
-
|
|
1205
|
+
r.i?.contentChanged();
|
|
1182
1206
|
}
|
|
1183
1207
|
);
|
|
1184
1208
|
});
|
|
1185
1209
|
}
|
|
1186
1210
|
}
|
|
1187
1211
|
}
|
|
1188
|
-
const re = () =>
|
|
1212
|
+
const re = () => s((t) => {
|
|
1189
1213
|
if (t.mode === null)
|
|
1190
1214
|
throw new Error("Mode is not set. Have you used contract 'mode'?");
|
|
1191
1215
|
return t.mode;
|
|
1192
|
-
}), se = () =>
|
|
1216
|
+
}), se = () => s((t) => {
|
|
1193
1217
|
if (t.workflow === null)
|
|
1194
1218
|
throw new Error(
|
|
1195
1219
|
"Workflow is not set. Have you used contract 'workflow'?"
|
|
1196
1220
|
);
|
|
1197
1221
|
return t.workflow;
|
|
1198
|
-
}), ie = () =>
|
|
1222
|
+
}), ie = () => s((t) => {
|
|
1199
1223
|
if (t.theme === null)
|
|
1200
1224
|
throw new Error("Theme is not set. Have you used contract 'theme'?");
|
|
1201
1225
|
return t.theme;
|
|
1202
|
-
}), ae = () =>
|
|
1226
|
+
}), 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
1227
|
() => ({
|
|
1204
|
-
content:
|
|
1205
|
-
binaryData:
|
|
1228
|
+
content: s.getState().loadedJsonActivityContent,
|
|
1229
|
+
binaryData: s.getState().loadedJsonActivityBinaryData
|
|
1206
1230
|
}),
|
|
1207
1231
|
[]
|
|
1208
|
-
),
|
|
1232
|
+
), we = () => b(
|
|
1209
1233
|
() => ({
|
|
1210
|
-
content:
|
|
1211
|
-
binaryData:
|
|
1234
|
+
content: s.getState().loadedJsonAssignmentContent,
|
|
1235
|
+
binaryData: s.getState().loadedJsonAssignmentBinaryData
|
|
1212
1236
|
}),
|
|
1213
1237
|
[]
|
|
1214
|
-
),
|
|
1215
|
-
const e =
|
|
1238
|
+
), Ae = (t) => {
|
|
1239
|
+
const e = s(
|
|
1216
1240
|
(n) => n.setGetTextContentFunction
|
|
1217
1241
|
);
|
|
1218
|
-
|
|
1242
|
+
w(() => {
|
|
1219
1243
|
e(t);
|
|
1220
1244
|
}, [t, e]);
|
|
1221
1245
|
}, be = (t) => {
|
|
1222
|
-
const e =
|
|
1246
|
+
const e = s(
|
|
1223
1247
|
(n) => n.setGetJsonContentFunction
|
|
1224
1248
|
);
|
|
1225
|
-
|
|
1249
|
+
w(() => {
|
|
1226
1250
|
e(t);
|
|
1227
1251
|
}, [t, e]);
|
|
1228
1252
|
}, he = (t) => {
|
|
1229
|
-
const e =
|
|
1253
|
+
const e = s(
|
|
1230
1254
|
(n) => n.setGetJsonActivityContentFunction
|
|
1231
1255
|
);
|
|
1232
|
-
|
|
1256
|
+
w(() => {
|
|
1233
1257
|
e(t);
|
|
1234
1258
|
}, [t, e]);
|
|
1235
1259
|
}, Fe = (t) => {
|
|
1236
|
-
const e =
|
|
1260
|
+
const e = s(
|
|
1237
1261
|
(n) => n.setGetJsonAssignmentContentFunction
|
|
1238
1262
|
);
|
|
1239
|
-
|
|
1263
|
+
w(() => {
|
|
1240
1264
|
e(t);
|
|
1241
1265
|
}, [t, e]);
|
|
1242
1266
|
}, Ee = (t) => {
|
|
1243
|
-
const e =
|
|
1267
|
+
const e = s(
|
|
1244
1268
|
(n) => n.setGetJsonActivitySplitContentFunction
|
|
1245
1269
|
);
|
|
1246
|
-
|
|
1270
|
+
w(() => {
|
|
1247
1271
|
e(t);
|
|
1248
1272
|
}, [t, e]);
|
|
1249
1273
|
}, Re = (t) => {
|
|
1250
|
-
const e =
|
|
1274
|
+
const e = s(
|
|
1251
1275
|
(n) => n.setGetJsonAssignmentSplitContentFunction
|
|
1252
1276
|
);
|
|
1253
|
-
|
|
1277
|
+
w(() => {
|
|
1254
1278
|
e(t);
|
|
1255
1279
|
}, [t, e]);
|
|
1256
1280
|
}, Je = (t) => {
|
|
1257
|
-
const e =
|
|
1258
|
-
|
|
1281
|
+
const e = s((n) => n.afterSaveCount);
|
|
1282
|
+
w(() => {
|
|
1259
1283
|
e > 0 && t();
|
|
1260
1284
|
}, [e]);
|
|
1261
1285
|
}, Te = () => (t, e) => {
|
|
1262
|
-
|
|
1286
|
+
A.use(["meta-player-ui"], ([n]) => {
|
|
1263
1287
|
if (n.version === 0) {
|
|
1264
1288
|
console.error(
|
|
1265
1289
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1269,7 +1293,7 @@ const re = () => r((t) => {
|
|
|
1269
1293
|
n.i?.previewTextFile(t, e);
|
|
1270
1294
|
});
|
|
1271
1295
|
}, ke = () => (t, e) => {
|
|
1272
|
-
|
|
1296
|
+
A.use(["meta-player-ui"], ([n]) => {
|
|
1273
1297
|
if (n.version === 0) {
|
|
1274
1298
|
console.error(
|
|
1275
1299
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1279,15 +1303,15 @@ const re = () => r((t) => {
|
|
|
1279
1303
|
n.i?.previewImageFile(t, e);
|
|
1280
1304
|
});
|
|
1281
1305
|
};
|
|
1282
|
-
let
|
|
1306
|
+
let G = 0, B = 0;
|
|
1283
1307
|
const xe = (t, e) => {
|
|
1284
|
-
const n = _(t, e),
|
|
1285
|
-
|
|
1308
|
+
const n = _(t, e), r = s((o) => o.setSidebarActions);
|
|
1309
|
+
w(() => (G++, G > 1 && console.error(
|
|
1286
1310
|
"[React bindings] Capytale iframe React: Multiple sidebar actions registered: ",
|
|
1287
|
-
|
|
1311
|
+
G
|
|
1288
1312
|
), () => {
|
|
1289
|
-
|
|
1290
|
-
}), []),
|
|
1313
|
+
G--;
|
|
1314
|
+
}), []), w(() => (A.use(["meta-player-ui"], ([o]) => {
|
|
1291
1315
|
if (o.version === 0) {
|
|
1292
1316
|
console.error(
|
|
1293
1317
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1295,7 +1319,7 @@ const xe = (t, e) => {
|
|
|
1295
1319
|
return;
|
|
1296
1320
|
}
|
|
1297
1321
|
B++;
|
|
1298
|
-
const
|
|
1322
|
+
const i = n.map((l, f) => ({
|
|
1299
1323
|
type: l.type,
|
|
1300
1324
|
title: l.title,
|
|
1301
1325
|
icon: l.icon,
|
|
@@ -1304,9 +1328,9 @@ const xe = (t, e) => {
|
|
|
1304
1328
|
})), u = {};
|
|
1305
1329
|
n.forEach((l, f) => {
|
|
1306
1330
|
u[`sa-${B}-${f}`] = l.action;
|
|
1307
|
-
}), o.i?.setSidebarActionButtons(
|
|
1331
|
+
}), o.i?.setSidebarActionButtons(i), r(u);
|
|
1308
1332
|
}), () => {
|
|
1309
|
-
|
|
1333
|
+
r({}), A.use(["meta-player-ui"], ([o]) => {
|
|
1310
1334
|
if (o.version === 0) {
|
|
1311
1335
|
console.error(
|
|
1312
1336
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1317,15 +1341,15 @@ const xe = (t, e) => {
|
|
|
1317
1341
|
});
|
|
1318
1342
|
}), [n]);
|
|
1319
1343
|
};
|
|
1320
|
-
let
|
|
1344
|
+
let D = 0, H = 0;
|
|
1321
1345
|
const Le = (t, e) => {
|
|
1322
|
-
const n = _(t, e),
|
|
1323
|
-
|
|
1346
|
+
const n = _(t, e), r = s((o) => o.setQuickActions);
|
|
1347
|
+
w(() => (D++, D > 1 && console.error(
|
|
1324
1348
|
"[React bindings] Capytale iframe React: Multiple quick actions registered: ",
|
|
1325
|
-
|
|
1349
|
+
D
|
|
1326
1350
|
), () => {
|
|
1327
|
-
|
|
1328
|
-
}), []),
|
|
1351
|
+
D--;
|
|
1352
|
+
}), []), w(() => (A.use(["meta-player-ui"], ([o]) => {
|
|
1329
1353
|
if (o.version === 0) {
|
|
1330
1354
|
console.error(
|
|
1331
1355
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1333,7 +1357,7 @@ const Le = (t, e) => {
|
|
|
1333
1357
|
return;
|
|
1334
1358
|
}
|
|
1335
1359
|
H++;
|
|
1336
|
-
const
|
|
1360
|
+
const i = n.map((l, f) => ({
|
|
1337
1361
|
type: l.type,
|
|
1338
1362
|
title: l.title,
|
|
1339
1363
|
icon: l.icon,
|
|
@@ -1342,9 +1366,9 @@ const Le = (t, e) => {
|
|
|
1342
1366
|
})), u = {};
|
|
1343
1367
|
n.forEach((l, f) => {
|
|
1344
1368
|
u[`qa-${H}-${f}`] = l.action;
|
|
1345
|
-
}), o.i?.setQuickActionButtons(
|
|
1369
|
+
}), o.i?.setQuickActionButtons(i), r(u);
|
|
1346
1370
|
}), () => {
|
|
1347
|
-
|
|
1371
|
+
r({}), A.use(["meta-player-ui"], ([o]) => {
|
|
1348
1372
|
if (o.version === 0) {
|
|
1349
1373
|
console.error(
|
|
1350
1374
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1357,28 +1381,28 @@ const Le = (t, e) => {
|
|
|
1357
1381
|
};
|
|
1358
1382
|
let V = 0;
|
|
1359
1383
|
const Bt = (t, e, n) => {
|
|
1360
|
-
const
|
|
1361
|
-
(
|
|
1384
|
+
const r = _(t, n), o = s(
|
|
1385
|
+
(i) => i.setActivitySettingsCallback
|
|
1362
1386
|
);
|
|
1363
|
-
|
|
1387
|
+
w(() => (V++, V > 1 && console.error(
|
|
1364
1388
|
"[React bindings] Capytale iframe React: Multiple settings registered: ",
|
|
1365
1389
|
V
|
|
1366
1390
|
), () => {
|
|
1367
1391
|
V--;
|
|
1368
|
-
}), []),
|
|
1369
|
-
if (
|
|
1392
|
+
}), []), w(() => (A.use(["meta-player-ui"], ([i]) => {
|
|
1393
|
+
if (i.version === 0) {
|
|
1370
1394
|
console.error(
|
|
1371
1395
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
1372
1396
|
);
|
|
1373
1397
|
return;
|
|
1374
1398
|
}
|
|
1375
|
-
|
|
1399
|
+
i.i?.setSettingsUI(r);
|
|
1376
1400
|
}), o(
|
|
1377
1401
|
e
|
|
1378
1402
|
), () => {
|
|
1379
1403
|
o(null);
|
|
1380
|
-
}), [
|
|
1381
|
-
}, Ht = () => b((e) =>
|
|
1404
|
+
}), [r]);
|
|
1405
|
+
}, Ht = () => b((e) => A.exec(["meta-player-ui"], ([n]) => {
|
|
1382
1406
|
if (n.version === 0)
|
|
1383
1407
|
throw console.error(
|
|
1384
1408
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1387,7 +1411,7 @@ const Bt = (t, e, n) => {
|
|
|
1387
1411
|
);
|
|
1388
1412
|
return n.i?.showToast(e);
|
|
1389
1413
|
}), []), zt = () => b(
|
|
1390
|
-
(e) =>
|
|
1414
|
+
(e) => A.exec(["meta-player-ui"], ([n]) => {
|
|
1391
1415
|
if (n.version === 0)
|
|
1392
1416
|
throw console.error(
|
|
1393
1417
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1398,7 +1422,7 @@ const Bt = (t, e, n) => {
|
|
|
1398
1422
|
}),
|
|
1399
1423
|
[]
|
|
1400
1424
|
), Me = () => b(
|
|
1401
|
-
() =>
|
|
1425
|
+
() => A.exec(["meta-player-ui"], ([e]) => {
|
|
1402
1426
|
if (e.version === 0)
|
|
1403
1427
|
throw console.error(
|
|
1404
1428
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat meta-player-ui"
|
|
@@ -1409,18 +1433,18 @@ const Bt = (t, e, n) => {
|
|
|
1409
1433
|
}),
|
|
1410
1434
|
[]
|
|
1411
1435
|
), _t = (t, e) => {
|
|
1412
|
-
const n = Ht(),
|
|
1413
|
-
return
|
|
1436
|
+
const n = Ht(), r = zt();
|
|
1437
|
+
return w(() => {
|
|
1414
1438
|
if (t == null)
|
|
1415
1439
|
return;
|
|
1416
1440
|
const o = n(t);
|
|
1417
1441
|
return () => {
|
|
1418
|
-
o.then((
|
|
1419
|
-
|
|
1442
|
+
o.then((i) => {
|
|
1443
|
+
i != null && r(i);
|
|
1420
1444
|
});
|
|
1421
1445
|
};
|
|
1422
|
-
}, [n,
|
|
1423
|
-
},
|
|
1446
|
+
}, [n, r, ...e]), null;
|
|
1447
|
+
}, Pe = () => b(() => A.exec(["trigger-save"], ([e]) => {
|
|
1424
1448
|
if (e.version === 0)
|
|
1425
1449
|
throw console.error(
|
|
1426
1450
|
"[React bindings] Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
@@ -1428,34 +1452,34 @@ const Bt = (t, e, n) => {
|
|
|
1428
1452
|
"Le MétaPlayer ne supporte pas le contrat trigger-save"
|
|
1429
1453
|
);
|
|
1430
1454
|
return e.i?.triggerSave();
|
|
1431
|
-
}), []),
|
|
1432
|
-
const n =
|
|
1433
|
-
(
|
|
1455
|
+
}), []), Ge = () => s((t) => t.canSave), De = (t, e) => {
|
|
1456
|
+
const n = s(
|
|
1457
|
+
(r) => r.setLlmGetFirstMessageContextFunction
|
|
1434
1458
|
);
|
|
1435
|
-
|
|
1459
|
+
w(() => (n(t), () => {
|
|
1436
1460
|
n(null);
|
|
1437
1461
|
}), [e, n]);
|
|
1438
1462
|
}, Ve = (t, e) => {
|
|
1439
|
-
const n =
|
|
1440
|
-
(
|
|
1463
|
+
const n = s(
|
|
1464
|
+
(r) => r.setLlmGetAllMessagesContextFunction
|
|
1441
1465
|
);
|
|
1442
|
-
|
|
1466
|
+
w(() => (n(t), () => {
|
|
1443
1467
|
n(null);
|
|
1444
1468
|
}), [e, n]);
|
|
1445
|
-
}, Ie = (t, e, n,
|
|
1446
|
-
const o =
|
|
1469
|
+
}, Ie = (t, e, n, r) => {
|
|
1470
|
+
const o = s(
|
|
1447
1471
|
(l) => l.setLlmGetAvailableToolsFunction
|
|
1448
|
-
),
|
|
1472
|
+
), i = s(
|
|
1449
1473
|
(l) => l.setLlmCallToolFunction
|
|
1450
|
-
), u =
|
|
1474
|
+
), u = s(
|
|
1451
1475
|
(l) => l.setLlmDescribeToolFunction
|
|
1452
1476
|
);
|
|
1453
|
-
|
|
1454
|
-
o(null),
|
|
1477
|
+
w(() => (o(t), i(e), u(n), () => {
|
|
1478
|
+
o(null), i(null), u(null);
|
|
1455
1479
|
}), [
|
|
1456
|
-
|
|
1480
|
+
r,
|
|
1457
1481
|
o,
|
|
1458
|
-
|
|
1482
|
+
i,
|
|
1459
1483
|
u
|
|
1460
1484
|
]);
|
|
1461
1485
|
};
|
|
@@ -1491,7 +1515,7 @@ function Xt(t) {
|
|
|
1491
1515
|
return e;
|
|
1492
1516
|
}
|
|
1493
1517
|
function je(t) {
|
|
1494
|
-
const n = dt()((
|
|
1518
|
+
const n = dt()((r) => ({
|
|
1495
1519
|
...Xt(t)
|
|
1496
1520
|
}));
|
|
1497
1521
|
return n.activitySettings = t, n;
|
|
@@ -1520,16 +1544,16 @@ function Oe({
|
|
|
1520
1544
|
children: t,
|
|
1521
1545
|
contracts: e,
|
|
1522
1546
|
loadOnlyWhenReady: n = !0,
|
|
1523
|
-
activitySettingsStore:
|
|
1547
|
+
activitySettingsStore: r
|
|
1524
1548
|
}) {
|
|
1525
|
-
const o =
|
|
1526
|
-
return
|
|
1527
|
-
const
|
|
1549
|
+
const o = s((i) => i.ready);
|
|
1550
|
+
return w(() => {
|
|
1551
|
+
const i = [...e];
|
|
1528
1552
|
for (const u of ee)
|
|
1529
|
-
|
|
1530
|
-
Wt(
|
|
1553
|
+
i.includes(u) || i.push(u);
|
|
1554
|
+
Wt(i);
|
|
1531
1555
|
}, []), n && !o ? /* @__PURE__ */ U("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */ ft(mt, { children: [
|
|
1532
|
-
|
|
1556
|
+
r && /* @__PURE__ */ U(te, { store: r }),
|
|
1533
1557
|
t
|
|
1534
1558
|
] });
|
|
1535
1559
|
}
|
|
@@ -1541,13 +1565,13 @@ export {
|
|
|
1541
1565
|
$e as TemporaryToast,
|
|
1542
1566
|
je as createActivitySettingsStore,
|
|
1543
1567
|
Je as useAfterSaveAction,
|
|
1544
|
-
|
|
1568
|
+
Ge as useCanSave,
|
|
1545
1569
|
zt as useClearToast,
|
|
1546
1570
|
Me as useClearToasts,
|
|
1547
1571
|
Ce as useGetLoadedJsonActivityContent,
|
|
1548
1572
|
Se as useGetLoadedJsonActivitySplitContent,
|
|
1549
1573
|
ye as useGetLoadedJsonAssignmentContent,
|
|
1550
|
-
|
|
1574
|
+
we as useGetLoadedJsonAssignmentSplitContent,
|
|
1551
1575
|
ve as useGetLoadedJsonContent,
|
|
1552
1576
|
pe as useGetLoadedTextContent,
|
|
1553
1577
|
he as useJsonActivityContentSaveFunction,
|
|
@@ -1556,7 +1580,7 @@ export {
|
|
|
1556
1580
|
Re as useJsonAssignmentSplitContentSaveFunction,
|
|
1557
1581
|
be as useJsonContentSaveFunction,
|
|
1558
1582
|
Ve as useLLMAllMessagesContext,
|
|
1559
|
-
|
|
1583
|
+
De as useLLMFirstMessageContext,
|
|
1560
1584
|
Ie as useLLMTools,
|
|
1561
1585
|
fe as useLoadedJsonActivityBinaryData,
|
|
1562
1586
|
de as useLoadedJsonActivityContent,
|
|
@@ -1573,9 +1597,9 @@ export {
|
|
|
1573
1597
|
Bt as useSettings,
|
|
1574
1598
|
Ht as useShowToast,
|
|
1575
1599
|
xe as useSidebarActions,
|
|
1576
|
-
|
|
1600
|
+
Ae as useTextContentSaveFunction,
|
|
1577
1601
|
ie as useTheme,
|
|
1578
1602
|
_t as useToast,
|
|
1579
|
-
|
|
1603
|
+
Pe as useTriggerSave,
|
|
1580
1604
|
se as useWorkflow
|
|
1581
1605
|
};
|