@capytale/iframe-react 1.1.6 → 1.1.7

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.es.js CHANGED
@@ -1,47 +1,1369 @@
1
- import { jsx as h, jsxs as j, Fragment as M } from "react/jsx-runtime";
2
- import v, { useCallback as S, useEffect as l, useMemo as w } from "react";
3
- import { getSocket as I } from "@capytale/app-agent";
4
- const k = (t) => {
5
- let e;
6
- const o = /* @__PURE__ */ new Set(), s = (C, p) => {
7
- const d = typeof C == "function" ? C(e) : C;
8
- if (!Object.is(d, e)) {
9
- const J = e;
10
- e = p ?? (typeof d != "object" || d === null) ? d : Object.assign({}, e, d), o.forEach((m) => m(e, J));
11
- }
12
- }, i = () => e, a = { setState: s, getState: i, getInitialState: () => r, subscribe: (C) => (o.add(C), () => o.delete(C)) }, r = e = t(s, i, a);
13
- return a;
14
- }, L = (t) => t ? k(t) : k, $ = (t) => t;
15
- function q(t, e = $) {
16
- const o = v.useSyncExternalStore(
17
- t.subscribe,
18
- v.useCallback(() => e(t.getState()), [t, e]),
19
- v.useCallback(() => e(t.getInitialState()), [t, e])
1
+ import H, { useCallback as K, useEffect as J, useMemo as _e } from "react";
2
+ var se = { exports: {} }, ee = {};
3
+ var nt;
4
+ function zt() {
5
+ if (nt) return ee;
6
+ nt = 1;
7
+ var e = H, n = Symbol.for("react.element"), r = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, a = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
8
+ function m(l, d, v) {
9
+ var u, y = {}, S = null, k = null;
10
+ v !== void 0 && (S = "" + v), d.key !== void 0 && (S = "" + d.key), d.ref !== void 0 && (k = d.ref);
11
+ for (u in d) s.call(d, u) && !i.hasOwnProperty(u) && (y[u] = d[u]);
12
+ if (l && l.defaultProps) for (u in d = l.defaultProps, d) y[u] === void 0 && (y[u] = d[u]);
13
+ return { $$typeof: n, type: l, key: S, ref: k, props: y, _owner: a.current };
14
+ }
15
+ return ee.Fragment = r, ee.jsx = m, ee.jsxs = m, ee;
16
+ }
17
+ var te = {};
18
+ var rt;
19
+ function Ht() {
20
+ return rt || (rt = 1, process.env.NODE_ENV !== "production" && function() {
21
+ var e = H, n = Symbol.for("react.element"), r = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), m = Symbol.for("react.provider"), l = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), k = Symbol.for("react.offscreen"), V = Symbol.iterator, I = "@@iterator";
22
+ function $(t) {
23
+ if (t === null || typeof t != "object")
24
+ return null;
25
+ var o = V && t[V] || t[I];
26
+ return typeof o == "function" ? o : null;
27
+ }
28
+ var j = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
29
+ function T(t) {
30
+ {
31
+ for (var o = arguments.length, g = new Array(o > 1 ? o - 1 : 0), C = 1; C < o; C++)
32
+ g[C - 1] = arguments[C];
33
+ c("error", t, g);
34
+ }
35
+ }
36
+ function c(t, o, g) {
37
+ {
38
+ var C = j.ReactDebugCurrentFrame, A = C.getStackAddendum();
39
+ A !== "" && (o += "%s", g = g.concat([A]));
40
+ var R = g.map(function(b) {
41
+ return String(b);
42
+ });
43
+ R.unshift("Warning: " + o), Function.prototype.apply.call(console[t], console, R);
44
+ }
45
+ }
46
+ var p = !1, h = !1, E = !1, F = !1, G = !1, ne;
47
+ ne = Symbol.for("react.module.reference");
48
+ function M(t) {
49
+ return !!(typeof t == "string" || typeof t == "function" || t === s || t === i || G || t === a || t === v || t === u || F || t === k || p || h || E || typeof t == "object" && t !== null && (t.$$typeof === S || t.$$typeof === y || t.$$typeof === m || t.$$typeof === l || t.$$typeof === d || // This needs to include all possible module reference object
50
+ // types supported by any Flight configuration anywhere since
51
+ // we don't know which Flight build this will end up being used
52
+ // with.
53
+ t.$$typeof === ne || t.getModuleId !== void 0));
54
+ }
55
+ function Q(t, o, g) {
56
+ var C = t.displayName;
57
+ if (C)
58
+ return C;
59
+ var A = o.displayName || o.name || "";
60
+ return A !== "" ? g + "(" + A + ")" : g;
61
+ }
62
+ function Oe(t) {
63
+ return t.displayName || "Context";
64
+ }
65
+ function W(t) {
66
+ if (t == null)
67
+ return null;
68
+ if (typeof t.tag == "number" && T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof t == "function")
69
+ return t.displayName || t.name || null;
70
+ if (typeof t == "string")
71
+ return t;
72
+ switch (t) {
73
+ case s:
74
+ return "Fragment";
75
+ case r:
76
+ return "Portal";
77
+ case i:
78
+ return "Profiler";
79
+ case a:
80
+ return "StrictMode";
81
+ case v:
82
+ return "Suspense";
83
+ case u:
84
+ return "SuspenseList";
85
+ }
86
+ if (typeof t == "object")
87
+ switch (t.$$typeof) {
88
+ case l:
89
+ var o = t;
90
+ return Oe(o) + ".Consumer";
91
+ case m:
92
+ var g = t;
93
+ return Oe(g._context) + ".Provider";
94
+ case d:
95
+ return Q(t, t.render, "ForwardRef");
96
+ case y:
97
+ var C = t.displayName || null;
98
+ return C !== null ? C : W(t.type) || "Memo";
99
+ case S: {
100
+ var A = t, R = A._payload, b = A._init;
101
+ try {
102
+ return W(b(R));
103
+ } catch {
104
+ return null;
105
+ }
106
+ }
107
+ }
108
+ return null;
109
+ }
110
+ var N = Object.assign, X = 0, Je, je, De, Ve, Ie, Me, Le;
111
+ function $e() {
112
+ }
113
+ $e.__reactDisabledLog = !0;
114
+ function wt() {
115
+ {
116
+ if (X === 0) {
117
+ Je = console.log, je = console.info, De = console.warn, Ve = console.error, Ie = console.group, Me = console.groupCollapsed, Le = console.groupEnd;
118
+ var t = {
119
+ configurable: !0,
120
+ enumerable: !0,
121
+ value: $e,
122
+ writable: !0
123
+ };
124
+ Object.defineProperties(console, {
125
+ info: t,
126
+ log: t,
127
+ warn: t,
128
+ error: t,
129
+ group: t,
130
+ groupCollapsed: t,
131
+ groupEnd: t
132
+ });
133
+ }
134
+ X++;
135
+ }
136
+ }
137
+ function bt() {
138
+ {
139
+ if (X--, X === 0) {
140
+ var t = {
141
+ configurable: !0,
142
+ enumerable: !0,
143
+ writable: !0
144
+ };
145
+ Object.defineProperties(console, {
146
+ log: N({}, t, {
147
+ value: Je
148
+ }),
149
+ info: N({}, t, {
150
+ value: je
151
+ }),
152
+ warn: N({}, t, {
153
+ value: De
154
+ }),
155
+ error: N({}, t, {
156
+ value: Ve
157
+ }),
158
+ group: N({}, t, {
159
+ value: Ie
160
+ }),
161
+ groupCollapsed: N({}, t, {
162
+ value: Me
163
+ }),
164
+ groupEnd: N({}, t, {
165
+ value: Le
166
+ })
167
+ });
168
+ }
169
+ X < 0 && T("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
170
+ }
171
+ }
172
+ var ye = j.ReactCurrentDispatcher, Ce;
173
+ function re(t, o, g) {
174
+ {
175
+ if (Ce === void 0)
176
+ try {
177
+ throw Error();
178
+ } catch (A) {
179
+ var C = A.stack.trim().match(/\n( *(at )?)/);
180
+ Ce = C && C[1] || "";
181
+ }
182
+ return `
183
+ ` + Ce + t;
184
+ }
185
+ }
186
+ var Se = !1, oe;
187
+ {
188
+ var Et = typeof WeakMap == "function" ? WeakMap : Map;
189
+ oe = new Et();
190
+ }
191
+ function Ge(t, o) {
192
+ if (!t || Se)
193
+ return "";
194
+ {
195
+ var g = oe.get(t);
196
+ if (g !== void 0)
197
+ return g;
198
+ }
199
+ var C;
200
+ Se = !0;
201
+ var A = Error.prepareStackTrace;
202
+ Error.prepareStackTrace = void 0;
203
+ var R;
204
+ R = ye.current, ye.current = null, wt();
205
+ try {
206
+ if (o) {
207
+ var b = function() {
208
+ throw Error();
209
+ };
210
+ if (Object.defineProperty(b.prototype, "props", {
211
+ set: function() {
212
+ throw Error();
213
+ }
214
+ }), typeof Reflect == "object" && Reflect.construct) {
215
+ try {
216
+ Reflect.construct(b, []);
217
+ } catch (O) {
218
+ C = O;
219
+ }
220
+ Reflect.construct(t, [], b);
221
+ } else {
222
+ try {
223
+ b.call();
224
+ } catch (O) {
225
+ C = O;
226
+ }
227
+ t.call(b.prototype);
228
+ }
229
+ } else {
230
+ try {
231
+ throw Error();
232
+ } catch (O) {
233
+ C = O;
234
+ }
235
+ t();
236
+ }
237
+ } catch (O) {
238
+ if (O && C && typeof O.stack == "string") {
239
+ for (var w = O.stack.split(`
240
+ `), P = C.stack.split(`
241
+ `), x = w.length - 1, _ = P.length - 1; x >= 1 && _ >= 0 && w[x] !== P[_]; )
242
+ _--;
243
+ for (; x >= 1 && _ >= 0; x--, _--)
244
+ if (w[x] !== P[_]) {
245
+ if (x !== 1 || _ !== 1)
246
+ do
247
+ if (x--, _--, _ < 0 || w[x] !== P[_]) {
248
+ var D = `
249
+ ` + w[x].replace(" at new ", " at ");
250
+ return t.displayName && D.includes("<anonymous>") && (D = D.replace("<anonymous>", t.displayName)), typeof t == "function" && oe.set(t, D), D;
251
+ }
252
+ while (x >= 1 && _ >= 0);
253
+ break;
254
+ }
255
+ }
256
+ } finally {
257
+ Se = !1, ye.current = R, bt(), Error.prepareStackTrace = A;
258
+ }
259
+ var Y = t ? t.displayName || t.name : "", q = Y ? re(Y) : "";
260
+ return typeof t == "function" && oe.set(t, q), q;
261
+ }
262
+ function At(t, o, g) {
263
+ return Ge(t, !1);
264
+ }
265
+ function Rt(t) {
266
+ var o = t.prototype;
267
+ return !!(o && o.isReactComponent);
268
+ }
269
+ function ae(t, o, g) {
270
+ if (t == null)
271
+ return "";
272
+ if (typeof t == "function")
273
+ return Ge(t, Rt(t));
274
+ if (typeof t == "string")
275
+ return re(t);
276
+ switch (t) {
277
+ case v:
278
+ return re("Suspense");
279
+ case u:
280
+ return re("SuspenseList");
281
+ }
282
+ if (typeof t == "object")
283
+ switch (t.$$typeof) {
284
+ case d:
285
+ return At(t.render);
286
+ case y:
287
+ return ae(t.type, o, g);
288
+ case S: {
289
+ var C = t, A = C._payload, R = C._init;
290
+ try {
291
+ return ae(R(A), o, g);
292
+ } catch {
293
+ }
294
+ }
295
+ }
296
+ return "";
297
+ }
298
+ var Z = Object.prototype.hasOwnProperty, We = {}, Ne = j.ReactDebugCurrentFrame;
299
+ function ie(t) {
300
+ if (t) {
301
+ var o = t._owner, g = ae(t.type, t._source, o ? o.type : null);
302
+ Ne.setExtraStackFrame(g);
303
+ } else
304
+ Ne.setExtraStackFrame(null);
305
+ }
306
+ function kt(t, o, g, C, A) {
307
+ {
308
+ var R = Function.call.bind(Z);
309
+ for (var b in t)
310
+ if (R(t, b)) {
311
+ var w = void 0;
312
+ try {
313
+ if (typeof t[b] != "function") {
314
+ var P = Error((C || "React class") + ": " + g + " type `" + b + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof t[b] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
315
+ throw P.name = "Invariant Violation", P;
316
+ }
317
+ w = t[b](o, b, C, g, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
318
+ } catch (x) {
319
+ w = x;
320
+ }
321
+ w && !(w instanceof Error) && (ie(A), T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", C || "React class", g, b, typeof w), ie(null)), w instanceof Error && !(w.message in We) && (We[w.message] = !0, ie(A), T("Failed %s type: %s", g, w.message), ie(null));
322
+ }
323
+ }
324
+ }
325
+ var Tt = Array.isArray;
326
+ function he(t) {
327
+ return Tt(t);
328
+ }
329
+ function xt(t) {
330
+ {
331
+ var o = typeof Symbol == "function" && Symbol.toStringTag, g = o && t[Symbol.toStringTag] || t.constructor.name || "Object";
332
+ return g;
333
+ }
334
+ }
335
+ function Ft(t) {
336
+ try {
337
+ return qe(t), !1;
338
+ } catch {
339
+ return !0;
340
+ }
341
+ }
342
+ function qe(t) {
343
+ return "" + t;
344
+ }
345
+ function Ue(t) {
346
+ if (Ft(t))
347
+ return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", xt(t)), qe(t);
348
+ }
349
+ var Be = j.ReactCurrentOwner, _t = {
350
+ key: !0,
351
+ ref: !0,
352
+ __self: !0,
353
+ __source: !0
354
+ }, Ye, ze;
355
+ function Pt(t) {
356
+ if (Z.call(t, "ref")) {
357
+ var o = Object.getOwnPropertyDescriptor(t, "ref").get;
358
+ if (o && o.isReactWarning)
359
+ return !1;
360
+ }
361
+ return t.ref !== void 0;
362
+ }
363
+ function Ot(t) {
364
+ if (Z.call(t, "key")) {
365
+ var o = Object.getOwnPropertyDescriptor(t, "key").get;
366
+ if (o && o.isReactWarning)
367
+ return !1;
368
+ }
369
+ return t.key !== void 0;
370
+ }
371
+ function Jt(t, o) {
372
+ typeof t.ref == "string" && Be.current;
373
+ }
374
+ function jt(t, o) {
375
+ {
376
+ var g = function() {
377
+ Ye || (Ye = !0, T("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", o));
378
+ };
379
+ g.isReactWarning = !0, Object.defineProperty(t, "key", {
380
+ get: g,
381
+ configurable: !0
382
+ });
383
+ }
384
+ }
385
+ function Dt(t, o) {
386
+ {
387
+ var g = function() {
388
+ ze || (ze = !0, T("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", o));
389
+ };
390
+ g.isReactWarning = !0, Object.defineProperty(t, "ref", {
391
+ get: g,
392
+ configurable: !0
393
+ });
394
+ }
395
+ }
396
+ var Vt = function(t, o, g, C, A, R, b) {
397
+ var w = {
398
+ // This tag allows us to uniquely identify this as a React Element
399
+ $$typeof: n,
400
+ // Built-in properties that belong on the element
401
+ type: t,
402
+ key: o,
403
+ ref: g,
404
+ props: b,
405
+ // Record the component responsible for creating this element.
406
+ _owner: R
407
+ };
408
+ return w._store = {}, Object.defineProperty(w._store, "validated", {
409
+ configurable: !1,
410
+ enumerable: !1,
411
+ writable: !0,
412
+ value: !1
413
+ }), Object.defineProperty(w, "_self", {
414
+ configurable: !1,
415
+ enumerable: !1,
416
+ writable: !1,
417
+ value: C
418
+ }), Object.defineProperty(w, "_source", {
419
+ configurable: !1,
420
+ enumerable: !1,
421
+ writable: !1,
422
+ value: A
423
+ }), Object.freeze && (Object.freeze(w.props), Object.freeze(w)), w;
424
+ };
425
+ function It(t, o, g, C, A) {
426
+ {
427
+ var R, b = {}, w = null, P = null;
428
+ g !== void 0 && (Ue(g), w = "" + g), Ot(o) && (Ue(o.key), w = "" + o.key), Pt(o) && (P = o.ref, Jt(o, A));
429
+ for (R in o)
430
+ Z.call(o, R) && !_t.hasOwnProperty(R) && (b[R] = o[R]);
431
+ if (t && t.defaultProps) {
432
+ var x = t.defaultProps;
433
+ for (R in x)
434
+ b[R] === void 0 && (b[R] = x[R]);
435
+ }
436
+ if (w || P) {
437
+ var _ = typeof t == "function" ? t.displayName || t.name || "Unknown" : t;
438
+ w && jt(b, _), P && Dt(b, _);
439
+ }
440
+ return Vt(t, w, P, A, C, Be.current, b);
441
+ }
442
+ }
443
+ var we = j.ReactCurrentOwner, He = j.ReactDebugCurrentFrame;
444
+ function B(t) {
445
+ if (t) {
446
+ var o = t._owner, g = ae(t.type, t._source, o ? o.type : null);
447
+ He.setExtraStackFrame(g);
448
+ } else
449
+ He.setExtraStackFrame(null);
450
+ }
451
+ var be;
452
+ be = !1;
453
+ function Ee(t) {
454
+ return typeof t == "object" && t !== null && t.$$typeof === n;
455
+ }
456
+ function Ke() {
457
+ {
458
+ if (we.current) {
459
+ var t = W(we.current.type);
460
+ if (t)
461
+ return `
462
+
463
+ Check the render method of \`` + t + "`.";
464
+ }
465
+ return "";
466
+ }
467
+ }
468
+ function Mt(t) {
469
+ return "";
470
+ }
471
+ var Qe = {};
472
+ function Lt(t) {
473
+ {
474
+ var o = Ke();
475
+ if (!o) {
476
+ var g = typeof t == "string" ? t : t.displayName || t.name;
477
+ g && (o = `
478
+
479
+ Check the top-level render call using <` + g + ">.");
480
+ }
481
+ return o;
482
+ }
483
+ }
484
+ function Xe(t, o) {
485
+ {
486
+ if (!t._store || t._store.validated || t.key != null)
487
+ return;
488
+ t._store.validated = !0;
489
+ var g = Lt(o);
490
+ if (Qe[g])
491
+ return;
492
+ Qe[g] = !0;
493
+ var C = "";
494
+ t && t._owner && t._owner !== we.current && (C = " It was passed a child from " + W(t._owner.type) + "."), B(t), T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', g, C), B(null);
495
+ }
496
+ }
497
+ function Ze(t, o) {
498
+ {
499
+ if (typeof t != "object")
500
+ return;
501
+ if (he(t))
502
+ for (var g = 0; g < t.length; g++) {
503
+ var C = t[g];
504
+ Ee(C) && Xe(C, o);
505
+ }
506
+ else if (Ee(t))
507
+ t._store && (t._store.validated = !0);
508
+ else if (t) {
509
+ var A = $(t);
510
+ if (typeof A == "function" && A !== t.entries)
511
+ for (var R = A.call(t), b; !(b = R.next()).done; )
512
+ Ee(b.value) && Xe(b.value, o);
513
+ }
514
+ }
515
+ }
516
+ function $t(t) {
517
+ {
518
+ var o = t.type;
519
+ if (o == null || typeof o == "string")
520
+ return;
521
+ var g;
522
+ if (typeof o == "function")
523
+ g = o.propTypes;
524
+ else if (typeof o == "object" && (o.$$typeof === d || // Note: Memo only checks outer props here.
525
+ // Inner props are checked in the reconciler.
526
+ o.$$typeof === y))
527
+ g = o.propTypes;
528
+ else
529
+ return;
530
+ if (g) {
531
+ var C = W(o);
532
+ kt(g, t.props, "prop", C, t);
533
+ } else if (o.PropTypes !== void 0 && !be) {
534
+ be = !0;
535
+ var A = W(o);
536
+ T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", A || "Unknown");
537
+ }
538
+ typeof o.getDefaultProps == "function" && !o.getDefaultProps.isReactClassApproved && T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
539
+ }
540
+ }
541
+ function Gt(t) {
542
+ {
543
+ for (var o = Object.keys(t.props), g = 0; g < o.length; g++) {
544
+ var C = o[g];
545
+ if (C !== "children" && C !== "key") {
546
+ B(t), T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", C), B(null);
547
+ break;
548
+ }
549
+ }
550
+ t.ref !== null && (B(t), T("Invalid attribute `ref` supplied to `React.Fragment`."), B(null));
551
+ }
552
+ }
553
+ var et = {};
554
+ function tt(t, o, g, C, A, R) {
555
+ {
556
+ var b = M(t);
557
+ if (!b) {
558
+ var w = "";
559
+ (t === void 0 || typeof t == "object" && t !== null && Object.keys(t).length === 0) && (w += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
560
+ var P = Mt();
561
+ P ? w += P : w += Ke();
562
+ var x;
563
+ t === null ? x = "null" : he(t) ? x = "array" : t !== void 0 && t.$$typeof === n ? (x = "<" + (W(t.type) || "Unknown") + " />", w = " Did you accidentally export a JSX literal instead of a component?") : x = typeof t, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", x, w);
564
+ }
565
+ var _ = It(t, o, g, A, R);
566
+ if (_ == null)
567
+ return _;
568
+ if (b) {
569
+ var D = o.children;
570
+ if (D !== void 0)
571
+ if (C)
572
+ if (he(D)) {
573
+ for (var Y = 0; Y < D.length; Y++)
574
+ Ze(D[Y], t);
575
+ Object.freeze && Object.freeze(D);
576
+ } else
577
+ T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
578
+ else
579
+ Ze(D, t);
580
+ }
581
+ if (Z.call(o, "key")) {
582
+ var q = W(t), O = Object.keys(o).filter(function(Yt) {
583
+ return Yt !== "key";
584
+ }), Ae = O.length > 0 ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}";
585
+ if (!et[q + Ae]) {
586
+ var Bt = O.length > 0 ? "{" + O.join(": ..., ") + ": ...}" : "{}";
587
+ T(`A props object containing a "key" prop is being spread into JSX:
588
+ let props = %s;
589
+ <%s {...props} />
590
+ React keys must be passed directly to JSX without using spread:
591
+ let props = %s;
592
+ <%s key={someKey} {...props} />`, Ae, q, Bt, q), et[q + Ae] = !0;
593
+ }
594
+ }
595
+ return t === s ? Gt(_) : $t(_), _;
596
+ }
597
+ }
598
+ function Wt(t, o, g) {
599
+ return tt(t, o, g, !0);
600
+ }
601
+ function Nt(t, o, g) {
602
+ return tt(t, o, g, !1);
603
+ }
604
+ var qt = Nt, Ut = Wt;
605
+ te.Fragment = s, te.jsx = qt, te.jsxs = Ut;
606
+ }()), te;
607
+ }
608
+ var ot;
609
+ function Kt() {
610
+ return ot || (ot = 1, process.env.NODE_ENV === "production" ? se.exports = zt() : se.exports = Ht()), se.exports;
611
+ }
612
+ var ce = Kt();
613
+ const ut = Symbol("Comlink.proxy"), Qt = Symbol("Comlink.endpoint"), Xt = Symbol("Comlink.releaseProxy"), Re = Symbol("Comlink.finalizer"), ge = Symbol("Comlink.thrown"), ft = (e) => typeof e == "object" && e !== null || typeof e == "function", Zt = {
614
+ canHandle: (e) => ft(e) && e[ut],
615
+ serialize(e) {
616
+ const { port1: n, port2: r } = new MessageChannel();
617
+ return Pe(e, n), [r, [r]];
618
+ },
619
+ deserialize(e) {
620
+ return e.start(), vt(e);
621
+ }
622
+ }, en = {
623
+ canHandle: (e) => ft(e) && ge in e,
624
+ serialize({ value: e }) {
625
+ let n;
626
+ return e instanceof Error ? n = {
627
+ isError: !0,
628
+ value: {
629
+ message: e.message,
630
+ name: e.name,
631
+ stack: e.stack
632
+ }
633
+ } : n = { isError: !1, value: e }, [n, []];
634
+ },
635
+ deserialize(e) {
636
+ throw e.isError ? Object.assign(new Error(e.value.message), e.value) : e.value;
637
+ }
638
+ }, dt = /* @__PURE__ */ new Map([
639
+ ["proxy", Zt],
640
+ ["throw", en]
641
+ ]);
642
+ function tn(e, n) {
643
+ for (const r of e)
644
+ if (n === r || r === "*" || r instanceof RegExp && r.test(n))
645
+ return !0;
646
+ return !1;
647
+ }
648
+ function Pe(e, n = globalThis, r = ["*"]) {
649
+ n.addEventListener("message", function s(a) {
650
+ if (!a || !a.data)
651
+ return;
652
+ if (!tn(r, a.origin)) {
653
+ console.warn(`Invalid origin '${a.origin}' for comlink proxy`);
654
+ return;
655
+ }
656
+ const { id: i, type: m, path: l } = Object.assign({ path: [] }, a.data), d = (a.data.argumentList || []).map(U);
657
+ let v;
658
+ try {
659
+ const u = l.slice(0, -1).reduce((S, k) => S[k], e), y = l.reduce((S, k) => S[k], e);
660
+ switch (m) {
661
+ case "GET":
662
+ v = y;
663
+ break;
664
+ case "SET":
665
+ u[l.slice(-1)[0]] = U(a.data.value), v = !0;
666
+ break;
667
+ case "APPLY":
668
+ v = y.apply(u, d);
669
+ break;
670
+ case "CONSTRUCT":
671
+ {
672
+ const S = new y(...d);
673
+ v = yt(S);
674
+ }
675
+ break;
676
+ case "ENDPOINT":
677
+ {
678
+ const { port1: S, port2: k } = new MessageChannel();
679
+ Pe(e, k), v = sn(S, [S]);
680
+ }
681
+ break;
682
+ case "RELEASE":
683
+ v = void 0;
684
+ break;
685
+ default:
686
+ return;
687
+ }
688
+ } catch (u) {
689
+ v = { value: u, [ge]: 0 };
690
+ }
691
+ Promise.resolve(v).catch((u) => ({ value: u, [ge]: 0 })).then((u) => {
692
+ const [y, S] = me(u);
693
+ n.postMessage(Object.assign(Object.assign({}, y), { id: i }), S), m === "RELEASE" && (n.removeEventListener("message", s), gt(n), Re in e && typeof e[Re] == "function" && e[Re]());
694
+ }).catch((u) => {
695
+ const [y, S] = me({
696
+ value: new TypeError("Unserializable return value"),
697
+ [ge]: 0
698
+ });
699
+ n.postMessage(Object.assign(Object.assign({}, y), { id: i }), S);
700
+ });
701
+ }), n.start && n.start();
702
+ }
703
+ function nn(e) {
704
+ return e.constructor.name === "MessagePort";
705
+ }
706
+ function gt(e) {
707
+ nn(e) && e.close();
708
+ }
709
+ function vt(e, n) {
710
+ const r = /* @__PURE__ */ new Map();
711
+ return e.addEventListener("message", function(a) {
712
+ const { data: i } = a;
713
+ if (!i || !i.id)
714
+ return;
715
+ const m = r.get(i.id);
716
+ if (m)
717
+ try {
718
+ m(i);
719
+ } finally {
720
+ r.delete(i.id);
721
+ }
722
+ }), Fe(e, r, [], n);
723
+ }
724
+ function le(e) {
725
+ if (e)
726
+ throw new Error("Proxy has been released and is not useable");
727
+ }
728
+ function pt(e) {
729
+ return z(e, /* @__PURE__ */ new Map(), {
730
+ type: "RELEASE"
731
+ }).then(() => {
732
+ gt(e);
733
+ });
734
+ }
735
+ const ve = /* @__PURE__ */ new WeakMap(), pe = "FinalizationRegistry" in globalThis && new FinalizationRegistry((e) => {
736
+ const n = (ve.get(e) || 0) - 1;
737
+ ve.set(e, n), n === 0 && pt(e);
738
+ });
739
+ function rn(e, n) {
740
+ const r = (ve.get(n) || 0) + 1;
741
+ ve.set(n, r), pe && pe.register(e, n, e);
742
+ }
743
+ function on(e) {
744
+ pe && pe.unregister(e);
745
+ }
746
+ function Fe(e, n, r = [], s = function() {
747
+ }) {
748
+ let a = !1;
749
+ const i = new Proxy(s, {
750
+ get(m, l) {
751
+ if (le(a), l === Xt)
752
+ return () => {
753
+ on(i), pt(e), n.clear(), a = !0;
754
+ };
755
+ if (l === "then") {
756
+ if (r.length === 0)
757
+ return { then: () => i };
758
+ const d = z(e, n, {
759
+ type: "GET",
760
+ path: r.map((v) => v.toString())
761
+ }).then(U);
762
+ return d.then.bind(d);
763
+ }
764
+ return Fe(e, n, [...r, l]);
765
+ },
766
+ set(m, l, d) {
767
+ le(a);
768
+ const [v, u] = me(d);
769
+ return z(e, n, {
770
+ type: "SET",
771
+ path: [...r, l].map((y) => y.toString()),
772
+ value: v
773
+ }, u).then(U);
774
+ },
775
+ apply(m, l, d) {
776
+ le(a);
777
+ const v = r[r.length - 1];
778
+ if (v === Qt)
779
+ return z(e, n, {
780
+ type: "ENDPOINT"
781
+ }).then(U);
782
+ if (v === "bind")
783
+ return Fe(e, n, r.slice(0, -1));
784
+ const [u, y] = at(d);
785
+ return z(e, n, {
786
+ type: "APPLY",
787
+ path: r.map((S) => S.toString()),
788
+ argumentList: u
789
+ }, y).then(U);
790
+ },
791
+ construct(m, l) {
792
+ le(a);
793
+ const [d, v] = at(l);
794
+ return z(e, n, {
795
+ type: "CONSTRUCT",
796
+ path: r.map((u) => u.toString()),
797
+ argumentList: d
798
+ }, v).then(U);
799
+ }
800
+ });
801
+ return rn(i, e), i;
802
+ }
803
+ function an(e) {
804
+ return Array.prototype.concat.apply([], e);
805
+ }
806
+ function at(e) {
807
+ const n = e.map(me);
808
+ return [n.map((r) => r[0]), an(n.map((r) => r[1]))];
809
+ }
810
+ const mt = /* @__PURE__ */ new WeakMap();
811
+ function sn(e, n) {
812
+ return mt.set(e, n), e;
813
+ }
814
+ function yt(e) {
815
+ return Object.assign(e, { [ut]: !0 });
816
+ }
817
+ function cn(e, n = globalThis, r = "*") {
818
+ return {
819
+ postMessage: (s, a) => e.postMessage(s, r, a),
820
+ addEventListener: n.addEventListener.bind(n),
821
+ removeEventListener: n.removeEventListener.bind(n)
822
+ };
823
+ }
824
+ function me(e) {
825
+ for (const [n, r] of dt)
826
+ if (r.canHandle(e)) {
827
+ const [s, a] = r.serialize(e);
828
+ return [
829
+ {
830
+ type: "HANDLER",
831
+ name: n,
832
+ value: s
833
+ },
834
+ a
835
+ ];
836
+ }
837
+ return [
838
+ {
839
+ type: "RAW",
840
+ value: e
841
+ },
842
+ mt.get(e) || []
843
+ ];
844
+ }
845
+ function U(e) {
846
+ switch (e.type) {
847
+ case "HANDLER":
848
+ return dt.get(e.name).deserialize(e.value);
849
+ case "RAW":
850
+ return e.value;
851
+ }
852
+ }
853
+ function z(e, n, r, s) {
854
+ return new Promise((a) => {
855
+ const i = ln();
856
+ n.set(i, a), e.start && e.start(), e.postMessage(Object.assign({ id: i }, r), s);
857
+ });
858
+ }
859
+ function ln() {
860
+ return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
861
+ }
862
+ function un(e, n) {
863
+ return e.length === 0 ? n : `[${e}] ${n}`;
864
+ }
865
+ function fn(e, n) {
866
+ let r = !1, s, a, i;
867
+ function m(u) {
868
+ return un(e, u);
869
+ }
870
+ let l, d = !1;
871
+ if (window.parent === window)
872
+ console.warn(m("Contract link is not supported in standalone mode")), l = {
873
+ ready() {
874
+ return Promise.resolve();
875
+ },
876
+ declare() {
877
+ return Promise.resolve();
878
+ },
879
+ done() {
880
+ return Promise.resolve();
881
+ },
882
+ provide(u, y, S) {
883
+ return Promise.resolve();
884
+ }
885
+ };
886
+ else {
887
+ const u = cn(window.parent, void 0, n);
888
+ Pe({
889
+ declare(y) {
890
+ if (s == null) throw new Error(m("No handler for declare"));
891
+ s(y);
892
+ },
893
+ done() {
894
+ if (a == null) throw new Error(m("No handler for done"));
895
+ a();
896
+ },
897
+ provide(y, S, k) {
898
+ if (i == null) throw new Error(m("No handler for provide"));
899
+ i(y, S, k);
900
+ }
901
+ }, u), l = vt(u), d = !0;
902
+ }
903
+ const v = () => {
904
+ if (!r) {
905
+ if (s == null || a == null || i == null) return;
906
+ r = !0, l.ready();
907
+ }
908
+ };
909
+ return {
910
+ declare: (u) => l.declare(u),
911
+ done: () => l.done(),
912
+ provide: (u, y, S) => l.provide(u, y, yt(S)),
913
+ get name() {
914
+ return e;
915
+ },
916
+ get isReady() {
917
+ return d;
918
+ },
919
+ set onDeclare(u) {
920
+ s = u, v();
921
+ },
922
+ set onDone(u) {
923
+ a = u, v();
924
+ },
925
+ set onProvide(u) {
926
+ i = u, v();
927
+ }
928
+ };
929
+ }
930
+ function dn(e) {
931
+ return function(n) {
932
+ let r, s = !1, a = !1, i, m, l = !1, d = !1, v, u, y, S;
933
+ function k() {
934
+ if (i != null && i !== 0 && m != null)
935
+ return m;
936
+ }
937
+ function V(c) {
938
+ if (i != null && m != null && !(c > i))
939
+ return m;
940
+ }
941
+ function I() {
942
+ return y ?? (d ? y = Promise.resolve() : y = new Promise((c, p) => {
943
+ S = c;
944
+ }));
945
+ }
946
+ function $() {
947
+ return v === void 0 && (v = {
948
+ get name() {
949
+ return n;
950
+ },
951
+ get version() {
952
+ return i;
953
+ },
954
+ get i() {
955
+ return k();
956
+ },
957
+ v: (c) => V(c)
958
+ }), v;
959
+ }
960
+ function j() {
961
+ return u === void 0 && (u = {
962
+ get name() {
963
+ return n;
964
+ },
965
+ get version() {
966
+ return d ? i : void 0;
967
+ },
968
+ get i() {
969
+ return d ? k() : void 0;
970
+ },
971
+ v: (c) => d ? V(c) : void 0,
972
+ get promise() {
973
+ return i === 0 ? Promise.reject(e("Remote interface not provided")) : I().then(() => {
974
+ if (i === 0) throw new Error(e("Remote interface not provided"));
975
+ return $();
976
+ });
977
+ }
978
+ }), u;
979
+ }
980
+ function T() {
981
+ S != null && (S(), S = void 0);
982
+ }
983
+ return {
984
+ get name() {
985
+ return n;
986
+ },
987
+ get localVersion() {
988
+ if (r != null)
989
+ return r;
990
+ },
991
+ set localVersion(c) {
992
+ if (r != null && r !== c) throw new Error(e("A different local version is already set"));
993
+ r = c;
994
+ },
995
+ get localVersionSent() {
996
+ return s;
997
+ },
998
+ set localVersionSent(c) {
999
+ if (!c && s) throw new Error(e("Local version already notified"));
1000
+ s = c, c && r === 0 && (a = !0);
1001
+ },
1002
+ get localInterfaceSent() {
1003
+ return a;
1004
+ },
1005
+ set localInterfaceSent(c) {
1006
+ if (r == null) throw new Error(e("Local version not set"));
1007
+ if (!c && a) throw new Error(e("Local interface already sent."));
1008
+ a = c;
1009
+ },
1010
+ get remoteVersion() {
1011
+ if (i != null)
1012
+ return i;
1013
+ },
1014
+ set remoteVersion(c) {
1015
+ if (i != null && i !== c) throw new Error(e("A different remote version is already set for " + n + `(${i} -> ${c})`));
1016
+ i = c, c === 0 && (l = !0);
1017
+ },
1018
+ get remoteVersionReceived() {
1019
+ return i != null;
1020
+ },
1021
+ setRemoteInterface: (c) => {
1022
+ if (i == null) throw new Error(e("Remote version not set"));
1023
+ if (i === 0) {
1024
+ console.warn(e("Remote version is 0, remote interface is ignored."));
1025
+ return;
1026
+ }
1027
+ if (l) throw new Error(e("Interface already provided."));
1028
+ m = c, l = !0;
1029
+ },
1030
+ get remoteInterfaceReceived() {
1031
+ return l;
1032
+ },
1033
+ depGroup: void 0,
1034
+ get isActivable() {
1035
+ return l && a;
1036
+ },
1037
+ get isActivated() {
1038
+ return d;
1039
+ },
1040
+ activate() {
1041
+ if (!d) {
1042
+ if (!l) throw new Error(e("Remote interface not provided."));
1043
+ if (!a) throw new Error(e("Local interface not sent"));
1044
+ d = !0, T();
1045
+ }
1046
+ },
1047
+ getRemote: () => $(),
1048
+ getLazyRemote: () => j(),
1049
+ get activationPromise() {
1050
+ return I();
1051
+ }
1052
+ };
1053
+ };
1054
+ }
1055
+ function gn(e) {
1056
+ return function(n, r, s, a) {
1057
+ let i = s, m = !1, l = !1;
1058
+ function d() {
1059
+ return n.every((v) => v.remoteVersionReceived && v.localVersionSent) && r.every((v) => v.remoteVersionReceived);
1060
+ }
1061
+ return {
1062
+ get isDeclared() {
1063
+ return l;
1064
+ },
1065
+ set isDeclared(v) {
1066
+ if (!v && l)
1067
+ throw new Error(e("Factory already declared"));
1068
+ l = v;
1069
+ },
1070
+ get isReady() {
1071
+ return d();
1072
+ },
1073
+ get isDone() {
1074
+ return m;
1075
+ },
1076
+ get args() {
1077
+ return n;
1078
+ },
1079
+ get deps() {
1080
+ return r;
1081
+ },
1082
+ invoke() {
1083
+ if (m)
1084
+ throw new Error(e("Factory already invoked"));
1085
+ if (!d())
1086
+ throw new Error(e("Factory is not ready"));
1087
+ let v;
1088
+ a ? v = n.map((S) => S.getRemote()) : v = n[0].getRemote();
1089
+ let u;
1090
+ const y = r.length > 0 ? r.map((S) => S.getRemote()) : null;
1091
+ try {
1092
+ u = y == null ? i(v) : i(v, y);
1093
+ } catch (S) {
1094
+ throw new Error(e("error in factory:"), { cause: S });
1095
+ }
1096
+ if (a || (u = [u]), u.length != n.length)
1097
+ throw new Error(e("Invalid factory result"));
1098
+ return m = !0, i = null, u;
1099
+ }
1100
+ };
1101
+ };
1102
+ }
1103
+ function vn(e) {
1104
+ return function(n, r, s, a) {
1105
+ let i = r, m = !1;
1106
+ function l() {
1107
+ return n.every((d) => d.isActivated);
1108
+ }
1109
+ return {
1110
+ get isReady() {
1111
+ return l();
1112
+ },
1113
+ get isDone() {
1114
+ return m;
1115
+ },
1116
+ get args() {
1117
+ return n;
1118
+ },
1119
+ invoke() {
1120
+ if (m || !l()) {
1121
+ const u = new Error(e(m ? "callback already invoked" : "callback parameters are not ready"));
1122
+ throw a?.[1](u), u;
1123
+ }
1124
+ const d = s ? n.map((u) => u.getRemote()) : n[0].getRemote();
1125
+ let v;
1126
+ try {
1127
+ v = i(d);
1128
+ } catch (u) {
1129
+ a == null ? console.error(e("error in callback:"), u) : a[1](u);
1130
+ } finally {
1131
+ m = !0;
1132
+ }
1133
+ a?.[0](v);
1134
+ }
1135
+ };
1136
+ };
1137
+ }
1138
+ function Ct(e, n) {
1139
+ return e == null || e.length === 0 ? n : `[${e}] ${n}`;
1140
+ }
1141
+ function pn(e) {
1142
+ function n(c) {
1143
+ return Ct(e.name, c);
1144
+ }
1145
+ const r = vn(n), s = dn(n), a = gn(n), i = {}, m = [];
1146
+ let l = [], d;
1147
+ const v = () => (d == null ? d = 0 : d++, d);
1148
+ function u(c) {
1149
+ let p = i[c];
1150
+ return p == null && (p = s(c), p.localVersion == null && (I && (p.localVersion = 0), $ && (p.localVersionSent = !0)), p.remoteVersion == null && j && (p.remoteVersion = 0), i[c] = p), p;
1151
+ }
1152
+ function y(c) {
1153
+ return c.map(u);
1154
+ }
1155
+ function S(...c) {
1156
+ const p = v(), h = Array(p).fill(!1);
1157
+ c.forEach((E) => {
1158
+ E.forEach((F) => {
1159
+ F.depGroup != null && (h[F.depGroup] = !0), F.depGroup = p;
1160
+ });
1161
+ }), Object.values(i).forEach((E) => {
1162
+ E.depGroup != null && E.depGroup !== p && h[E.depGroup] && (E.depGroup = p);
1163
+ });
1164
+ }
1165
+ e.onDeclare = (c) => {
1166
+ const p = y(c.map((h) => h.name));
1167
+ for (let h = 0; h < c.length; h++)
1168
+ c[h].version != null && (p[h].remoteVersion = c[h].version);
1169
+ S(p), T();
1170
+ }, e.onDone = () => {
1171
+ j || (j = !0, Object.values(i).forEach((c) => {
1172
+ c.remoteVersion == null && (c.remoteVersion = 0);
1173
+ }), T());
1174
+ }, e.onProvide = (c, p, h) => {
1175
+ let E = i[c];
1176
+ if (E == null)
1177
+ throw new Error(n(`Contract not declared : ${c}`));
1178
+ if (E.remoteVersion != p)
1179
+ throw new Error(n(`Remote declared version ${E.remoteVersion} of contract "${c}" but provided version ${p}.`));
1180
+ if (E.remoteInterfaceReceived)
1181
+ throw new Error(n(`Remote contract "${c}" is already provided.`));
1182
+ E.setRemoteInterface(h), T();
1183
+ };
1184
+ let k = !1, V = !1, I = !1, $ = !1, j = !1;
1185
+ async function T() {
1186
+ if (V = !0, !k) {
1187
+ for (k = !0; V; ) {
1188
+ if (V = !1, e.isReady) {
1189
+ const c = m.filter((p) => !p.isDeclared);
1190
+ if (c.length > 0)
1191
+ for (const p of c) {
1192
+ const h = Array(p.args.length + p.deps.length);
1193
+ p.args.forEach((E, F) => h[F] = E), p.deps.forEach((E, F) => h[F + p.args.length] = E), await e.declare(h.map((E) => ({ name: E.name, version: E.localVersion }))), h.forEach((E) => {
1194
+ E.localVersion != null && (E.localVersionSent = !0);
1195
+ }), p.isDeclared = !0;
1196
+ }
1197
+ }
1198
+ if (e.isReady && I && m.every((c) => c.isDeclared)) {
1199
+ const c = Object.values(i).filter((p) => !p.localVersionSent && p.localVersion != null);
1200
+ if (c.length > 0)
1201
+ for (const p of c)
1202
+ await e.declare([{ name: p.name, version: p.localVersion }]), p.localVersionSent = !0;
1203
+ $ || ($ = !0, await e.done());
1204
+ }
1205
+ if (e.isReady) {
1206
+ const c = m.filter((p) => !p.isDone && p.isReady);
1207
+ if (c.length > 0)
1208
+ for (const p of c) {
1209
+ const h = p.invoke();
1210
+ for (let E = 0; E < p.args.length; E++) {
1211
+ const F = p.args[E];
1212
+ await e.provide(F.name, F.localVersion, h[E]), F.localInterfaceSent = !0;
1213
+ }
1214
+ }
1215
+ }
1216
+ if (d != null) {
1217
+ const c = Array(d + 1).fill(null);
1218
+ for (const p in i) {
1219
+ const h = i[p];
1220
+ h.depGroup != null && (h.isActivable ? c[h.depGroup] == null && !h.isActivated && (c[h.depGroup] = !0) : c[h.depGroup] = !1);
1221
+ }
1222
+ if (c.some((p) => p === !0))
1223
+ for (const p in i) {
1224
+ const h = i[p];
1225
+ h.depGroup != null && c[h.depGroup] && h.activate();
1226
+ }
1227
+ }
1228
+ if (e.isReady) {
1229
+ const c = l;
1230
+ l = [];
1231
+ const p = [];
1232
+ for (const h of c)
1233
+ !h.isDone && h.isReady ? h.invoke() : p.push(h);
1234
+ p.push(...l), l = p;
1235
+ }
1236
+ }
1237
+ k = !1;
1238
+ }
1239
+ }
1240
+ return {
1241
+ get(c) {
1242
+ return u(c);
1243
+ },
1244
+ declareFactory: (c, p, h, E) => {
1245
+ if (I) throw new Error(n("Cannot declare a factory after done has been set to true."));
1246
+ const F = y(c.map((M) => M.name));
1247
+ {
1248
+ const M = F.filter((Q) => Q.localVersion != null);
1249
+ if (M.length > 0)
1250
+ throw new Error(n("Cannot declare a factory for already implemented contracts : " + M.map((Q) => Q.name).join(", ")));
1251
+ }
1252
+ for (let M = 0; M < c.length; M++)
1253
+ F[M].localVersion = c[M].version;
1254
+ const G = y(p);
1255
+ S(F, G);
1256
+ const ne = a(F, G, h, E);
1257
+ m.push(ne), T();
1258
+ },
1259
+ declareCallback(c, p, h, E) {
1260
+ const F = y(c), G = r(F, p, h, E);
1261
+ !k && l.length === 0 && G.isReady ? G.invoke() : (l.push(G), T());
1262
+ },
1263
+ get done() {
1264
+ return I;
1265
+ },
1266
+ set done(c) {
1267
+ if (I) {
1268
+ if (!c) throw new Error(n("Cannot set done to false after it has been set to true."));
1269
+ } else
1270
+ c && (I = !0, Object.values(i).forEach((p) => {
1271
+ p.localVersion == null && (p.localVersion = 0);
1272
+ }), T());
1273
+ }
1274
+ };
1275
+ }
1276
+ const mn = /^\d+$/;
1277
+ function yn(e) {
1278
+ const [n, r, s] = e.split(":", 3);
1279
+ if (r == null || s != null || !mn.test(r)) return null;
1280
+ const a = parseInt(r);
1281
+ return isNaN(a) || a === 0 ? null : { name: n, version: a };
1282
+ }
1283
+ function Cn(e) {
1284
+ const n = pn(e);
1285
+ function r(s) {
1286
+ return Ct(e.name, s);
1287
+ }
1288
+ return {
1289
+ plug(s, a, i = void 0) {
1290
+ if (n.done) throw new Error(r("Cannot plug after plugsDone."));
1291
+ i == null && (i = a, a = []);
1292
+ let m = !0;
1293
+ Array.isArray(s) || (s = [s], m = !1);
1294
+ const l = s.map((d) => {
1295
+ const v = yn(d);
1296
+ if (v == null)
1297
+ throw new Error(r("Invalid contract id : " + d));
1298
+ return v;
1299
+ });
1300
+ n.declareFactory(l, a, i, m);
1301
+ },
1302
+ plugsDone() {
1303
+ n.done = !0;
1304
+ },
1305
+ use(s, a) {
1306
+ let i = !0;
1307
+ Array.isArray(s) || (s = [s], i = !1), n.declareCallback(s, a, i);
1308
+ },
1309
+ exec(s, a) {
1310
+ let i = !0;
1311
+ return Array.isArray(s) || (s = [s], i = !1), new Promise((...m) => {
1312
+ n.declareCallback(s, a, i, m);
1313
+ });
1314
+ },
1315
+ get(s) {
1316
+ return s.map((a) => n.get(a).getLazyRemote());
1317
+ }
1318
+ };
1319
+ }
1320
+ const St = "app-agent";
1321
+ let ke;
1322
+ function Sn(e) {
1323
+ return ke != null || (ke = Cn(fn(St, e))), ke;
1324
+ }
1325
+ console.log(`[${St}@1.0.12] loaded`);
1326
+ const it = (e) => {
1327
+ let n;
1328
+ const r = /* @__PURE__ */ new Set(), s = (v, u) => {
1329
+ const y = typeof v == "function" ? v(n) : v;
1330
+ if (!Object.is(y, n)) {
1331
+ const S = n;
1332
+ n = u ?? (typeof y != "object" || y === null) ? y : Object.assign({}, n, y), r.forEach((k) => k(n, S));
1333
+ }
1334
+ }, a = () => n, l = { setState: s, getState: a, getInitialState: () => d, subscribe: (v) => (r.add(v), () => r.delete(v)) }, d = n = e(s, a, l);
1335
+ return l;
1336
+ }, hn = (e) => e ? it(e) : it, wn = (e) => e;
1337
+ function bn(e, n = wn) {
1338
+ const r = H.useSyncExternalStore(
1339
+ e.subscribe,
1340
+ H.useCallback(() => n(e.getState()), [e, n]),
1341
+ H.useCallback(() => n(e.getInitialState()), [e, n])
20
1342
  );
21
- return v.useDebugValue(o), o;
22
- }
23
- const x = (t) => {
24
- const e = L(t), o = (s) => q(e, s);
25
- return Object.assign(o, e), o;
26
- }, E = (t) => t ? x(t) : x, B = (t) => (e, o, s) => {
27
- const i = s.subscribe;
28
- return s.subscribe = (u, a, r) => {
29
- let C = u;
30
- if (a) {
31
- const p = r?.equalityFn || Object.is;
32
- let d = u(s.getState());
33
- C = (J) => {
34
- const m = u(J);
35
- if (!p(d, m)) {
36
- const G = d;
37
- a(d = m, G);
1343
+ return H.useDebugValue(r), r;
1344
+ }
1345
+ const st = (e) => {
1346
+ const n = hn(e), r = (s) => bn(n, s);
1347
+ return Object.assign(r, n), r;
1348
+ }, ht = (e) => e ? st(e) : st, En = (e) => (n, r, s) => {
1349
+ const a = s.subscribe;
1350
+ return s.subscribe = (m, l, d) => {
1351
+ let v = m;
1352
+ if (l) {
1353
+ const u = d?.equalityFn || Object.is;
1354
+ let y = m(s.getState());
1355
+ v = (S) => {
1356
+ const k = m(S);
1357
+ if (!u(y, k)) {
1358
+ const V = y;
1359
+ l(y = k, V);
38
1360
  }
39
- }, r?.fireImmediately && a(d, d);
1361
+ }, d?.fireImmediately && l(y, y);
40
1362
  }
41
- return i(C);
42
- }, t(e, o, s);
43
- }, P = B, n = E()(
44
- P((t) => ({
1363
+ return a(v);
1364
+ }, e(n, r, s);
1365
+ }, An = En, f = ht()(
1366
+ An((e) => ({
45
1367
  ready: !1,
46
1368
  workflow: "current",
47
1369
  mode: "assignment",
@@ -76,41 +1398,41 @@ const x = (t) => {
76
1398
  sidebarActions: {},
77
1399
  quickActions: {},
78
1400
  activitySettingsCallback: null,
79
- setGetTextContentFunction: (e) => {
80
- t({ getTextContentFunction: e });
1401
+ setGetTextContentFunction: (n) => {
1402
+ e({ getTextContentFunction: n });
81
1403
  },
82
- setGetJsonContentFunction: (e) => {
83
- t({ getJsonContentFunction: e });
1404
+ setGetJsonContentFunction: (n) => {
1405
+ e({ getJsonContentFunction: n });
84
1406
  },
85
- setGetJsonActivityContentFunction: (e) => {
86
- t({ getJsonActivityContentFunction: e });
1407
+ setGetJsonActivityContentFunction: (n) => {
1408
+ e({ getJsonActivityContentFunction: n });
87
1409
  },
88
- setGetJsonAssignmentContentFunction: (e) => {
89
- t({ getJsonAssignmentContentFunction: e });
1410
+ setGetJsonAssignmentContentFunction: (n) => {
1411
+ e({ getJsonAssignmentContentFunction: n });
90
1412
  },
91
- setGetJsonActivitySplitContentFunction: (e) => {
92
- t({ getJsonActivitySplitContentFunction: e });
1413
+ setGetJsonActivitySplitContentFunction: (n) => {
1414
+ e({ getJsonActivitySplitContentFunction: n });
93
1415
  },
94
- setGetJsonAssignmentSplitContentFunction: (e) => {
95
- t({ getJsonAssignmentSplitContentFunction: e });
1416
+ setGetJsonAssignmentSplitContentFunction: (n) => {
1417
+ e({ getJsonAssignmentSplitContentFunction: n });
96
1418
  },
97
- setSidebarActions: (e) => {
98
- t({ sidebarActions: e });
1419
+ setSidebarActions: (n) => {
1420
+ e({ sidebarActions: n });
99
1421
  },
100
- setQuickActions: (e) => {
101
- t({ quickActions: e });
1422
+ setQuickActions: (n) => {
1423
+ e({ quickActions: n });
102
1424
  },
103
- setActivitySettingsCallback: (e) => {
104
- t({ activitySettingsCallback: e });
1425
+ setActivitySettingsCallback: (n) => {
1426
+ e({ activitySettingsCallback: n });
105
1427
  },
106
- incSaveCount: () => t((e) => ({
107
- saveCount: e.saveCount + 1
1428
+ incSaveCount: () => e((n) => ({
1429
+ saveCount: n.saveCount + 1
108
1430
  })),
109
- incDirtyCount: () => t((e) => ({ isDirtyCount: e.isDirtyCount + 1 }))
1431
+ incDirtyCount: () => e((n) => ({ isDirtyCount: n.isDirtyCount + 1 }))
110
1432
  }))
111
1433
  );
112
- let T = !1;
113
- const R = [
1434
+ let ct = !1;
1435
+ const Rn = [
114
1436
  "meta-player-events:1",
115
1437
  "meta-player-ui:1",
116
1438
  "mode:1",
@@ -124,77 +1446,77 @@ const R = [
124
1446
  "simple-content-eval(json):1",
125
1447
  "separate-contents(json):1",
126
1448
  "separate-dual-contents(json):1"
127
- ], D = {
1449
+ ], lt = {
128
1450
  "mode:1": {
129
- setMode: (t) => {
130
- n.setState({ mode: t });
1451
+ setMode: (e) => {
1452
+ f.setState({ mode: e });
131
1453
  }
132
1454
  },
133
1455
  "reload:1": {
134
- reloaded: (t) => {
135
- console.log("Reloaded with state:", t), console.error("Not implemented yet");
1456
+ reloaded: (e) => {
1457
+ console.log("Reloaded with state:", e), console.error("Not implemented yet");
136
1458
  }
137
1459
  },
138
1460
  "theme:1": {
139
- setTheme: (t) => {
140
- if (t === null) {
141
- n.setState({ theme: null });
1461
+ setTheme: (e) => {
1462
+ if (e === null) {
1463
+ f.setState({ theme: null });
142
1464
  return;
143
1465
  }
144
- if (t !== "light" && t !== "dark") {
145
- console.warn(`Invalid theme: ${t}. Expected 'light' or 'dark'.`), n.setState({ theme: null });
1466
+ if (e !== "light" && e !== "dark") {
1467
+ console.warn(`Invalid theme: ${e}. Expected 'light' or 'dark'.`), f.setState({ theme: null });
146
1468
  return;
147
1469
  }
148
- n.setState({ theme: t });
1470
+ f.setState({ theme: e });
149
1471
  }
150
1472
  },
151
1473
  "workflow:1": {
152
- setWorkflow: (t) => {
153
- n.setState({ workflow: t });
1474
+ setWorkflow: (e) => {
1475
+ f.setState({ workflow: e });
154
1476
  }
155
1477
  },
156
1478
  "simple-content(text):1": {
157
1479
  contentSaved: () => {
158
- n.setState((t) => ({
159
- afterSaveCount: t.afterSaveCount + 1
1480
+ f.setState((e) => ({
1481
+ afterSaveCount: e.afterSaveCount + 1
160
1482
  }));
161
1483
  },
162
- getContent: () => n.getState().getTextContentFunction(),
163
- loadContent: (t) => {
164
- n.setState({ loadedTextContent: t });
1484
+ getContent: () => f.getState().getTextContentFunction(),
1485
+ loadContent: (e) => {
1486
+ f.setState({ loadedTextContent: e });
165
1487
  }
166
1488
  },
167
1489
  "simple-content(json):1": {
168
1490
  contentSaved: () => {
169
- n.setState((t) => ({
170
- afterSaveCount: t.afterSaveCount + 1
1491
+ f.setState((e) => ({
1492
+ afterSaveCount: e.afterSaveCount + 1
171
1493
  }));
172
1494
  },
173
- getContent: () => n.getState().getJsonContentFunction(),
174
- loadContent: (t) => {
175
- n.setState({ loadedJsonContent: t });
1495
+ getContent: () => f.getState().getJsonContentFunction(),
1496
+ loadContent: (e) => {
1497
+ f.setState({ loadedJsonContent: e });
176
1498
  }
177
1499
  },
178
1500
  "simple-binary-data(text):1": {
179
1501
  contentSaved: () => {
180
- n.setState((t) => ({
181
- afterSaveCount: t.afterSaveCount + 1
1502
+ f.setState((e) => ({
1503
+ afterSaveCount: e.afterSaveCount + 1
182
1504
  }));
183
1505
  },
184
- getContent: () => n.getState().getTextContentFunction(),
185
- loadContent: (t) => {
186
- n.setState({ loadedTextContent: t });
1506
+ getContent: () => f.getState().getTextContentFunction(),
1507
+ loadContent: (e) => {
1508
+ f.setState({ loadedTextContent: e });
187
1509
  }
188
1510
  },
189
1511
  "simple-content-eval(text):1": {
190
1512
  contentSaved: () => {
191
- n.setState((t) => ({
192
- afterSaveCount: t.afterSaveCount + 1
1513
+ f.setState((e) => ({
1514
+ afterSaveCount: e.afterSaveCount + 1
193
1515
  }));
194
1516
  },
195
- getContent: () => n.getState().getTextContentFunction(),
196
- loadContent: (t) => {
197
- n.setState({ loadedTextContent: t });
1517
+ getContent: () => f.getState().getTextContentFunction(),
1518
+ loadContent: (e) => {
1519
+ f.setState({ loadedTextContent: e });
198
1520
  },
199
1521
  getAssignmentContent: () => {
200
1522
  throw new Error(
@@ -204,13 +1526,13 @@ const R = [
204
1526
  },
205
1527
  "simple-content-eval(json):1": {
206
1528
  contentSaved: () => {
207
- n.setState((t) => ({
208
- afterSaveCount: t.afterSaveCount + 1
1529
+ f.setState((e) => ({
1530
+ afterSaveCount: e.afterSaveCount + 1
209
1531
  }));
210
1532
  },
211
- getContent: () => n.getState().getJsonContentFunction(),
212
- loadContent: (t) => {
213
- n.setState({ loadedJsonContent: t });
1533
+ getContent: () => f.getState().getJsonContentFunction(),
1534
+ loadContent: (e) => {
1535
+ f.setState({ loadedJsonContent: e });
214
1536
  },
215
1537
  getAssignmentContent: () => {
216
1538
  throw new Error(
@@ -220,13 +1542,13 @@ const R = [
220
1542
  },
221
1543
  "simple-content-eval(json):2": {
222
1544
  contentSaved: () => {
223
- n.setState((t) => ({
224
- afterSaveCount: t.afterSaveCount + 1
1545
+ f.setState((e) => ({
1546
+ afterSaveCount: e.afterSaveCount + 1
225
1547
  }));
226
1548
  },
227
- getContent: () => n.getState().getJsonContentFunction(),
228
- loadContent: (t) => {
229
- n.setState({ loadedJsonContent: t });
1549
+ getContent: () => f.getState().getJsonContentFunction(),
1550
+ loadContent: (e) => {
1551
+ f.setState({ loadedJsonContent: e });
230
1552
  },
231
1553
  getAssignmentContent: () => {
232
1554
  throw new Error(
@@ -236,13 +1558,13 @@ const R = [
236
1558
  },
237
1559
  "simple-content-eval(text):2": {
238
1560
  contentSaved: () => {
239
- n.setState((t) => ({
240
- afterSaveCount: t.afterSaveCount + 1
1561
+ f.setState((e) => ({
1562
+ afterSaveCount: e.afterSaveCount + 1
241
1563
  }));
242
1564
  },
243
- getContent: () => n.getState().getTextContentFunction(),
244
- loadContent: (t) => {
245
- n.setState({ loadedTextContent: t });
1565
+ getContent: () => f.getState().getTextContentFunction(),
1566
+ loadContent: (e) => {
1567
+ f.setState({ loadedTextContent: e });
246
1568
  },
247
1569
  getAssignmentContent: () => {
248
1570
  throw new Error(
@@ -252,40 +1574,40 @@ const R = [
252
1574
  },
253
1575
  "separate-contents(json):1": {
254
1576
  contentSaved: () => {
255
- n.setState((t) => ({
256
- afterSaveCount: t.afterSaveCount + 1
1577
+ f.setState((e) => ({
1578
+ afterSaveCount: e.afterSaveCount + 1
257
1579
  }));
258
1580
  },
259
- loadContent: (t, e) => {
260
- n.setState({
261
- loadedJsonActivityContent: t,
262
- loadedJsonAssignmentContent: e
1581
+ loadContent: (e, n) => {
1582
+ f.setState({
1583
+ loadedJsonActivityContent: e,
1584
+ loadedJsonAssignmentContent: n
263
1585
  });
264
1586
  },
265
- getActivityContent: () => n.getState().getJsonActivityContentFunction(),
266
- getAssignmentContent: () => n.getState().getJsonAssignmentContentFunction()
1587
+ getActivityContent: () => f.getState().getJsonActivityContentFunction(),
1588
+ getAssignmentContent: () => f.getState().getJsonAssignmentContentFunction()
267
1589
  },
268
1590
  "separate-dual-contents(json):1": {
269
1591
  contentSaved: () => {
270
- n.setState((t) => ({
271
- afterSaveCount: t.afterSaveCount + 1
1592
+ f.setState((e) => ({
1593
+ afterSaveCount: e.afterSaveCount + 1
272
1594
  }));
273
1595
  },
274
1596
  loadContent: ({
275
- activityContent: t,
276
- assignmentContent: e,
277
- activityBinaryData: o,
1597
+ activityContent: e,
1598
+ assignmentContent: n,
1599
+ activityBinaryData: r,
278
1600
  assignmentBinaryData: s
279
1601
  }) => {
280
- n.setState({
281
- loadedJsonActivityContent: t,
282
- loadedJsonAssignmentContent: e,
283
- loadedJsonActivityBinaryData: o,
1602
+ f.setState({
1603
+ loadedJsonActivityContent: e,
1604
+ loadedJsonAssignmentContent: n,
1605
+ loadedJsonActivityBinaryData: r,
284
1606
  loadedJsonAssignmentBinaryData: s
285
1607
  });
286
1608
  },
287
- getActivityContentAndData: () => n.getState().getJsonActivitySplitContentFunction(),
288
- getAssignmentContentAndData: () => n.getState().getJsonAssignmentSplitContentFunction()
1609
+ getActivityContentAndData: () => f.getState().getJsonActivitySplitContentFunction(),
1610
+ getAssignmentContentAndData: () => f.getState().getJsonAssignmentSplitContentFunction()
289
1611
  },
290
1612
  "meta-player-anti-cheat:1": {
291
1613
  lock: () => {
@@ -294,62 +1616,62 @@ const R = [
294
1616
  }
295
1617
  },
296
1618
  "meta-player-ui:1": {
297
- executeAction(t) {
298
- if (t.startsWith("qa")) {
299
- const o = n.getState().quickActions[t];
300
- o ? o() : console.error(`Quick action not found: ${t}`);
1619
+ executeAction(e) {
1620
+ if (e.startsWith("qa")) {
1621
+ const r = f.getState().quickActions[e];
1622
+ r ? r() : console.error(`Quick action not found: ${e}`);
301
1623
  } else {
302
- const o = n.getState().sidebarActions[t];
303
- o ? o() : console.error(`Sidebar action not found: ${t}`);
1624
+ const r = f.getState().sidebarActions[e];
1625
+ r ? r() : console.error(`Sidebar action not found: ${e}`);
304
1626
  }
305
1627
  },
306
- executeFileUpload(t, e) {
307
- if (t.startsWith("qa")) {
308
- const s = n.getState().quickActions[t];
309
- s ? s(e) : console.error(`Quick action not found: ${t}`);
1628
+ executeFileUpload(e, n) {
1629
+ if (e.startsWith("qa")) {
1630
+ const s = f.getState().quickActions[e];
1631
+ s ? s(n) : console.error(`Quick action not found: ${e}`);
310
1632
  } else {
311
- const s = n.getState().sidebarActions[t];
312
- s ? s(e) : console.error(`Sidebar action not found: ${t}`);
1633
+ const s = f.getState().sidebarActions[e];
1634
+ s ? s(n) : console.error(`Sidebar action not found: ${e}`);
313
1635
  }
314
1636
  },
315
- updateSettings(t) {
316
- const e = n.getState().activitySettingsCallback;
317
- e ? e(t) : console.warn(
1637
+ updateSettings(e) {
1638
+ const n = f.getState().activitySettingsCallback;
1639
+ n ? n(e) : console.warn(
318
1640
  "activitySettingsCallback is not set. Changes:",
319
- t
1641
+ e
320
1642
  );
321
1643
  }
322
1644
  },
323
1645
  "meta-player-events:1": {
324
- handleEvent(t) {
325
- t === "all-loaded" && n.setState({ ready: !0 });
1646
+ handleEvent(e) {
1647
+ e === "all-loaded" && f.setState({ ready: !0 });
326
1648
  }
327
1649
  }
328
- }, g = I();
329
- function O(t) {
330
- if (T) {
1650
+ }, L = Sn();
1651
+ function kn(e) {
1652
+ if (ct) {
331
1653
  console.warn("Contracts have already been plugged. Skipping.");
332
1654
  return;
333
1655
  }
334
- T = !0;
335
- for (const e of t) {
336
- if (!R.includes(e)) {
1656
+ ct = !0;
1657
+ for (const n of e) {
1658
+ if (!Rn.includes(n)) {
337
1659
  console.warn(
338
- `Contract ${e} is not implemented in Capytale. Skipping plug.`
1660
+ `Contract ${n} is not implemented in Capytale. Skipping plug.`
339
1661
  );
340
1662
  continue;
341
1663
  }
342
- if (!(e in D)) {
1664
+ if (!(n in lt)) {
343
1665
  console.warn(
344
- `Contract handler for ${e} is not defined. Skipping plug.`
1666
+ `Contract handler for ${n} is not defined. Skipping plug.`
345
1667
  );
346
1668
  continue;
347
1669
  }
348
- const o = D[e];
349
- g.plug([e], ([]) => [o]);
1670
+ const r = lt[n];
1671
+ L.plug([n], ([]) => [r]);
350
1672
  }
351
- g.plugsDone();
352
- for (const e of [
1673
+ L.plugsDone();
1674
+ for (const n of [
353
1675
  "simple-content(text):1",
354
1676
  "simple-content(json):1",
355
1677
  "simple-binary-data(text):1",
@@ -358,329 +1680,329 @@ function O(t) {
358
1680
  "simple-content-eval(json):2",
359
1681
  "simple-content-eval(text):2"
360
1682
  ])
361
- if (console.log(`Contract ${e} is being subscribed to content changes.`), t.includes(e)) {
362
- console.log(`Subscribing to content changes for contract ${e}`);
363
- const o = e.split(":")[0];
364
- g.use([o], ([s]) => {
365
- n.subscribe(
366
- (i) => i.isDirtyCount,
1683
+ if (console.log(`Contract ${n} is being subscribed to content changes.`), e.includes(n)) {
1684
+ console.log(`Subscribing to content changes for contract ${n}`);
1685
+ const r = n.split(":")[0];
1686
+ L.use([r], ([s]) => {
1687
+ f.subscribe(
1688
+ (a) => a.isDirtyCount,
367
1689
  () => {
368
1690
  s.i?.contentChanged(), console.log(
369
- `Content changed for contract ${o}`
1691
+ `Content changed for contract ${r}`
370
1692
  );
371
1693
  }
372
1694
  );
373
1695
  });
374
1696
  }
375
1697
  }
376
- const tt = () => n((t) => {
377
- if (t.mode === null)
1698
+ const In = () => f((e) => {
1699
+ if (e.mode === null)
378
1700
  throw new Error("Mode is not set. Have you used contract 'mode'?");
379
- return t.mode;
380
- }), et = () => n((t) => {
381
- if (t.workflow === null)
1701
+ return e.mode;
1702
+ }), Mn = () => f((e) => {
1703
+ if (e.workflow === null)
382
1704
  throw new Error(
383
1705
  "Workflow is not set. Have you used contract 'workflow'?"
384
1706
  );
385
- return t.workflow;
386
- }), nt = () => n((t) => {
387
- if (t.theme === null)
1707
+ return e.workflow;
1708
+ }), Ln = () => f((e) => {
1709
+ if (e.theme === null)
388
1710
  throw new Error("Theme is not set. Have you used contract 'theme'?");
389
- return t.theme;
390
- }), ot = () => n((t) => t.incSaveCount), st = () => n((t) => t.incDirtyCount), it = () => n((t) => t.loadedTextContent), at = () => n((t) => t.loadedJsonContent), ct = () => n((t) => t.loadedJsonActivityContent), rt = () => n((t) => t.loadedJsonAssignmentContent), lt = () => n((t) => t.loadedJsonActivityBinaryData), ut = () => n((t) => t.loadedJsonAssignmentBinaryData), dt = () => S(() => n.getState().loadedTextContent, []), gt = () => S(() => n.getState().loadedJsonContent, []), Ct = () => S(() => n.getState().loadedJsonActivityContent, []), St = () => S(() => n.getState().loadedJsonAssignmentContent, []), pt = () => S(
1711
+ return e.theme;
1712
+ }), $n = () => f((e) => e.incSaveCount), Gn = () => f((e) => e.incDirtyCount), Wn = () => f((e) => e.loadedTextContent), Nn = () => f((e) => e.loadedJsonContent), qn = () => f((e) => e.loadedJsonActivityContent), Un = () => f((e) => e.loadedJsonAssignmentContent), Bn = () => f((e) => e.loadedJsonActivityBinaryData), Yn = () => f((e) => e.loadedJsonAssignmentBinaryData), zn = () => K(() => f.getState().loadedTextContent, []), Hn = () => K(() => f.getState().loadedJsonContent, []), Kn = () => K(() => f.getState().loadedJsonActivityContent, []), Qn = () => K(() => f.getState().loadedJsonAssignmentContent, []), Xn = () => K(
391
1713
  () => ({
392
- content: n.getState().loadedJsonActivityContent,
393
- binaryData: n.getState().loadedJsonActivityBinaryData
1714
+ content: f.getState().loadedJsonActivityContent,
1715
+ binaryData: f.getState().loadedJsonActivityBinaryData
394
1716
  }),
395
1717
  []
396
- ), mt = () => S(
1718
+ ), Zn = () => K(
397
1719
  () => ({
398
- content: n.getState().loadedJsonAssignmentContent,
399
- binaryData: n.getState().loadedJsonAssignmentBinaryData
1720
+ content: f.getState().loadedJsonAssignmentContent,
1721
+ binaryData: f.getState().loadedJsonAssignmentBinaryData
400
1722
  }),
401
1723
  []
402
- ), vt = (t) => {
403
- const e = n(
404
- (o) => o.setGetTextContentFunction
1724
+ ), er = (e) => {
1725
+ const n = f(
1726
+ (r) => r.setGetTextContentFunction
405
1727
  );
406
- l(() => {
407
- e(t);
408
- }, [t, e]);
409
- }, yt = (t) => {
410
- const e = n(
411
- (o) => o.setGetJsonContentFunction
1728
+ J(() => {
1729
+ n(e);
1730
+ }, [e, n]);
1731
+ }, tr = (e) => {
1732
+ const n = f(
1733
+ (r) => r.setGetJsonContentFunction
412
1734
  );
413
- l(() => {
414
- e(t);
415
- }, [t, e]);
416
- }, ft = (t) => {
417
- const e = n(
418
- (o) => o.setGetJsonActivityContentFunction
1735
+ J(() => {
1736
+ n(e);
1737
+ }, [e, n]);
1738
+ }, nr = (e) => {
1739
+ const n = f(
1740
+ (r) => r.setGetJsonActivityContentFunction
419
1741
  );
420
- l(() => {
421
- e(t);
422
- }, [t, e]);
423
- }, At = (t) => {
424
- const e = n(
425
- (o) => o.setGetJsonAssignmentContentFunction
1742
+ J(() => {
1743
+ n(e);
1744
+ }, [e, n]);
1745
+ }, rr = (e) => {
1746
+ const n = f(
1747
+ (r) => r.setGetJsonAssignmentContentFunction
426
1748
  );
427
- l(() => {
428
- e(t);
429
- }, [t, e]);
430
- }, Jt = (t) => {
431
- const e = n(
432
- (o) => o.setGetJsonActivitySplitContentFunction
1749
+ J(() => {
1750
+ n(e);
1751
+ }, [e, n]);
1752
+ }, or = (e) => {
1753
+ const n = f(
1754
+ (r) => r.setGetJsonActivitySplitContentFunction
433
1755
  );
434
- l(() => {
435
- e(t);
436
- }, [t, e]);
437
- }, Ft = (t) => {
438
- const e = n(
439
- (o) => o.setGetJsonAssignmentSplitContentFunction
1756
+ J(() => {
1757
+ n(e);
1758
+ }, [e, n]);
1759
+ }, ar = (e) => {
1760
+ const n = f(
1761
+ (r) => r.setGetJsonAssignmentSplitContentFunction
440
1762
  );
441
- l(() => {
442
- e(t);
443
- }, [t, e]);
444
- }, bt = (t) => {
445
- const e = n((o) => o.afterSaveCount);
446
- l(() => {
447
- e > 0 && t();
448
- }, [e]);
449
- }, wt = () => (t, e) => {
450
- g.use(["meta-player-ui"], ([o]) => {
451
- if (o.version === 0) {
1763
+ J(() => {
1764
+ n(e);
1765
+ }, [e, n]);
1766
+ }, ir = (e) => {
1767
+ const n = f((r) => r.afterSaveCount);
1768
+ J(() => {
1769
+ n > 0 && e();
1770
+ }, [n]);
1771
+ }, sr = () => (e, n) => {
1772
+ L.use(["meta-player-ui"], ([r]) => {
1773
+ if (r.version === 0) {
452
1774
  console.error(
453
1775
  "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
454
1776
  );
455
1777
  return;
456
1778
  }
457
- o.i?.previewTextFile(t, e);
1779
+ r.i?.previewTextFile(e, n);
458
1780
  });
459
- }, ht = () => (t, e) => {
460
- g.use(["meta-player-ui"], ([o]) => {
461
- if (o.version === 0) {
1781
+ }, cr = () => (e, n) => {
1782
+ L.use(["meta-player-ui"], ([r]) => {
1783
+ if (r.version === 0) {
462
1784
  console.error(
463
1785
  "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
464
1786
  );
465
1787
  return;
466
1788
  }
467
- o.i?.previewImageFile(t, e);
1789
+ r.i?.previewImageFile(e, n);
468
1790
  });
469
1791
  };
470
- let y = 0, F = 0;
471
- const kt = (t, e) => {
472
- const o = w(t, e), s = n((i) => i.setSidebarActions);
473
- l(() => (y++, y > 1 && console.error(
1792
+ let ue = 0, Te = 0;
1793
+ const lr = (e, n) => {
1794
+ const r = _e(e, n), s = f((a) => a.setSidebarActions);
1795
+ J(() => (ue++, ue > 1 && console.error(
474
1796
  "Capytale iframe React: Multiple sidebar actions registered: ",
475
- y
1797
+ ue
476
1798
  ), () => {
477
- y--;
478
- }), []), l(() => (g.use(["meta-player-ui"], ([i]) => {
479
- if (i.version === 0) {
1799
+ ue--;
1800
+ }), []), J(() => (L.use(["meta-player-ui"], ([a]) => {
1801
+ if (a.version === 0) {
480
1802
  console.error(
481
1803
  "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
482
1804
  );
483
1805
  return;
484
1806
  }
485
- F++;
486
- const c = o.map((a, r) => ({
487
- type: a.type,
488
- title: a.title,
489
- icon: a.icon,
490
- id: `sa-${F}-${r}`,
491
- ...a.type === "file-upload" ? { accept: a.accept } : {}
492
- })), u = {};
493
- o.forEach((a, r) => {
494
- u[`sa-${F}-${r}`] = a.action;
495
- }), i.i?.setSidebarActionButtons(c), s(u);
1807
+ Te++;
1808
+ const i = r.map((l, d) => ({
1809
+ type: l.type,
1810
+ title: l.title,
1811
+ icon: l.icon,
1812
+ id: `sa-${Te}-${d}`,
1813
+ ...l.type === "file-upload" ? { accept: l.accept } : {}
1814
+ })), m = {};
1815
+ r.forEach((l, d) => {
1816
+ m[`sa-${Te}-${d}`] = l.action;
1817
+ }), a.i?.setSidebarActionButtons(i), s(m);
496
1818
  }), () => {
497
- s({}), g.use(["meta-player-ui"], ([i]) => {
498
- if (i.version === 0) {
1819
+ s({}), L.use(["meta-player-ui"], ([a]) => {
1820
+ if (a.version === 0) {
499
1821
  console.error(
500
1822
  "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
501
1823
  );
502
1824
  return;
503
1825
  }
504
- i.i?.setSidebarActionButtons([]);
1826
+ a.i?.setSidebarActionButtons([]);
505
1827
  });
506
- }), [o]);
1828
+ }), [r]);
507
1829
  };
508
- let f = 0, b = 0;
509
- const xt = (t, e) => {
510
- const o = w(t, e), s = n((i) => i.setQuickActions);
511
- l(() => (f++, f > 1 && console.error(
1830
+ let fe = 0, xe = 0;
1831
+ const ur = (e, n) => {
1832
+ const r = _e(e, n), s = f((a) => a.setQuickActions);
1833
+ J(() => (fe++, fe > 1 && console.error(
512
1834
  "Capytale iframe React: Multiple quick actions registered: ",
513
- f
1835
+ fe
514
1836
  ), () => {
515
- f--;
516
- }), []), l(() => (g.use(["meta-player-ui"], ([i]) => {
517
- if (i.version === 0) {
1837
+ fe--;
1838
+ }), []), J(() => (L.use(["meta-player-ui"], ([a]) => {
1839
+ if (a.version === 0) {
518
1840
  console.error(
519
1841
  "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
520
1842
  );
521
1843
  return;
522
1844
  }
523
- b++;
524
- const c = o.map((a, r) => ({
525
- type: a.type,
526
- title: a.title,
527
- icon: a.icon,
528
- id: `qa-${b}-${r}`,
529
- ...a.type === "file-upload" ? { accept: a.accept } : {}
530
- })), u = {};
531
- o.forEach((a, r) => {
532
- u[`qa-${b}-${r}`] = a.action;
533
- }), i.i?.setQuickActionButtons(c), s(u);
1845
+ xe++;
1846
+ const i = r.map((l, d) => ({
1847
+ type: l.type,
1848
+ title: l.title,
1849
+ icon: l.icon,
1850
+ id: `qa-${xe}-${d}`,
1851
+ ...l.type === "file-upload" ? { accept: l.accept } : {}
1852
+ })), m = {};
1853
+ r.forEach((l, d) => {
1854
+ m[`qa-${xe}-${d}`] = l.action;
1855
+ }), a.i?.setQuickActionButtons(i), s(m);
534
1856
  }), () => {
535
- s({}), g.use(["meta-player-ui"], ([i]) => {
536
- if (i.version === 0) {
1857
+ s({}), L.use(["meta-player-ui"], ([a]) => {
1858
+ if (a.version === 0) {
537
1859
  console.error(
538
1860
  "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
539
1861
  );
540
1862
  return;
541
1863
  }
542
- i.i?.setQuickActionButtons([]);
1864
+ a.i?.setQuickActionButtons([]);
543
1865
  });
544
- }), [o]);
1866
+ }), [r]);
545
1867
  };
546
- let A = 0;
547
- const V = (t, e, o) => {
548
- const s = w(t, o), i = n(
549
- (c) => c.setActivitySettingsCallback
1868
+ let de = 0;
1869
+ const Tn = (e, n, r) => {
1870
+ const s = _e(e, r), a = f(
1871
+ (i) => i.setActivitySettingsCallback
550
1872
  );
551
- l(() => (console.log("Mounting useSettings"), A++, A > 1 && console.error(
1873
+ J(() => (console.log("Mounting useSettings"), de++, de > 1 && console.error(
552
1874
  "Capytale iframe React: Multiple settings registered: ",
553
- A
1875
+ de
554
1876
  ), () => {
555
- console.log("Unmounting useSettings"), A--;
556
- }), []), l(() => (g.use(["meta-player-ui"], ([c]) => {
557
- if (c.version === 0) {
1877
+ console.log("Unmounting useSettings"), de--;
1878
+ }), []), J(() => (L.use(["meta-player-ui"], ([i]) => {
1879
+ if (i.version === 0) {
558
1880
  console.error(
559
1881
  "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
560
1882
  );
561
1883
  return;
562
1884
  }
563
- console.log("Updating settings UI in MetaPlayer", s), c.i?.setSettingsUI(s);
564
- }), i(
565
- e
1885
+ console.log("Updating settings UI in MetaPlayer", s), i.i?.setSettingsUI(s);
1886
+ }), a(
1887
+ n
566
1888
  ), () => {
567
- i(null);
1889
+ a(null);
568
1890
  }), [s]);
569
- }, Tt = () => (e) => {
570
- g.use(["meta-player-ui"], ([o]) => {
571
- if (o.version === 0) {
1891
+ }, fr = () => (n) => {
1892
+ L.use(["meta-player-ui"], ([r]) => {
1893
+ if (r.version === 0) {
572
1894
  console.error(
573
1895
  "Le MétaPlayer ne supporte pas le contrat meta-player-ui"
574
1896
  );
575
1897
  return;
576
1898
  }
577
- o.i?.showToast(e);
1899
+ r.i?.showToast(n);
578
1900
  });
579
1901
  };
580
- function W(t) {
581
- const e = {};
582
- for (const o of t.fields)
583
- e[o.name] = o.defaultValue;
584
- return e;
1902
+ function xn(e) {
1903
+ const n = {};
1904
+ for (const r of e.fields)
1905
+ n[r.name] = r.defaultValue;
1906
+ return n;
585
1907
  }
586
- function Q(t) {
587
- return { [t.name]: t.defaultValues };
1908
+ function Fn(e) {
1909
+ return { [e.name]: e.defaultValues };
588
1910
  }
589
- function U(t) {
590
- return { [t.name]: t.defaultValue };
1911
+ function _n(e) {
1912
+ return { [e.name]: e.defaultValue };
591
1913
  }
592
- function H(t) {
593
- switch (t.type) {
1914
+ function Pn(e) {
1915
+ switch (e.type) {
594
1916
  case "form":
595
- return W(t);
1917
+ return xn(e);
596
1918
  case "checkboxes":
597
1919
  case "switches":
598
- return Q(t);
1920
+ return Fn(e);
599
1921
  case "radio":
600
- return U(t);
1922
+ return _n(e);
601
1923
  default:
602
1924
  return {};
603
1925
  }
604
1926
  }
605
- function N(t) {
606
- const e = {};
607
- for (const o of t)
608
- Object.assign(e, H(o));
609
- return e;
1927
+ function On(e) {
1928
+ const n = {};
1929
+ for (const r of e)
1930
+ Object.assign(n, Pn(r));
1931
+ return n;
610
1932
  }
611
- function Dt(t) {
612
- const o = E()((s) => ({
613
- ...N(t)
1933
+ function dr(e) {
1934
+ const r = ht()((s) => ({
1935
+ ...On(e)
614
1936
  }));
615
- return o.activitySettings = t, o;
1937
+ return r.activitySettings = e, r;
616
1938
  }
617
- function _(t) {
618
- V(
619
- () => t.activitySettings,
620
- (e) => {
621
- t.setState(e);
1939
+ function Jn(e) {
1940
+ Tn(
1941
+ () => e.activitySettings,
1942
+ (n) => {
1943
+ e.setState(n);
622
1944
  },
623
1945
  []
624
1946
  );
625
1947
  }
626
- function z({
627
- store: t
1948
+ function jn({
1949
+ store: e
628
1950
  }) {
629
- return _(t), null;
1951
+ return Jn(e), null;
630
1952
  }
631
- const K = [
1953
+ const Dn = [
632
1954
  "meta-player-events:1",
633
1955
  "mode:1",
634
1956
  "workflow:1"
635
1957
  ];
636
- function Et({
637
- children: t,
638
- contracts: e,
639
- loadOnlyWhenReady: o = !0,
1958
+ function gr({
1959
+ children: e,
1960
+ contracts: n,
1961
+ loadOnlyWhenReady: r = !0,
640
1962
  activitySettingsStore: s
641
1963
  }) {
642
- const i = n((c) => c.ready);
643
- return l(() => {
644
- const c = [...e];
645
- for (const u of K)
646
- c.includes(u) || c.push(u);
647
- O(c);
648
- }, []), o && !i ? /* @__PURE__ */ h("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */ j(M, { children: [
649
- s && /* @__PURE__ */ h(z, { store: s }),
650
- t
1964
+ const a = f((i) => i.ready);
1965
+ return J(() => {
1966
+ const i = [...n];
1967
+ for (const m of Dn)
1968
+ i.includes(m) || i.push(m);
1969
+ kn(i);
1970
+ }, []), r && !a ? /* @__PURE__ */ ce.jsx("div", { className: "capy-loading-container", children: "Chargement en cours..." }) : /* @__PURE__ */ ce.jsxs(ce.Fragment, { children: [
1971
+ s && /* @__PURE__ */ ce.jsx(jn, { store: s }),
1972
+ e
651
1973
  ] });
652
1974
  }
653
1975
  export {
654
- Et as Capytale,
655
- Dt as createActivitySettingsStore,
656
- bt as useAfterSaveAction,
657
- Ct as useGetLoadedJsonActivityContent,
658
- pt as useGetLoadedJsonActivitySplitContent,
659
- St as useGetLoadedJsonAssignmentContent,
660
- mt as useGetLoadedJsonAssignmentSplitContent,
661
- gt as useGetLoadedJsonContent,
662
- dt as useGetLoadedTextContent,
663
- ft as useJsonActivityContentSaveFunction,
664
- Jt as useJsonActivitySplitContentSaveFunction,
665
- At as useJsonAssignmentContentSaveFunction,
666
- Ft as useJsonAssignmentSplitContentSaveFunction,
667
- yt as useJsonContentSaveFunction,
668
- lt as useLoadedJsonActivityBinaryData,
669
- ct as useLoadedJsonActivityContent,
670
- ut as useLoadedJsonAssignmentBinaryData,
671
- rt as useLoadedJsonAssignmentContent,
672
- at as useLoadedJsonContent,
673
- it as useLoadedTextContent,
674
- tt as useMode,
675
- st as useNotifyIsDirty,
676
- ht as usePreviewImageFile,
677
- wt as usePreviewTextFile,
678
- xt as useQuickActions,
679
- ot as useRequestSave,
680
- V as useSettings,
681
- Tt as useShowToast,
682
- kt as useSidebarActions,
683
- vt as useTextContentSaveFunction,
684
- nt as useTheme,
685
- et as useWorkflow
1976
+ gr as Capytale,
1977
+ dr as createActivitySettingsStore,
1978
+ ir as useAfterSaveAction,
1979
+ Kn as useGetLoadedJsonActivityContent,
1980
+ Xn as useGetLoadedJsonActivitySplitContent,
1981
+ Qn as useGetLoadedJsonAssignmentContent,
1982
+ Zn as useGetLoadedJsonAssignmentSplitContent,
1983
+ Hn as useGetLoadedJsonContent,
1984
+ zn as useGetLoadedTextContent,
1985
+ nr as useJsonActivityContentSaveFunction,
1986
+ or as useJsonActivitySplitContentSaveFunction,
1987
+ rr as useJsonAssignmentContentSaveFunction,
1988
+ ar as useJsonAssignmentSplitContentSaveFunction,
1989
+ tr as useJsonContentSaveFunction,
1990
+ Bn as useLoadedJsonActivityBinaryData,
1991
+ qn as useLoadedJsonActivityContent,
1992
+ Yn as useLoadedJsonAssignmentBinaryData,
1993
+ Un as useLoadedJsonAssignmentContent,
1994
+ Nn as useLoadedJsonContent,
1995
+ Wn as useLoadedTextContent,
1996
+ In as useMode,
1997
+ Gn as useNotifyIsDirty,
1998
+ cr as usePreviewImageFile,
1999
+ sr as usePreviewTextFile,
2000
+ ur as useQuickActions,
2001
+ $n as useRequestSave,
2002
+ Tn as useSettings,
2003
+ fr as useShowToast,
2004
+ lr as useSidebarActions,
2005
+ er as useTextContentSaveFunction,
2006
+ Ln as useTheme,
2007
+ Mn as useWorkflow
686
2008
  };