@metapages/metapage 1.0.11 → 1.0.13
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.js +263 -256
- package/dist/index.js.map +1 -1
- package/dist/metapage/Metaframe.d.ts.map +1 -1
- package/dist/metapage/Metapage.d.ts.map +1 -1
- package/dist/metapage/MetapageIFrameRpcClient.d.ts +1 -1
- package/dist/metapage/MetapageIFrameRpcClient.d.ts.map +1 -1
- package/dist/metapage/MetapageTools.d.ts +1 -1
- package/dist/metapage/MetapageTools.d.ts.map +1 -1
- package/dist/metapage/data.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/metapage/Metaframe.ts +9 -3
- package/src/metapage/Metapage.ts +5 -0
- package/src/metapage/MetapageIFrameRpcClient.ts +11 -3
- package/src/metapage/MetapageTools.ts +15 -16
- package/src/metapage/data.ts +8 -6
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const De = ["0.3", "0.4", "0.5", "0.6", "1"], je = ["0.2", "0.3", "1"], Kt = "1",
|
|
1
|
+
const De = ["0.3", "0.4", "0.5", "0.6", "1"], je = ["0.2", "0.3", "1"], Kt = "1", be = "1", Yt = "metaframe.json", Xt = "metapage/definition", Qt = "metapage/state", Fe = je[je.length - 1], ut = De[De.length - 1], ct = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Ce = (t) => {
|
|
2
2
|
if (typeof t != "string")
|
|
3
3
|
throw new TypeError("Invalid argument expected string");
|
|
4
4
|
const e = t.match(ct);
|
|
@@ -8,14 +8,14 @@ const De = ["0.3", "0.4", "0.5", "0.6", "1"], je = ["0.2", "0.3", "1"], Kt = "1"
|
|
|
8
8
|
}, Pe = (t) => t === "*" || t === "x" || t === "X", Le = (t) => {
|
|
9
9
|
const e = parseInt(t, 10);
|
|
10
10
|
return isNaN(e) ? t : e;
|
|
11
|
-
},
|
|
11
|
+
}, ht = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], lt = (t, e) => {
|
|
12
12
|
if (Pe(t) || Pe(e))
|
|
13
13
|
return 0;
|
|
14
|
-
const [s, n] =
|
|
14
|
+
const [s, n] = ht(Le(t), Le(e));
|
|
15
15
|
return s > n ? 1 : s < n ? -1 : 0;
|
|
16
16
|
}, Ue = (t, e) => {
|
|
17
17
|
for (let s = 0; s < Math.max(t.length, e.length); s++) {
|
|
18
|
-
const n =
|
|
18
|
+
const n = lt(t[s] || "0", e[s] || "0");
|
|
19
19
|
if (n !== 0)
|
|
20
20
|
return n;
|
|
21
21
|
}
|
|
@@ -50,14 +50,14 @@ function A(t) {
|
|
|
50
50
|
return (e = t.copy) !== null && e !== void 0 ? e : t.original;
|
|
51
51
|
}
|
|
52
52
|
function J(t) {
|
|
53
|
-
return !!
|
|
53
|
+
return !!_(t);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function _(t) {
|
|
56
56
|
return typeof t != "object" ? null : t == null ? void 0 : t[Je];
|
|
57
57
|
}
|
|
58
58
|
function we(t) {
|
|
59
59
|
var e;
|
|
60
|
-
const s =
|
|
60
|
+
const s = _(t);
|
|
61
61
|
return s ? (e = s.copy) !== null && e !== void 0 ? e : s.original : t;
|
|
62
62
|
}
|
|
63
63
|
function C(t, e) {
|
|
@@ -68,7 +68,7 @@ function C(t, e) {
|
|
|
68
68
|
}
|
|
69
69
|
function Be(t, e = []) {
|
|
70
70
|
if (Object.hasOwnProperty.call(t, "key")) {
|
|
71
|
-
const s = t.parent.copy, n =
|
|
71
|
+
const s = t.parent.copy, n = _(V(s, t.key));
|
|
72
72
|
if (n !== null && (n == null ? void 0 : n.original) !== t.original)
|
|
73
73
|
return null;
|
|
74
74
|
const i = t.parent.type === 3, a = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
|
|
@@ -89,20 +89,20 @@ function Be(t, e = []) {
|
|
|
89
89
|
function B(t) {
|
|
90
90
|
return Array.isArray(t) ? 1 : t instanceof Map ? 2 : t instanceof Set ? 3 : 0;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function V(t, e) {
|
|
93
93
|
return B(t) === 2 ? t.get(e) : t[e];
|
|
94
94
|
}
|
|
95
95
|
function te(t, e, s) {
|
|
96
96
|
B(t) === 2 ? t.set(e, s) : t[e] = s;
|
|
97
97
|
}
|
|
98
98
|
function ce(t, e) {
|
|
99
|
-
const s =
|
|
99
|
+
const s = _(t);
|
|
100
100
|
return (s ? A(s) : t)[e];
|
|
101
101
|
}
|
|
102
102
|
function z(t, e) {
|
|
103
103
|
return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function le(t) {
|
|
106
106
|
if (t)
|
|
107
107
|
for (; t.finalities.revoke.length > 0; )
|
|
108
108
|
t.finalities.revoke.pop()();
|
|
@@ -116,7 +116,7 @@ function F(t, e) {
|
|
|
116
116
|
function dt(t, e) {
|
|
117
117
|
for (let s = 0; s < e.length - 1; s += 1) {
|
|
118
118
|
const n = e[s];
|
|
119
|
-
if (t =
|
|
119
|
+
if (t = V(B(t) === 3 ? Array.from(t) : t, n), typeof t != "object")
|
|
120
120
|
throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
|
|
121
121
|
}
|
|
122
122
|
return t;
|
|
@@ -258,7 +258,7 @@ function He(t, e, s) {
|
|
|
258
258
|
if (e.add(t), Me(t, (a, r) => {
|
|
259
259
|
var o;
|
|
260
260
|
if (J(r)) {
|
|
261
|
-
const f =
|
|
261
|
+
const f = _(r);
|
|
262
262
|
E(f);
|
|
263
263
|
const u = !((o = f.assignedMap) === null || o === void 0) && o.size || f.operated ? f.copy : f.original;
|
|
264
264
|
te(n ? i : t, a, u);
|
|
@@ -273,7 +273,7 @@ function He(t, e, s) {
|
|
|
273
273
|
}
|
|
274
274
|
function gt(t, e) {
|
|
275
275
|
const s = t.type === 3 ? t.setMap : t.copy;
|
|
276
|
-
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && s && He(
|
|
276
|
+
t.finalities.revoke.length > 1 && t.assignedMap.get(e) && s && He(V(s, e), t.finalities.handledSet, t.options);
|
|
277
277
|
}
|
|
278
278
|
function pe(t) {
|
|
279
279
|
t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
|
|
@@ -290,42 +290,42 @@ function de(t, e, s, n) {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
function Oe(t, e, s, n) {
|
|
293
|
-
const i =
|
|
293
|
+
const i = _(s);
|
|
294
294
|
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((a, r) => {
|
|
295
295
|
var o;
|
|
296
296
|
const f = t.type === 3 ? t.setMap : t.copy;
|
|
297
|
-
if (z(
|
|
297
|
+
if (z(V(f, e), s)) {
|
|
298
298
|
let u = i.original;
|
|
299
299
|
i.copy && (u = i.copy), pe(t), de(t, n, a, r), t.options.enableAutoFreeze && (t.options.updatedValues = (o = t.options.updatedValues) !== null && o !== void 0 ? o : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(u, i.original)), te(f, e, u);
|
|
300
300
|
}
|
|
301
301
|
}), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), C(s, t.options) && t.finalities.draft.push(() => {
|
|
302
302
|
const a = t.type === 3 ? t.setMap : t.copy;
|
|
303
|
-
z(
|
|
303
|
+
z(V(a, e), s) && gt(t, e);
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function _t(t, e, s, n, i) {
|
|
307
307
|
let { original: a, assignedMap: r, options: o } = t, f = t.copy;
|
|
308
308
|
f.length < a.length && ([a, f] = [f, a], [s, n] = [n, s]);
|
|
309
309
|
for (let u = 0; u < a.length; u += 1)
|
|
310
310
|
if (r.get(u.toString()) && f[u] !== a[u]) {
|
|
311
|
-
const c = e.concat([u]),
|
|
311
|
+
const c = e.concat([u]), h = F(c, i);
|
|
312
312
|
s.push({
|
|
313
313
|
op: I.Replace,
|
|
314
|
-
path:
|
|
314
|
+
path: h,
|
|
315
315
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
316
316
|
value: oe(f[u])
|
|
317
317
|
}), n.push({
|
|
318
318
|
op: I.Replace,
|
|
319
|
-
path:
|
|
319
|
+
path: h,
|
|
320
320
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
321
321
|
value: oe(a[u])
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
324
|
for (let u = a.length; u < f.length; u += 1) {
|
|
325
|
-
const c = e.concat([u]),
|
|
325
|
+
const c = e.concat([u]), h = F(c, i);
|
|
326
326
|
s.push({
|
|
327
327
|
op: I.Add,
|
|
328
|
-
path:
|
|
328
|
+
path: h,
|
|
329
329
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
330
330
|
value: oe(f[u])
|
|
331
331
|
});
|
|
@@ -333,29 +333,29 @@ function bt(t, e, s, n, i) {
|
|
|
333
333
|
if (a.length < f.length) {
|
|
334
334
|
const { arrayLengthAssignment: u = !0 } = o.enablePatches;
|
|
335
335
|
if (u) {
|
|
336
|
-
const c = e.concat(["length"]),
|
|
336
|
+
const c = e.concat(["length"]), h = F(c, i);
|
|
337
337
|
n.push({
|
|
338
338
|
op: I.Replace,
|
|
339
|
-
path:
|
|
339
|
+
path: h,
|
|
340
340
|
value: a.length
|
|
341
341
|
});
|
|
342
342
|
} else
|
|
343
343
|
for (let c = f.length; a.length < c; c -= 1) {
|
|
344
|
-
const
|
|
344
|
+
const h = e.concat([c - 1]), l = F(h, i);
|
|
345
345
|
n.push({
|
|
346
346
|
op: I.Remove,
|
|
347
|
-
path:
|
|
347
|
+
path: l
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function bt({ original: t, copy: e, assignedMap: s }, n, i, a, r) {
|
|
353
353
|
s.forEach((o, f) => {
|
|
354
|
-
const u =
|
|
355
|
-
if (z(u, c) &&
|
|
354
|
+
const u = V(t, f), c = oe(V(e, f)), h = o ? X(t, f) ? I.Replace : I.Add : I.Remove;
|
|
355
|
+
if (z(u, c) && h === I.Replace)
|
|
356
356
|
return;
|
|
357
|
-
const
|
|
358
|
-
i.push(
|
|
357
|
+
const l = n.concat(f), m = F(l, r);
|
|
358
|
+
i.push(h === I.Remove ? { op: h, path: m } : { op: h, path: m, value: c }), a.push(h === I.Add ? { op: I.Remove, path: m } : h === I.Remove ? { op: I.Add, path: m, value: u } : { op: I.Replace, path: m, value: u });
|
|
359
359
|
});
|
|
360
360
|
}
|
|
361
361
|
function vt({ original: t, copy: e }, s, n, i, a) {
|
|
@@ -395,9 +395,9 @@ function Z(t, e, s, n) {
|
|
|
395
395
|
switch (t.type) {
|
|
396
396
|
case 0:
|
|
397
397
|
case 2:
|
|
398
|
-
return _t(t, e, s, n, i);
|
|
399
|
-
case 1:
|
|
400
398
|
return bt(t, e, s, n, i);
|
|
399
|
+
case 1:
|
|
400
|
+
return _t(t, e, s, n, i);
|
|
401
401
|
case 3:
|
|
402
402
|
return vt(t, e, s, n, i);
|
|
403
403
|
}
|
|
@@ -408,23 +408,23 @@ const ae = (t, e, s = !1) => {
|
|
|
408
408
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
409
409
|
}, me = {
|
|
410
410
|
get size() {
|
|
411
|
-
return A(
|
|
411
|
+
return A(_(this)).size;
|
|
412
412
|
},
|
|
413
413
|
has(t) {
|
|
414
|
-
return A(
|
|
414
|
+
return A(_(this)).has(t);
|
|
415
415
|
},
|
|
416
416
|
set(t, e) {
|
|
417
|
-
const s =
|
|
417
|
+
const s = _(this), n = A(s);
|
|
418
418
|
return (!n.has(t) || !z(n.get(t), e)) && (E(s), U(s), s.assignedMap.set(t, !0), s.copy.set(t, e), Oe(s, t, e, Z)), this;
|
|
419
419
|
},
|
|
420
420
|
delete(t) {
|
|
421
421
|
if (!this.has(t))
|
|
422
422
|
return !1;
|
|
423
|
-
const e =
|
|
423
|
+
const e = _(this);
|
|
424
424
|
return E(e), U(e), e.original.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.copy.delete(t), !0;
|
|
425
425
|
},
|
|
426
426
|
clear() {
|
|
427
|
-
const t =
|
|
427
|
+
const t = _(this);
|
|
428
428
|
if (this.size) {
|
|
429
429
|
E(t), U(t), t.assignedMap = /* @__PURE__ */ new Map();
|
|
430
430
|
for (const [e] of t.original)
|
|
@@ -433,14 +433,14 @@ const ae = (t, e, s = !1) => {
|
|
|
433
433
|
}
|
|
434
434
|
},
|
|
435
435
|
forEach(t, e) {
|
|
436
|
-
const s =
|
|
436
|
+
const s = _(this);
|
|
437
437
|
A(s).forEach((n, i) => {
|
|
438
438
|
t.call(e, this.get(i), i, this);
|
|
439
439
|
});
|
|
440
440
|
},
|
|
441
441
|
get(t) {
|
|
442
442
|
var e, s;
|
|
443
|
-
const n =
|
|
443
|
+
const n = _(this), i = A(n).get(t), a = ((s = (e = n.options).mark) === null || s === void 0 ? void 0 : s.call(e, i, j)) === j.mutable;
|
|
444
444
|
if (n.options.strict && ae(i, n.options, a), a || n.finalized || !C(i, n.options) || i !== n.original.get(t))
|
|
445
445
|
return i;
|
|
446
446
|
const r = ve.createDraft({
|
|
@@ -453,7 +453,7 @@ const ae = (t, e, s = !1) => {
|
|
|
453
453
|
return E(n), n.copy.set(t, r), r;
|
|
454
454
|
},
|
|
455
455
|
keys() {
|
|
456
|
-
return A(
|
|
456
|
+
return A(_(this)).keys();
|
|
457
457
|
},
|
|
458
458
|
values() {
|
|
459
459
|
const t = this.keys();
|
|
@@ -494,7 +494,7 @@ const ae = (t, e, s = !1) => {
|
|
|
494
494
|
return a;
|
|
495
495
|
const r = a.value;
|
|
496
496
|
let o = t.setMap.get(r);
|
|
497
|
-
const f =
|
|
497
|
+
const f = _(o), u = ((i = (n = t.options).mark) === null || i === void 0 ? void 0 : i.call(n, o, j)) === j.mutable;
|
|
498
498
|
if (t.options.strict && ae(r, t.options, u), !u && !f && C(r, t.options) && !t.finalized && t.original.has(r)) {
|
|
499
499
|
const c = ve.createDraft({
|
|
500
500
|
original: r,
|
|
@@ -512,39 +512,39 @@ const ae = (t, e, s = !1) => {
|
|
|
512
512
|
};
|
|
513
513
|
}, ye = {
|
|
514
514
|
get size() {
|
|
515
|
-
return
|
|
515
|
+
return _(this).setMap.size;
|
|
516
516
|
},
|
|
517
517
|
has(t) {
|
|
518
|
-
const e =
|
|
518
|
+
const e = _(this);
|
|
519
519
|
if (e.setMap.has(t))
|
|
520
520
|
return !0;
|
|
521
521
|
E(e);
|
|
522
|
-
const s =
|
|
522
|
+
const s = _(t);
|
|
523
523
|
return !!(s && e.setMap.has(s.original));
|
|
524
524
|
},
|
|
525
525
|
add(t) {
|
|
526
|
-
const e =
|
|
526
|
+
const e = _(this);
|
|
527
527
|
return this.has(t) || (E(e), U(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), Oe(e, t, t, Z)), this;
|
|
528
528
|
},
|
|
529
529
|
delete(t) {
|
|
530
530
|
if (!this.has(t))
|
|
531
531
|
return !1;
|
|
532
|
-
const e =
|
|
532
|
+
const e = _(this);
|
|
533
533
|
E(e), U(e);
|
|
534
|
-
const s =
|
|
534
|
+
const s = _(t);
|
|
535
535
|
return s && e.setMap.has(s.original) ? (e.assignedMap.set(s.original, !1), e.setMap.delete(s.original)) : (!s && e.setMap.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.setMap.delete(t));
|
|
536
536
|
},
|
|
537
537
|
clear() {
|
|
538
538
|
if (!this.size)
|
|
539
539
|
return;
|
|
540
|
-
const t =
|
|
540
|
+
const t = _(this);
|
|
541
541
|
E(t), U(t);
|
|
542
542
|
for (const e of t.original)
|
|
543
543
|
t.assignedMap.set(e, !1);
|
|
544
544
|
t.setMap.clear();
|
|
545
545
|
},
|
|
546
546
|
values() {
|
|
547
|
-
const t =
|
|
547
|
+
const t = _(this);
|
|
548
548
|
E(t);
|
|
549
549
|
const e = t.setMap.keys();
|
|
550
550
|
return {
|
|
@@ -553,7 +553,7 @@ const ae = (t, e, s = !1) => {
|
|
|
553
553
|
};
|
|
554
554
|
},
|
|
555
555
|
entries() {
|
|
556
|
-
const t =
|
|
556
|
+
const t = _(this);
|
|
557
557
|
E(t);
|
|
558
558
|
const e = t.setMap.keys();
|
|
559
559
|
return {
|
|
@@ -622,7 +622,7 @@ const ae = (t, e, s = !1) => {
|
|
|
622
622
|
finalities: t.finalities,
|
|
623
623
|
options: t.options
|
|
624
624
|
}), typeof r == "function") {
|
|
625
|
-
const u =
|
|
625
|
+
const u = _(t.copy[e]);
|
|
626
626
|
return E(u), U(u), u.copy;
|
|
627
627
|
}
|
|
628
628
|
return t.copy[e];
|
|
@@ -639,7 +639,7 @@ const ae = (t, e, s = !1) => {
|
|
|
639
639
|
const a = Te(A(t), e);
|
|
640
640
|
if (a != null && a.set)
|
|
641
641
|
return a.set.call(t.proxy, s), !0;
|
|
642
|
-
const r = ce(A(t), e), o =
|
|
642
|
+
const r = ce(A(t), e), o = _(r);
|
|
643
643
|
return o && z(o.original, s) ? (t.copy[e] = s, t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (z(s, r) && (s !== void 0 || X(t.original, e)) || (E(t), U(t), X(t.original, e) && z(s, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = s, Oe(t, e, s, Z)), !0);
|
|
644
644
|
},
|
|
645
645
|
has(t, e) {
|
|
@@ -688,23 +688,23 @@ function Ie(t) {
|
|
|
688
688
|
const { proxy: f, revoke: u } = Proxy.revocable(r === 1 ? Object.assign([], o) : o, Ge);
|
|
689
689
|
if (i.revoke.push(u), qe.add(f), o.proxy = f, s) {
|
|
690
690
|
const c = s;
|
|
691
|
-
c.finalities.draft.push((
|
|
691
|
+
c.finalities.draft.push((h, l) => {
|
|
692
692
|
var m, y;
|
|
693
|
-
const
|
|
693
|
+
const M = _(f);
|
|
694
694
|
let p = c.type === 3 ? c.setMap : c.copy;
|
|
695
|
-
const O =
|
|
695
|
+
const O = V(p, n), v = _(O);
|
|
696
696
|
if (v) {
|
|
697
|
-
let
|
|
698
|
-
v.operated && (
|
|
697
|
+
let b = v.original;
|
|
698
|
+
v.operated && (b = we(O)), pe(v), de(v, Z, h, l), c.options.enableAutoFreeze && (c.options.updatedValues = (m = c.options.updatedValues) !== null && m !== void 0 ? m : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(b, v.original)), te(p, n, b);
|
|
699
699
|
}
|
|
700
|
-
(y =
|
|
701
|
-
|
|
700
|
+
(y = M.callbacks) === null || y === void 0 || y.forEach((b) => {
|
|
701
|
+
b(h, l);
|
|
702
702
|
});
|
|
703
703
|
});
|
|
704
704
|
} else {
|
|
705
|
-
const c =
|
|
706
|
-
c.finalities.draft.push((
|
|
707
|
-
pe(c), de(c, Z,
|
|
705
|
+
const c = _(f);
|
|
706
|
+
c.finalities.draft.push((h, l) => {
|
|
707
|
+
pe(c), de(c, Z, h, l);
|
|
708
708
|
});
|
|
709
709
|
}
|
|
710
710
|
return f;
|
|
@@ -712,12 +712,12 @@ function Ie(t) {
|
|
|
712
712
|
ve.createDraft = Ie;
|
|
713
713
|
function It(t, e, s, n, i) {
|
|
714
714
|
var a;
|
|
715
|
-
const r =
|
|
715
|
+
const r = _(t), o = (a = r == null ? void 0 : r.original) !== null && a !== void 0 ? a : t, f = !!e.length;
|
|
716
716
|
if (r != null && r.operated)
|
|
717
717
|
for (; r.finalities.draft.length > 0; )
|
|
718
718
|
r.finalities.draft.pop()(s, n);
|
|
719
719
|
const u = f ? e[0] : r ? r.operated ? r.copy : r.original : t;
|
|
720
|
-
return r &&
|
|
720
|
+
return r && le(r), i && W(u, u, r == null ? void 0 : r.options.updatedValues), [
|
|
721
721
|
u,
|
|
722
722
|
s && f ? [{ op: I.Replace, path: [], value: e[0] }] : s,
|
|
723
723
|
n && f ? [{ op: I.Replace, path: [], value: o }] : n
|
|
@@ -741,21 +741,21 @@ function St(t, e) {
|
|
|
741
741
|
return [
|
|
742
742
|
o,
|
|
743
743
|
(f = []) => {
|
|
744
|
-
const [u, c,
|
|
745
|
-
return e.enablePatches ? [u, c,
|
|
744
|
+
const [u, c, h] = It(o, f, i, a, e.enableAutoFreeze);
|
|
745
|
+
return e.enablePatches ? [u, c, h] : u;
|
|
746
746
|
}
|
|
747
747
|
];
|
|
748
748
|
}
|
|
749
749
|
function ge(t) {
|
|
750
750
|
const { rootDraft: e, value: s, useRawReturn: n = !1, isRoot: i = !0 } = t;
|
|
751
751
|
Me(s, (a, r, o) => {
|
|
752
|
-
const f =
|
|
752
|
+
const f = _(r);
|
|
753
753
|
if (f && e && f.finalities === e.finalities) {
|
|
754
754
|
t.isContainDraft = !0;
|
|
755
755
|
const u = f.original;
|
|
756
756
|
if (o instanceof Set) {
|
|
757
757
|
const c = Array.from(o);
|
|
758
|
-
o.clear(), c.forEach((
|
|
758
|
+
o.clear(), c.forEach((h) => o.add(a === h ? u : h));
|
|
759
759
|
} else
|
|
760
760
|
te(o, a, u);
|
|
761
761
|
} else
|
|
@@ -763,7 +763,7 @@ function ge(t) {
|
|
|
763
763
|
}), i && (t.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), n && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
764
764
|
}
|
|
765
765
|
function Ke(t) {
|
|
766
|
-
const e =
|
|
766
|
+
const e = _(t);
|
|
767
767
|
if (!C(t, e == null ? void 0 : e.options))
|
|
768
768
|
return t;
|
|
769
769
|
const s = B(t);
|
|
@@ -783,13 +783,13 @@ function Ke(t) {
|
|
|
783
783
|
} else
|
|
784
784
|
n = t;
|
|
785
785
|
return Me(n, (a, r) => {
|
|
786
|
-
if (e && z(
|
|
786
|
+
if (e && z(V(e.original, a), r))
|
|
787
787
|
return;
|
|
788
788
|
const o = Ke(r);
|
|
789
789
|
o !== r && (n === t && i(), te(n, a, o));
|
|
790
790
|
}), s === 3 ? new Set(n) : n;
|
|
791
791
|
}
|
|
792
|
-
function
|
|
792
|
+
function Ve(t) {
|
|
793
793
|
if (!J(t))
|
|
794
794
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
795
795
|
return Ke(t);
|
|
@@ -801,43 +801,43 @@ const Rt = (t) => {
|
|
|
801
801
|
var a, r, o;
|
|
802
802
|
if (typeof s == "function" && typeof n != "function")
|
|
803
803
|
return function(d, ...T) {
|
|
804
|
-
return e(d, (
|
|
804
|
+
return e(d, (x) => s.call(this, x, ...T), n);
|
|
805
805
|
};
|
|
806
806
|
const f = s, u = n;
|
|
807
807
|
let c = i;
|
|
808
808
|
if (typeof n != "function" && (c = n), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
809
809
|
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
810
810
|
c = Object.assign(Object.assign({}, t), c);
|
|
811
|
-
const
|
|
812
|
-
for (const
|
|
813
|
-
if (typeof
|
|
814
|
-
throw new Error(`Invalid mark: ${
|
|
815
|
-
const G =
|
|
811
|
+
const h = J(f) ? Ve(f) : f, l = Array.isArray(c.mark) ? (d, T) => {
|
|
812
|
+
for (const x of c.mark) {
|
|
813
|
+
if (typeof x != "function")
|
|
814
|
+
throw new Error(`Invalid mark: ${x}, 'mark' should be a function.`);
|
|
815
|
+
const G = x(d, T);
|
|
816
816
|
if (G)
|
|
817
817
|
return G;
|
|
818
818
|
}
|
|
819
819
|
} : c.mark, m = (a = c.enablePatches) !== null && a !== void 0 ? a : !1, y = (r = c.strict) !== null && r !== void 0 ? r : !1, p = {
|
|
820
820
|
enableAutoFreeze: (o = c.enableAutoFreeze) !== null && o !== void 0 ? o : !1,
|
|
821
|
-
mark:
|
|
821
|
+
mark: l,
|
|
822
822
|
strict: y,
|
|
823
823
|
enablePatches: m
|
|
824
824
|
};
|
|
825
|
-
if (!C(
|
|
825
|
+
if (!C(h, p) && typeof h == "object" && h !== null)
|
|
826
826
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
827
|
-
const [O, v] = St(
|
|
827
|
+
const [O, v] = St(h, p);
|
|
828
828
|
if (typeof n != "function") {
|
|
829
|
-
if (!C(
|
|
829
|
+
if (!C(h, p))
|
|
830
830
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
831
831
|
return [O, v];
|
|
832
832
|
}
|
|
833
|
-
let
|
|
833
|
+
let b;
|
|
834
834
|
try {
|
|
835
|
-
|
|
835
|
+
b = u(O);
|
|
836
836
|
} catch (d) {
|
|
837
|
-
throw
|
|
837
|
+
throw le(_(O)), d;
|
|
838
838
|
}
|
|
839
839
|
const S = (d) => {
|
|
840
|
-
const T =
|
|
840
|
+
const T = _(O);
|
|
841
841
|
if (!J(d)) {
|
|
842
842
|
if (d !== void 0 && !z(d, O) && (T != null && T.operated))
|
|
843
843
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
@@ -855,19 +855,19 @@ const Rt = (t) => {
|
|
|
855
855
|
}
|
|
856
856
|
if (d === O || d === void 0)
|
|
857
857
|
return v([]);
|
|
858
|
-
const
|
|
859
|
-
if (p ===
|
|
860
|
-
if (
|
|
858
|
+
const x = _(d);
|
|
859
|
+
if (p === x.options) {
|
|
860
|
+
if (x.operated)
|
|
861
861
|
throw new Error("Cannot return a modified child draft.");
|
|
862
|
-
return v([
|
|
862
|
+
return v([Ve(d)]);
|
|
863
863
|
}
|
|
864
864
|
return v([d]);
|
|
865
865
|
};
|
|
866
|
-
return
|
|
867
|
-
throw
|
|
868
|
-
}) : S(
|
|
866
|
+
return b instanceof Promise ? b.then(S, (d) => {
|
|
867
|
+
throw le(_(O)), d;
|
|
868
|
+
}) : S(b);
|
|
869
869
|
};
|
|
870
|
-
},
|
|
870
|
+
}, w = Rt();
|
|
871
871
|
Object.prototype.constructor.toString();
|
|
872
872
|
var Et = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
873
873
|
function Ye(t) {
|
|
@@ -895,15 +895,15 @@ var Xe = { exports: {} };
|
|
|
895
895
|
retryOn: []
|
|
896
896
|
};
|
|
897
897
|
return r = Object.assign(o, r), function(u, c) {
|
|
898
|
-
var
|
|
898
|
+
var h = r.retries, l = r.retryDelay, m = r.retryOn;
|
|
899
899
|
if (c && c.retries !== void 0)
|
|
900
900
|
if (n(c.retries))
|
|
901
|
-
|
|
901
|
+
h = c.retries;
|
|
902
902
|
else
|
|
903
903
|
throw new i("retries must be a positive integer");
|
|
904
904
|
if (c && c.retryDelay !== void 0)
|
|
905
905
|
if (n(c.retryDelay) || typeof c.retryDelay == "function")
|
|
906
|
-
|
|
906
|
+
l = c.retryDelay;
|
|
907
907
|
else
|
|
908
908
|
throw new i("retryDelay must be a positive integer or a function returning a positive integer");
|
|
909
909
|
if (c && c.retryOn)
|
|
@@ -911,39 +911,39 @@ var Xe = { exports: {} };
|
|
|
911
911
|
m = c.retryOn;
|
|
912
912
|
else
|
|
913
913
|
throw new i("retryOn property expects an array or function");
|
|
914
|
-
return new Promise(function(y,
|
|
914
|
+
return new Promise(function(y, M) {
|
|
915
915
|
var p = function(v) {
|
|
916
|
-
var
|
|
917
|
-
a(
|
|
916
|
+
var b = typeof Request < "u" && u instanceof Request ? u.clone() : u;
|
|
917
|
+
a(b, c).then(function(S) {
|
|
918
918
|
if (Array.isArray(m) && m.indexOf(S.status) === -1)
|
|
919
919
|
y(S);
|
|
920
920
|
else if (typeof m == "function")
|
|
921
921
|
try {
|
|
922
922
|
return Promise.resolve(m(v, null, S)).then(function(d) {
|
|
923
923
|
d ? O(v, null, S) : y(S);
|
|
924
|
-
}).catch(
|
|
924
|
+
}).catch(M);
|
|
925
925
|
} catch (d) {
|
|
926
|
-
|
|
926
|
+
M(d);
|
|
927
927
|
}
|
|
928
928
|
else
|
|
929
|
-
v <
|
|
929
|
+
v < h ? O(v, null, S) : y(S);
|
|
930
930
|
}).catch(function(S) {
|
|
931
931
|
if (typeof m == "function")
|
|
932
932
|
try {
|
|
933
933
|
Promise.resolve(m(v, S, null)).then(function(d) {
|
|
934
|
-
d ? O(v, S, null) :
|
|
934
|
+
d ? O(v, S, null) : M(S);
|
|
935
935
|
}).catch(function(d) {
|
|
936
|
-
|
|
936
|
+
M(d);
|
|
937
937
|
});
|
|
938
938
|
} catch (d) {
|
|
939
|
-
|
|
939
|
+
M(d);
|
|
940
940
|
}
|
|
941
941
|
else
|
|
942
|
-
v <
|
|
942
|
+
v < h ? O(v, S, null) : M(S);
|
|
943
943
|
});
|
|
944
944
|
};
|
|
945
|
-
function O(v,
|
|
946
|
-
var d = typeof
|
|
945
|
+
function O(v, b, S) {
|
|
946
|
+
var d = typeof l == "function" ? l(v, b, S) : l;
|
|
947
947
|
setTimeout(function() {
|
|
948
948
|
p(++v);
|
|
949
949
|
}, d);
|
|
@@ -985,7 +985,7 @@ const Qe = /* @__PURE__ */ Ye(At), Dt = Qe(fetch), Ze = async (t, e) => {
|
|
|
985
985
|
throw `Error converting metapage definition to version ${e}: ${n}`;
|
|
986
986
|
}
|
|
987
987
|
return Ct(t, e);
|
|
988
|
-
}, jt = async (t) => Ze(t,
|
|
988
|
+
}, jt = async (t) => Ze(t, be), Ct = (t, e) => {
|
|
989
989
|
if (!t)
|
|
990
990
|
throw "Metapage definition null";
|
|
991
991
|
if (!t.version)
|
|
@@ -1023,9 +1023,9 @@ const Qe = /* @__PURE__ */ Ye(At), Dt = Qe(fetch), Ze = async (t, e) => {
|
|
|
1023
1023
|
case void 0:
|
|
1024
1024
|
case "0.3":
|
|
1025
1025
|
case "0.4":
|
|
1026
|
-
return et(
|
|
1026
|
+
return et(xe(Pt(t)));
|
|
1027
1027
|
case "0.5":
|
|
1028
|
-
return
|
|
1028
|
+
return xe(t);
|
|
1029
1029
|
case "0.6":
|
|
1030
1030
|
return tt(t);
|
|
1031
1031
|
case "1":
|
|
@@ -1040,12 +1040,12 @@ ${window.location.href}`;
|
|
|
1040
1040
|
${window.location.href}`), t;
|
|
1041
1041
|
}
|
|
1042
1042
|
}, Pt = (t) => {
|
|
1043
|
-
const { version: e, inputs: s, outputs: n, allow: i, metadata: a, ...r } = t, o = a, { title: f, author: u, image: c, descriptionUrl:
|
|
1043
|
+
const { version: e, inputs: s, outputs: n, allow: i, metadata: a, ...r } = t, o = a, { title: f, author: u, image: c, descriptionUrl: h, keywords: l, iconUrl: m, ...y } = o, M = {
|
|
1044
1044
|
name: f,
|
|
1045
1045
|
author: u,
|
|
1046
|
-
description:
|
|
1046
|
+
description: h,
|
|
1047
1047
|
image: c,
|
|
1048
|
-
tags:
|
|
1048
|
+
tags: l,
|
|
1049
1049
|
...y
|
|
1050
1050
|
};
|
|
1051
1051
|
return {
|
|
@@ -1053,10 +1053,10 @@ ${window.location.href}`), t;
|
|
|
1053
1053
|
inputs: s,
|
|
1054
1054
|
outputs: n,
|
|
1055
1055
|
allow: i,
|
|
1056
|
-
metadata:
|
|
1056
|
+
metadata: M,
|
|
1057
1057
|
...r
|
|
1058
1058
|
};
|
|
1059
|
-
}, tt = (t) => t,
|
|
1059
|
+
}, tt = (t) => t, xe = (t) => tt(Lt(t)), Lt = (t) => w(t, (e) => {
|
|
1060
1060
|
const { metadata: s, ...n } = e, i = {
|
|
1061
1061
|
...n,
|
|
1062
1062
|
version: "0.6"
|
|
@@ -1074,32 +1074,32 @@ ${window.location.href}`), t;
|
|
|
1074
1074
|
o.operations.edit = u;
|
|
1075
1075
|
break;
|
|
1076
1076
|
case "metaframe":
|
|
1077
|
-
const c = a.value,
|
|
1077
|
+
const c = a.value, h = {
|
|
1078
1078
|
type: "url",
|
|
1079
1079
|
url: c.url,
|
|
1080
|
-
params: c.params ? c.params.map((
|
|
1081
|
-
to:
|
|
1082
|
-
from:
|
|
1083
|
-
toType:
|
|
1080
|
+
params: c.params ? c.params.map((l) => ({
|
|
1081
|
+
to: l.to,
|
|
1082
|
+
from: l.from,
|
|
1083
|
+
toType: l.toType === "path" ? void 0 : l.toType
|
|
1084
1084
|
})) : void 0
|
|
1085
1085
|
};
|
|
1086
|
-
o.operations.edit =
|
|
1086
|
+
o.operations.edit = h;
|
|
1087
1087
|
break;
|
|
1088
1088
|
default:
|
|
1089
1089
|
throw `Unsupported edit type: ${a.type} in metadata for metaframe ${JSON.stringify(s)}`;
|
|
1090
1090
|
}
|
|
1091
1091
|
}
|
|
1092
1092
|
return i;
|
|
1093
|
-
}), Ut = (t) =>
|
|
1093
|
+
}), Ut = (t) => w(t, (e) => {
|
|
1094
1094
|
e.version = "0.3";
|
|
1095
|
-
}), Tt = (t) =>
|
|
1095
|
+
}), Tt = (t) => w(t, (e) => {
|
|
1096
1096
|
e.version = "0.2";
|
|
1097
|
-
}), $t = (t) =>
|
|
1097
|
+
}), $t = (t) => w(t, (e) => {
|
|
1098
1098
|
const s = e;
|
|
1099
1099
|
delete s.plugins, s.version = "1";
|
|
1100
|
-
}), zt = (t) =>
|
|
1100
|
+
}), zt = (t) => w(t, (e) => (e.version = "0.3", e)), H = (t) => {
|
|
1101
1101
|
if (t === "latest")
|
|
1102
|
-
return
|
|
1102
|
+
return be;
|
|
1103
1103
|
if (k(t, "0.2") < 0)
|
|
1104
1104
|
throw `Unknown version: ${t}`;
|
|
1105
1105
|
if (k(t, "0.2") <= 0 && k(t, "0.3") < 0)
|
|
@@ -1126,19 +1126,18 @@ var ne = function(t) {
|
|
|
1126
1126
|
a = Y[t.charCodeAt(n)], r = Y[t.charCodeAt(n + 1)], o = Y[t.charCodeAt(n + 2)], f = Y[t.charCodeAt(n + 3)], c[i++] = a << 2 | r >> 4, c[i++] = (r & 15) << 4 | o >> 2, c[i++] = (o & 3) << 6 | f & 63;
|
|
1127
1127
|
return u;
|
|
1128
1128
|
};
|
|
1129
|
-
const ue = async (t) => {
|
|
1130
|
-
for (const
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1129
|
+
const ue = async (t) => w(t, async (e) => {
|
|
1130
|
+
for (const s of Object.keys(t)) {
|
|
1131
|
+
const n = await Vt(t[s]);
|
|
1132
|
+
return e[s] = n, e;
|
|
1133
1133
|
}
|
|
1134
|
-
|
|
1135
|
-
}, Q = async (t) => {
|
|
1134
|
+
}), Q = async (t) => {
|
|
1136
1135
|
for (const e of Object.keys(t)) {
|
|
1137
|
-
const s = await
|
|
1136
|
+
const s = await xt(t[e]);
|
|
1138
1137
|
t[e] = s;
|
|
1139
1138
|
}
|
|
1140
1139
|
return t;
|
|
1141
|
-
},
|
|
1140
|
+
}, Vt = async (t) => {
|
|
1142
1141
|
if (t instanceof Int8Array || t instanceof Uint8Array || t instanceof Uint8ClampedArray || t instanceof Int16Array || t instanceof Uint16Array || t instanceof Int32Array || t instanceof Uint32Array || t instanceof Float32Array || t instanceof Float64Array) {
|
|
1143
1142
|
const e = t, s = {
|
|
1144
1143
|
_s: !0,
|
|
@@ -1179,7 +1178,7 @@ const ue = async (t) => {
|
|
|
1179
1178
|
return Promise.resolve(s);
|
|
1180
1179
|
}
|
|
1181
1180
|
return Promise.resolve(t);
|
|
1182
|
-
},
|
|
1181
|
+
}, xt = (t) => {
|
|
1183
1182
|
if (!(t && typeof t == "object" && t._s === !0))
|
|
1184
1183
|
return t;
|
|
1185
1184
|
const e = t, s = e._c;
|
|
@@ -1237,10 +1236,10 @@ var st = { exports: {} };
|
|
|
1237
1236
|
function i(f, u, c) {
|
|
1238
1237
|
this.fn = f, this.context = u, this.once = c || !1;
|
|
1239
1238
|
}
|
|
1240
|
-
function a(f, u, c,
|
|
1239
|
+
function a(f, u, c, h, l) {
|
|
1241
1240
|
if (typeof c != "function")
|
|
1242
1241
|
throw new TypeError("The listener must be a function");
|
|
1243
|
-
var m = new i(c,
|
|
1242
|
+
var m = new i(c, h || f, l), y = s ? s + u : u;
|
|
1244
1243
|
return f._events[y] ? f._events[y].fn ? f._events[y] = [f._events[y], m] : f._events[y].push(m) : (f._events[y] = m, f._eventsCount++), f;
|
|
1245
1244
|
}
|
|
1246
1245
|
function r(f, u) {
|
|
@@ -1250,29 +1249,29 @@ var st = { exports: {} };
|
|
|
1250
1249
|
this._events = new n(), this._eventsCount = 0;
|
|
1251
1250
|
}
|
|
1252
1251
|
o.prototype.eventNames = function() {
|
|
1253
|
-
var u = [], c,
|
|
1252
|
+
var u = [], c, h;
|
|
1254
1253
|
if (this._eventsCount === 0)
|
|
1255
1254
|
return u;
|
|
1256
|
-
for (
|
|
1257
|
-
e.call(c,
|
|
1255
|
+
for (h in c = this._events)
|
|
1256
|
+
e.call(c, h) && u.push(s ? h.slice(1) : h);
|
|
1258
1257
|
return Object.getOwnPropertySymbols ? u.concat(Object.getOwnPropertySymbols(c)) : u;
|
|
1259
1258
|
}, o.prototype.listeners = function(u) {
|
|
1260
|
-
var c = s ? s + u : u,
|
|
1261
|
-
if (!
|
|
1259
|
+
var c = s ? s + u : u, h = this._events[c];
|
|
1260
|
+
if (!h)
|
|
1262
1261
|
return [];
|
|
1263
|
-
if (
|
|
1264
|
-
return [
|
|
1265
|
-
for (var
|
|
1266
|
-
y[
|
|
1262
|
+
if (h.fn)
|
|
1263
|
+
return [h.fn];
|
|
1264
|
+
for (var l = 0, m = h.length, y = new Array(m); l < m; l++)
|
|
1265
|
+
y[l] = h[l].fn;
|
|
1267
1266
|
return y;
|
|
1268
1267
|
}, o.prototype.listenerCount = function(u) {
|
|
1269
|
-
var c = s ? s + u : u,
|
|
1270
|
-
return
|
|
1271
|
-
}, o.prototype.emit = function(u, c,
|
|
1272
|
-
var
|
|
1273
|
-
if (!this._events[
|
|
1268
|
+
var c = s ? s + u : u, h = this._events[c];
|
|
1269
|
+
return h ? h.fn ? 1 : h.length : 0;
|
|
1270
|
+
}, o.prototype.emit = function(u, c, h, l, m, y) {
|
|
1271
|
+
var M = s ? s + u : u;
|
|
1272
|
+
if (!this._events[M])
|
|
1274
1273
|
return !1;
|
|
1275
|
-
var p = this._events[
|
|
1274
|
+
var p = this._events[M], O = arguments.length, v, b;
|
|
1276
1275
|
if (p.fn) {
|
|
1277
1276
|
switch (p.once && this.removeListener(u, p.fn, void 0, !0), O) {
|
|
1278
1277
|
case 1:
|
|
@@ -1280,46 +1279,46 @@ var st = { exports: {} };
|
|
|
1280
1279
|
case 2:
|
|
1281
1280
|
return p.fn.call(p.context, c), !0;
|
|
1282
1281
|
case 3:
|
|
1283
|
-
return p.fn.call(p.context, c,
|
|
1282
|
+
return p.fn.call(p.context, c, h), !0;
|
|
1284
1283
|
case 4:
|
|
1285
|
-
return p.fn.call(p.context, c,
|
|
1284
|
+
return p.fn.call(p.context, c, h, l), !0;
|
|
1286
1285
|
case 5:
|
|
1287
|
-
return p.fn.call(p.context, c,
|
|
1286
|
+
return p.fn.call(p.context, c, h, l, m), !0;
|
|
1288
1287
|
case 6:
|
|
1289
|
-
return p.fn.call(p.context, c,
|
|
1288
|
+
return p.fn.call(p.context, c, h, l, m, y), !0;
|
|
1290
1289
|
}
|
|
1291
|
-
for (
|
|
1292
|
-
v[
|
|
1290
|
+
for (b = 1, v = new Array(O - 1); b < O; b++)
|
|
1291
|
+
v[b - 1] = arguments[b];
|
|
1293
1292
|
p.fn.apply(p.context, v);
|
|
1294
1293
|
} else {
|
|
1295
1294
|
var S = p.length, d;
|
|
1296
|
-
for (
|
|
1297
|
-
switch (p[
|
|
1295
|
+
for (b = 0; b < S; b++)
|
|
1296
|
+
switch (p[b].once && this.removeListener(u, p[b].fn, void 0, !0), O) {
|
|
1298
1297
|
case 1:
|
|
1299
|
-
p[
|
|
1298
|
+
p[b].fn.call(p[b].context);
|
|
1300
1299
|
break;
|
|
1301
1300
|
case 2:
|
|
1302
|
-
p[
|
|
1301
|
+
p[b].fn.call(p[b].context, c);
|
|
1303
1302
|
break;
|
|
1304
1303
|
case 3:
|
|
1305
|
-
p[
|
|
1304
|
+
p[b].fn.call(p[b].context, c, h);
|
|
1306
1305
|
break;
|
|
1307
1306
|
case 4:
|
|
1308
|
-
p[
|
|
1307
|
+
p[b].fn.call(p[b].context, c, h, l);
|
|
1309
1308
|
break;
|
|
1310
1309
|
default:
|
|
1311
1310
|
if (!v)
|
|
1312
1311
|
for (d = 1, v = new Array(O - 1); d < O; d++)
|
|
1313
1312
|
v[d - 1] = arguments[d];
|
|
1314
|
-
p[
|
|
1313
|
+
p[b].fn.apply(p[b].context, v);
|
|
1315
1314
|
}
|
|
1316
1315
|
}
|
|
1317
1316
|
return !0;
|
|
1318
|
-
}, o.prototype.on = function(u, c,
|
|
1319
|
-
return a(this, u, c,
|
|
1320
|
-
}, o.prototype.once = function(u, c,
|
|
1321
|
-
return a(this, u, c,
|
|
1322
|
-
}, o.prototype.removeListener = function(u, c,
|
|
1317
|
+
}, o.prototype.on = function(u, c, h) {
|
|
1318
|
+
return a(this, u, c, h, !1);
|
|
1319
|
+
}, o.prototype.once = function(u, c, h) {
|
|
1320
|
+
return a(this, u, c, h, !0);
|
|
1321
|
+
}, o.prototype.removeListener = function(u, c, h, l) {
|
|
1323
1322
|
var m = s ? s + u : u;
|
|
1324
1323
|
if (!this._events[m])
|
|
1325
1324
|
return this;
|
|
@@ -1327,10 +1326,10 @@ var st = { exports: {} };
|
|
|
1327
1326
|
return r(this, m), this;
|
|
1328
1327
|
var y = this._events[m];
|
|
1329
1328
|
if (y.fn)
|
|
1330
|
-
y.fn === c && (!
|
|
1329
|
+
y.fn === c && (!l || y.once) && (!h || y.context === h) && r(this, m);
|
|
1331
1330
|
else {
|
|
1332
|
-
for (var
|
|
1333
|
-
(y[
|
|
1331
|
+
for (var M = 0, p = [], O = y.length; M < O; M++)
|
|
1332
|
+
(y[M].fn !== c || l && !y[M].once || h && y[M].context !== h) && p.push(y[M]);
|
|
1334
1333
|
p.length ? this._events[m] = p.length === 1 ? p[0] : p : r(this, m);
|
|
1335
1334
|
}
|
|
1336
1335
|
return this;
|
|
@@ -1339,7 +1338,7 @@ var st = { exports: {} };
|
|
|
1339
1338
|
return u ? (c = s ? s + u : u, this._events[c] && r(this, c)) : (this._events = new n(), this._eventsCount = 0), this;
|
|
1340
1339
|
}, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = s, o.EventEmitter = o, t.exports = o;
|
|
1341
1340
|
})(st);
|
|
1342
|
-
var Se = st.exports,
|
|
1341
|
+
var Se = st.exports, Nt = function(t, e) {
|
|
1343
1342
|
e || (e = {}), typeof e == "function" && (e = { cmp: e });
|
|
1344
1343
|
var s = typeof e.cycles == "boolean" ? e.cycles : !1, n = e.cmp && function(a) {
|
|
1345
1344
|
return function(r) {
|
|
@@ -1370,14 +1369,14 @@ var Se = st.exports, Vt = function(t, e) {
|
|
|
1370
1369
|
}
|
|
1371
1370
|
var u = i.push(r) - 1, c = Object.keys(r).sort(n && n(r));
|
|
1372
1371
|
for (f = "", o = 0; o < c.length; o++) {
|
|
1373
|
-
var
|
|
1374
|
-
|
|
1372
|
+
var h = c[o], l = a(r[h]);
|
|
1373
|
+
l && (f && (f += ","), f += JSON.stringify(h) + ":" + l);
|
|
1375
1374
|
}
|
|
1376
1375
|
return i.splice(u, 1), "{" + f + "}";
|
|
1377
1376
|
}
|
|
1378
1377
|
}(t);
|
|
1379
1378
|
};
|
|
1380
|
-
const nt = /* @__PURE__ */ Ye(
|
|
1379
|
+
const nt = /* @__PURE__ */ Ye(Nt);
|
|
1381
1380
|
var ee;
|
|
1382
1381
|
(function(t) {
|
|
1383
1382
|
t.mp_debug = "mp_debug";
|
|
@@ -1389,7 +1388,7 @@ const kt = () => {
|
|
|
1389
1388
|
return !1;
|
|
1390
1389
|
}
|
|
1391
1390
|
}, it = {
|
|
1392
|
-
version:
|
|
1391
|
+
version: be,
|
|
1393
1392
|
metaframes: {}
|
|
1394
1393
|
};
|
|
1395
1394
|
class Ft extends Se.EventEmitter {
|
|
@@ -1403,19 +1402,16 @@ class Ft extends Se.EventEmitter {
|
|
|
1403
1402
|
return this._definition;
|
|
1404
1403
|
}
|
|
1405
1404
|
}
|
|
1406
|
-
const fe = (t, e) => {
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
s = !0, e[n] === void 0 ? delete t[n] : t[n] = e[n];
|
|
1412
|
-
}), s;
|
|
1413
|
-
}, rs = (t) => window.location.search ? new URLSearchParams(window.location.search).get(t) : null, os = () => new URLSearchParams(window.location.search).has(ee.mp_debug), be = () => {
|
|
1405
|
+
const fe = (t, e) => e ? w(t, (s) => {
|
|
1406
|
+
Object.keys(e).forEach((n) => {
|
|
1407
|
+
e[n] === void 0 ? delete s[n] : s[n] = e[n];
|
|
1408
|
+
});
|
|
1409
|
+
}) : t, rs = (t) => window.location.search ? new URLSearchParams(window.location.search).get(t) : null, os = () => new URLSearchParams(window.location.search).has(ee.mp_debug), _e = () => {
|
|
1414
1410
|
const t = new URLSearchParams(window.location.search).get(ee.mp_debug);
|
|
1415
1411
|
return t === "true" || t === "1";
|
|
1416
|
-
}, as = (t = 8) => Re(t), Jt = (t = 8) => Re(t), fs = (t = 8) => Re(t),
|
|
1417
|
-
for (var e = "", s =
|
|
1418
|
-
e +=
|
|
1412
|
+
}, as = (t = 8) => Re(t), Jt = (t = 8) => Re(t), fs = (t = 8) => Re(t), Ne = "abcdefghijklmnopqrstuvwxyz0123456789", Re = (t = 8) => {
|
|
1413
|
+
for (var e = "", s = Ne.length, n = 0; n < t; n++)
|
|
1414
|
+
e += Ne.charAt(Math.floor(Math.random() * s));
|
|
1419
1415
|
return e;
|
|
1420
1416
|
}, Ee = (t, e, s) => {
|
|
1421
1417
|
e = e || "000", e && e.trim() == "" && (e = void 0);
|
|
@@ -1433,8 +1429,8 @@ const fe = (t, e) => {
|
|
|
1433
1429
|
}, Wt = (t) => {
|
|
1434
1430
|
var e = (t & 16777215).toString(16).toUpperCase();
|
|
1435
1431
|
return "00000".substring(0, 6 - e.length) + e;
|
|
1436
|
-
},
|
|
1437
|
-
if (
|
|
1432
|
+
}, he = () => document.readyState == "complete" || document.readyState == "interactive", Ae = async () => he() ? Promise.resolve() : new Promise((t) => {
|
|
1433
|
+
if (he()) {
|
|
1438
1434
|
t();
|
|
1439
1435
|
return;
|
|
1440
1436
|
}
|
|
@@ -1442,7 +1438,7 @@ const fe = (t, e) => {
|
|
|
1442
1438
|
window.addEventListener("load", () => {
|
|
1443
1439
|
e || (e = !0, t());
|
|
1444
1440
|
}), setTimeout(() => {
|
|
1445
|
-
!e &&
|
|
1441
|
+
!e && he() && (e = !0, t());
|
|
1446
1442
|
}, 200);
|
|
1447
1443
|
}), us = async (t) => {
|
|
1448
1444
|
const e = nt(t);
|
|
@@ -1458,17 +1454,17 @@ async function ot(t) {
|
|
|
1458
1454
|
const s = new TextEncoder().encode(t), n = await crypto.subtle.digest("SHA-256", s);
|
|
1459
1455
|
return btoa(String.fromCharCode(...new Uint8Array(n)));
|
|
1460
1456
|
}
|
|
1461
|
-
var
|
|
1457
|
+
var N;
|
|
1462
1458
|
(function(t) {
|
|
1463
1459
|
t.WaitingForPageLoad = "WaitingForPageLoad", t.SentSetupIframeClientRequest = "SentSetupIframeClientRequest", t.Ready = "Ready";
|
|
1464
|
-
})(
|
|
1460
|
+
})(N || (N = {}));
|
|
1465
1461
|
var R;
|
|
1466
1462
|
(function(t) {
|
|
1467
1463
|
t.Connected = "connected", t.Error = "error", t.Input = "input", t.Inputs = "inputs", t.Message = "message";
|
|
1468
1464
|
})(R || (R = {}));
|
|
1469
1465
|
class P extends Se.EventEmitter {
|
|
1470
1466
|
constructor(e) {
|
|
1471
|
-
if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state =
|
|
1467
|
+
if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = N.WaitingForPageLoad, this._messageSendCount = 0, this.debug = _e(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = _e(), this._isIframe = kt(), this.addListener = this.addListener.bind(this), this.dispose = this.dispose.bind(this), this.error = this.error.bind(this), this.getInput = this.getInput.bind(this), this.getInputs = this.getInputs.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.onInput = this.onInput.bind(this), this.onInputs = this.onInputs.bind(this), this.onMessage = this.onMessage.bind(this), this.sendRpc = this.sendRpc.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setInternalInputsAndNotify = this.setInternalInputsAndNotify.bind(this), this.setOutput = this.setOutput.bind(this), this.setOutputs = this.setOutputs.bind(this), this.warn = this.warn.bind(this), this._resolveSetupIframeServerResponse = this._resolveSetupIframeServerResponse.bind(this), this.addListenerReturnDisposer = this.addListenerReturnDisposer.bind(this), this.connected = this.connected.bind(this), this.disableNotifyOnHashUrlChange = this.disableNotifyOnHashUrlChange.bind(this), this._onHashUrlChange = this._onHashUrlChange.bind(this), !this._isIframe) {
|
|
1472
1468
|
this.log("Not an iframe, metaframe code disabled");
|
|
1473
1469
|
return;
|
|
1474
1470
|
}
|
|
@@ -1476,18 +1472,18 @@ class P extends Se.EventEmitter {
|
|
|
1476
1472
|
Ae().then(() => {
|
|
1477
1473
|
this.log("pageLoaded"), window.addEventListener("message", this.onMessage), s.sendRpc(D.SetupIframeClientRequest, {
|
|
1478
1474
|
version: P.version
|
|
1479
|
-
}), s._state =
|
|
1475
|
+
}), s._state = N.SentSetupIframeClientRequest;
|
|
1480
1476
|
}), e && e.disableHashChangeEvent || window.addEventListener("hashchange", this._onHashUrlChange);
|
|
1481
1477
|
}
|
|
1482
1478
|
_resolveSetupIframeServerResponse(e) {
|
|
1483
|
-
if (this._state ===
|
|
1479
|
+
if (this._state === N.WaitingForPageLoad)
|
|
1484
1480
|
throw "Got message but page has not finished loading, we should never get in this state";
|
|
1485
|
-
(async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = rt(this.id), this._parentId = e.parentId, this.log(`metapage[${this._parentId}](v${this._parentVersion ? this._parentVersion : "unknown"}) registered`), e.state && e.state.inputs && (this.isInputOutputBlobSerialization ? this._inputPipeValues = await Q(e.state.inputs) : this._inputPipeValues = e.state.inputs), this._state =
|
|
1481
|
+
(async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = rt(this.id), this._parentId = e.parentId, this.log(`metapage[${this._parentId}](v${this._parentVersion ? this._parentVersion : "unknown"}) registered`), e.state && e.state.inputs && (this.isInputOutputBlobSerialization ? this._inputPipeValues = await Q(e.state.inputs) : this._inputPipeValues = e.state.inputs), this._state = N.Ready, this.sendRpc(D.SetupIframeServerResponseAck, {
|
|
1486
1482
|
version: P.version
|
|
1487
1483
|
}), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(R.Inputs, this._inputPipeValues), Object.keys(this._inputPipeValues).forEach((s) => this.emit(R.Input, s, this._inputPipeValues[s]))), this.emit(R.Inputs, this._inputPipeValues), this.emit(R.Connected)))();
|
|
1488
1484
|
}
|
|
1489
1485
|
async connected() {
|
|
1490
|
-
if (this._state !==
|
|
1486
|
+
if (this._state !== N.Ready)
|
|
1491
1487
|
return new Promise((e, s) => {
|
|
1492
1488
|
let n;
|
|
1493
1489
|
n = this.addListenerReturnDisposer(R.Connected, () => {
|
|
@@ -1537,18 +1533,20 @@ class P extends Se.EventEmitter {
|
|
|
1537
1533
|
this.isInputOutputBlobSerialization && (e = await Q(e)), this.sendRpc(D.InputsUpdate, e);
|
|
1538
1534
|
}
|
|
1539
1535
|
async setInternalInputsAndNotify(e) {
|
|
1540
|
-
|
|
1541
|
-
|
|
1536
|
+
this.isInputOutputBlobSerialization && (e = await Q(e));
|
|
1537
|
+
const s = e;
|
|
1538
|
+
if (this._inputPipeValues = fe(this._inputPipeValues, e), this._inputPipeValues !== s) {
|
|
1539
|
+
Object.keys(e).forEach((n) => {
|
|
1542
1540
|
try {
|
|
1543
|
-
this.emit(R.Input,
|
|
1544
|
-
} catch (
|
|
1545
|
-
console.error(`Error emitting input ${
|
|
1541
|
+
this.emit(R.Input, n, e[n]);
|
|
1542
|
+
} catch (i) {
|
|
1543
|
+
console.error(`Error emitting input ${n}: ${i}`), this.emit(R.Error, `Error emitting input ${n}: ${i}`);
|
|
1546
1544
|
}
|
|
1547
1545
|
});
|
|
1548
1546
|
try {
|
|
1549
1547
|
this.emit(R.Inputs, e);
|
|
1550
|
-
} catch (
|
|
1551
|
-
console.error(`Error emitting inputs: ${
|
|
1548
|
+
} catch (n) {
|
|
1549
|
+
console.error(`Error emitting inputs: ${n}`), this.emit(R.Error, `Error emitting inputs: ${n}`);
|
|
1552
1550
|
}
|
|
1553
1551
|
}
|
|
1554
1552
|
}
|
|
@@ -1564,7 +1562,9 @@ class P extends Se.EventEmitter {
|
|
|
1564
1562
|
n[e] = s, this.setOutputs(n);
|
|
1565
1563
|
}
|
|
1566
1564
|
async setOutputs(e) {
|
|
1567
|
-
this.isInputOutputBlobSerialization && (e = await ue(e))
|
|
1565
|
+
this.isInputOutputBlobSerialization && (e = await ue(e));
|
|
1566
|
+
const s = e;
|
|
1567
|
+
this._outputPipeValues = fe(this._outputPipeValues, e), this._outputPipeValues !== s && this.sendRpc(D.OutputsUpdate, e);
|
|
1568
1568
|
}
|
|
1569
1569
|
disableNotifyOnHashUrlChange() {
|
|
1570
1570
|
window.removeEventListener("hashchange", this._onHashUrlChange);
|
|
@@ -1604,7 +1604,7 @@ class P extends Se.EventEmitter {
|
|
|
1604
1604
|
this._resolveSetupIframeServerResponse(n.params);
|
|
1605
1605
|
break;
|
|
1606
1606
|
case $.InputsUpdate:
|
|
1607
|
-
if (this._state !==
|
|
1607
|
+
if (this._state !== N.Ready)
|
|
1608
1608
|
throw "Got InputsUpdate but metaframe is not MetaframeLoadingState.Ready";
|
|
1609
1609
|
this.setInternalInputsAndNotify(n.params.inputs);
|
|
1610
1610
|
break;
|
|
@@ -1649,9 +1649,9 @@ class Ht extends Se.EventEmitter {
|
|
|
1649
1649
|
const f = this;
|
|
1650
1650
|
this.iframe = new Promise((u) => {
|
|
1651
1651
|
Ae().then(async () => {
|
|
1652
|
-
var c,
|
|
1652
|
+
var c, h, l, m;
|
|
1653
1653
|
if (f._iframe) {
|
|
1654
|
-
if ((m = (
|
|
1654
|
+
if ((m = (l = (h = (c = this._metapage) == null ? void 0 : c._definition) == null ? void 0 : h.metaframes) == null ? void 0 : l[this.id]) != null && m.allow)
|
|
1655
1655
|
f._iframe.allow = this._metapage._definition.metaframes[this.id].allow;
|
|
1656
1656
|
else {
|
|
1657
1657
|
const y = await f.getDefinition();
|
|
@@ -1702,11 +1702,13 @@ Error: ${s}`);
|
|
|
1702
1702
|
n[e] = s, this.setInputs(n);
|
|
1703
1703
|
}
|
|
1704
1704
|
setInputs(e) {
|
|
1705
|
-
|
|
1705
|
+
this.log({ m: "MetapageIFrameRpcClient", inputs: e });
|
|
1706
|
+
const s = e;
|
|
1707
|
+
if (this.inputs = fe(this.inputs, e), this.inputs === s)
|
|
1706
1708
|
return this;
|
|
1707
1709
|
if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit(g.Inputs, this.inputs), this._metapage.listenerCount(g.Inputs) > 0) {
|
|
1708
|
-
var
|
|
1709
|
-
|
|
1710
|
+
var n = {};
|
|
1711
|
+
n[this.id] = e, this._metapage.emit(g.Inputs, n);
|
|
1710
1712
|
}
|
|
1711
1713
|
return this;
|
|
1712
1714
|
}
|
|
@@ -1716,9 +1718,12 @@ Error: ${s}`);
|
|
|
1716
1718
|
n[e] = s, this.setOutputs(n);
|
|
1717
1719
|
}
|
|
1718
1720
|
setOutputs(e) {
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1721
|
+
const s = e;
|
|
1722
|
+
if (this.outputs = fe(this.outputs, e), this.outputs === s)
|
|
1723
|
+
return this;
|
|
1724
|
+
if (this.emit(g.Outputs, e), this._metapage.listenerCount(g.Outputs) > 0) {
|
|
1725
|
+
var n = {};
|
|
1726
|
+
n[this.id] = this.outputs, this._metapage.emit(g.Outputs, n);
|
|
1722
1727
|
}
|
|
1723
1728
|
}
|
|
1724
1729
|
onInputs(e) {
|
|
@@ -1829,12 +1834,12 @@ Error: ${s}`);
|
|
|
1829
1834
|
}
|
|
1830
1835
|
}
|
|
1831
1836
|
}
|
|
1832
|
-
const ke = () =>
|
|
1837
|
+
const ke = () => w({
|
|
1833
1838
|
metaframes: {
|
|
1834
1839
|
inputs: {},
|
|
1835
1840
|
outputs: {}
|
|
1836
1841
|
}
|
|
1837
|
-
}, (t) => t),
|
|
1842
|
+
}, (t) => t), hs = (t) => H(t), qt = (t, e) => !e || e === "*" || t === e ? !0 : e.endsWith("*") ? t.startsWith(e.slice(0, -1)) : e.startsWith("*") ? t.endsWith(e.slice(1)) : !1, Gt = "bcbcbc";
|
|
1838
1843
|
class L extends Ft {
|
|
1839
1844
|
static async from(e, s) {
|
|
1840
1845
|
if (e == null)
|
|
@@ -1849,7 +1854,7 @@ class L extends Ft {
|
|
|
1849
1854
|
return n.setDefinition(e);
|
|
1850
1855
|
}
|
|
1851
1856
|
constructor(e) {
|
|
1852
|
-
super(), this._state = ke(), this._metaframes =
|
|
1857
|
+
super(), this._state = ke(), this._metaframes = w({}, (s) => s), this.debug = _e(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = w({}, (s) => s), this._inputMap = {}, this._id = e && e.id ? e.id : Jt(), this._consoleBackgroundColor = e && e.color ? e.color : Gt, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframes = this.getMetaframes.bind(this), this.getState = this.getState.bind(this), this.getStateMetaframes = this.getStateMetaframes.bind(this), this.isValidJSONRpcMessage = this.isValidJSONRpcMessage.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.metaframeIds = this.metaframeIds.bind(this), this.metaframes = this.metaframes.bind(this), this.onMessage = this.onMessage.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this), this.setDefinition = this.setDefinition.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setInputStateOnlyMetaframeInputValue = this.setInputStateOnlyMetaframeInputValue.bind(this), this.setInputStateOnlyMetaframeInputMap = this.setInputStateOnlyMetaframeInputMap.bind(this), this.setInputStateOnlyMetapageInstanceInputs = this.setInputStateOnlyMetapageInstanceInputs.bind(this), this.setOutputStateOnlyMetaframeInputValue = this.setOutputStateOnlyMetaframeInputValue.bind(this), this.setOutputStateOnlyMetaframeInputMap = this.setOutputStateOnlyMetaframeInputMap.bind(this), this.setOutputStateOnlyMetapageInstanceInputs = this.setOutputStateOnlyMetapageInstanceInputs.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), Ae().then(() => {
|
|
1853
1858
|
this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
|
|
1854
1859
|
});
|
|
1855
1860
|
}
|
|
@@ -1869,7 +1874,7 @@ class L extends Ft {
|
|
|
1869
1874
|
return this._state;
|
|
1870
1875
|
}
|
|
1871
1876
|
setState(e) {
|
|
1872
|
-
this._state =
|
|
1877
|
+
this._state = w(e, (s) => s), this.getMetaframeIds().forEach((s) => {
|
|
1873
1878
|
this.getMetaframe(s).setInputs(this._state.metaframes.inputs[s]), this.getMetaframe(s).setOutputs(this._state.metaframes.outputs[s]);
|
|
1874
1879
|
}), this.listenerCount(g.State) > 0 && this.emit(g.State, this._state);
|
|
1875
1880
|
}
|
|
@@ -1883,6 +1888,8 @@ class L extends Ft {
|
|
|
1883
1888
|
if (!e.version)
|
|
1884
1889
|
throw "Metapage definition must have a version";
|
|
1885
1890
|
const n = await jt(e);
|
|
1891
|
+
if (this.isDisposed())
|
|
1892
|
+
return this;
|
|
1886
1893
|
n.metaframes && Object.keys(n.metaframes).forEach((a) => {
|
|
1887
1894
|
var r = n.metaframes[a];
|
|
1888
1895
|
if (typeof r != "object")
|
|
@@ -1893,7 +1900,7 @@ class L extends Ft {
|
|
|
1893
1900
|
const i = this._definition;
|
|
1894
1901
|
return this._definition = n, Object.keys(this._metaframes).forEach((a) => {
|
|
1895
1902
|
(!n.metaframes || !n.metaframes[a]) && this.removeMetaframe(a);
|
|
1896
|
-
}), s && (this._state =
|
|
1903
|
+
}), s && (this._state = w(s, (a) => a)), n.metaframes && Object.keys(n.metaframes).forEach((a) => {
|
|
1897
1904
|
if (!this._metaframes.hasOwnProperty(a)) {
|
|
1898
1905
|
const r = n.metaframes[a];
|
|
1899
1906
|
this.addMetaframe(a, r);
|
|
@@ -1912,26 +1919,26 @@ class L extends Ft {
|
|
|
1912
1919
|
}
|
|
1913
1920
|
}
|
|
1914
1921
|
addPipe(e, s) {
|
|
1915
|
-
this._inputMap =
|
|
1922
|
+
this._inputMap = w(this._inputMap, (n) => {
|
|
1916
1923
|
n[e] || (n[e] = []), n[e].push(s);
|
|
1917
1924
|
});
|
|
1918
1925
|
}
|
|
1919
1926
|
removeMetaframe(e) {
|
|
1920
|
-
this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes =
|
|
1927
|
+
this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes = w(this._metaframes, (s) => {
|
|
1921
1928
|
delete s[e];
|
|
1922
|
-
}), this._state =
|
|
1929
|
+
}), this._state = w(this._state, (s) => {
|
|
1923
1930
|
delete s.metaframes.inputs[e], delete s.metaframes.outputs[e];
|
|
1924
|
-
}), this._inputMap =
|
|
1931
|
+
}), this._inputMap = w(this._inputMap, (s) => {
|
|
1925
1932
|
delete s[e], Object.keys(s).forEach((n) => {
|
|
1926
1933
|
const i = s[n];
|
|
1927
1934
|
let a = 0;
|
|
1928
1935
|
for (; a <= i.length; )
|
|
1929
1936
|
i[a] && i[a].metaframe === e ? i.splice(a, 1) : a++;
|
|
1930
1937
|
});
|
|
1931
|
-
}), this._cachedInputLookupMap =
|
|
1938
|
+
}), this._cachedInputLookupMap = w({}, (s) => s));
|
|
1932
1939
|
}
|
|
1933
1940
|
removeAll() {
|
|
1934
|
-
Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes =
|
|
1941
|
+
Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes = w({}, (e) => e), this._state = ke(), this._inputMap = w({}, (e) => e), this._cachedInputLookupMap = w({}, (e) => e);
|
|
1935
1942
|
}
|
|
1936
1943
|
metaframes() {
|
|
1937
1944
|
return this.getMetaframes();
|
|
@@ -1958,7 +1965,7 @@ class L extends Ft {
|
|
|
1958
1965
|
if (!s.url)
|
|
1959
1966
|
throw this.emitErrorMessage(`Metaframe definition missing url id=${e}`), `Metaframe definition missing url id=${e}`;
|
|
1960
1967
|
var n = new Ht(this, s.url, e, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
|
|
1961
|
-
return this._metaframes =
|
|
1968
|
+
return this._metaframes = w(this._metaframes, (i) => {
|
|
1962
1969
|
i[e] = n;
|
|
1963
1970
|
}), n.addListener(g.Error, (i) => {
|
|
1964
1971
|
this.emit(g.Error, {
|
|
@@ -1981,9 +1988,9 @@ class L extends Ft {
|
|
|
1981
1988
|
this.emit(g.Error, e);
|
|
1982
1989
|
}
|
|
1983
1990
|
getInputsFromOutput(e, s) {
|
|
1984
|
-
return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap =
|
|
1985
|
-
n[e] =
|
|
1986
|
-
})), this._cachedInputLookupMap[e][s] || (this._cachedInputLookupMap =
|
|
1991
|
+
return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap = w(this._cachedInputLookupMap, (n) => {
|
|
1992
|
+
n[e] = w({}, (i) => i);
|
|
1993
|
+
})), this._cachedInputLookupMap[e][s] || (this._cachedInputLookupMap = w(this._cachedInputLookupMap, (n) => {
|
|
1987
1994
|
var i = [];
|
|
1988
1995
|
n[e][s] = i, Object.keys(this._inputMap).forEach((a) => {
|
|
1989
1996
|
a !== e && this._inputMap[a].forEach((r) => {
|
|
@@ -2054,7 +2061,7 @@ class L extends Ft {
|
|
|
2054
2061
|
this._setStateOnlyMetaframeInputMap(!0, e, s);
|
|
2055
2062
|
}
|
|
2056
2063
|
_setStateOnlyMetaframeInputValue(e, s, n, i) {
|
|
2057
|
-
this._state =
|
|
2064
|
+
this._state = w(this._state, (a) => {
|
|
2058
2065
|
if (!this._metaframes.hasOwnProperty(s))
|
|
2059
2066
|
throw `No metaframe: ${s}`;
|
|
2060
2067
|
a.metaframes || (a.metaframes = { inputs: {}, outputs: {} }), e ? a.metaframes.inputs || (a.metaframes.inputs = {}) : a.metaframes.outputs || (a.metaframes.outputs = {});
|
|
@@ -2063,7 +2070,7 @@ class L extends Ft {
|
|
|
2063
2070
|
});
|
|
2064
2071
|
}
|
|
2065
2072
|
_setStateOnlyMetaframeInputMap(e, s, n) {
|
|
2066
|
-
!n || Object.keys(n).length === 0 || (this._state =
|
|
2073
|
+
!n || Object.keys(n).length === 0 || (this._state = w(this._state, (i) => {
|
|
2067
2074
|
if (!this._metaframes.hasOwnProperty(s))
|
|
2068
2075
|
throw `No metaframe: ${s}`;
|
|
2069
2076
|
let r = e ? i.metaframes.inputs : i.metaframes.outputs;
|
|
@@ -2073,7 +2080,7 @@ class L extends Ft {
|
|
|
2073
2080
|
}));
|
|
2074
2081
|
}
|
|
2075
2082
|
_setStateOnlyMetaframes(e, s) {
|
|
2076
|
-
!s || Object.keys(s).length === 0 || (this._state =
|
|
2083
|
+
!s || Object.keys(s).length === 0 || (this._state = w(this._state, (n) => {
|
|
2077
2084
|
Object.keys(s).forEach((i) => {
|
|
2078
2085
|
var a = s[i];
|
|
2079
2086
|
if (typeof a != "object")
|
|
@@ -2117,14 +2124,14 @@ class L extends Ft {
|
|
|
2117
2124
|
var n = this._metaframes[o];
|
|
2118
2125
|
this.setOutputStateOnlyMetaframeInputMap(o, u), n.setOutputs(u);
|
|
2119
2126
|
var i = !1;
|
|
2120
|
-
const c = Object.keys(u),
|
|
2121
|
-
c.forEach((
|
|
2122
|
-
const y = this.getInputsFromOutput(o,
|
|
2123
|
-
y.length > 0 && y.forEach((
|
|
2124
|
-
|
|
2127
|
+
const c = Object.keys(u), h = {};
|
|
2128
|
+
c.forEach((l, m) => {
|
|
2129
|
+
const y = this.getInputsFromOutput(o, l);
|
|
2130
|
+
y.length > 0 && y.forEach((M) => {
|
|
2131
|
+
h[M.metaframe] || (h[M.metaframe] = {}), h[M.metaframe][M.pipe] = u[l], i = !0;
|
|
2125
2132
|
});
|
|
2126
|
-
}), i && (this.setInputStateOnlyMetapageInstanceInputs(
|
|
2127
|
-
this._metaframes[
|
|
2133
|
+
}), i && (this.setInputStateOnlyMetapageInstanceInputs(h), Object.keys(h).forEach((l) => {
|
|
2134
|
+
this._metaframes[l].setInputs(h[l]);
|
|
2128
2135
|
})), this.listenerCount(g.State) > 0 && this.emit(g.State, this._state), this.debug && n.ack({ jsonrpc: r, state: this._state });
|
|
2129
2136
|
} else
|
|
2130
2137
|
this.error(`missing metaframe=${o}`);
|
|
@@ -2138,9 +2145,9 @@ class L extends Ft {
|
|
|
2138
2145
|
break;
|
|
2139
2146
|
case D.HashParamsUpdate:
|
|
2140
2147
|
if (f) {
|
|
2141
|
-
const c = r.params,
|
|
2142
|
-
|
|
2143
|
-
|
|
2148
|
+
const c = r.params, h = new URL(f.url);
|
|
2149
|
+
h.hash = c.hash, f.url = h.href, this._definition = w(this._definition, (l) => {
|
|
2150
|
+
l.metaframes[c.metaframe].url = h.href;
|
|
2144
2151
|
}), this._emitDefinitionEvent();
|
|
2145
2152
|
}
|
|
2146
2153
|
break;
|
|
@@ -2165,7 +2172,7 @@ L.OUTPUTS = g.Outputs;
|
|
|
2165
2172
|
L.STATE = g.State;
|
|
2166
2173
|
L.deserializeInputs = Q;
|
|
2167
2174
|
L.serializeInputs = ue;
|
|
2168
|
-
const at = Qe(fetch),
|
|
2175
|
+
const at = Qe(fetch), ls = async (t, e) => {
|
|
2169
2176
|
const s = new URL(t);
|
|
2170
2177
|
s.pathname = s.pathname + (s.pathname.endsWith("/") ? "metapage.json" : "/metapage.json");
|
|
2171
2178
|
const i = await (await at(s.href, {
|
|
@@ -2195,7 +2202,7 @@ export {
|
|
|
2195
2202
|
ts as METHOD_NOT_FOUND,
|
|
2196
2203
|
P as Metaframe,
|
|
2197
2204
|
R as MetaframeEvents,
|
|
2198
|
-
|
|
2205
|
+
N as MetaframeLoadingState,
|
|
2199
2206
|
Kt as MetaframeVersionCurrent,
|
|
2200
2207
|
De as MetaframeVersionsAll,
|
|
2201
2208
|
L as Metapage,
|
|
@@ -2203,7 +2210,7 @@ export {
|
|
|
2203
2210
|
ee as MetapageHashParams,
|
|
2204
2211
|
Ht as MetapageIFrameRpcClient,
|
|
2205
2212
|
Ft as MetapageShared,
|
|
2206
|
-
|
|
2213
|
+
be as MetapageVersionCurrent,
|
|
2207
2214
|
je as MetapageVersionsAll,
|
|
2208
2215
|
Zt as PARSE_ERROR,
|
|
2209
2216
|
ut as VERSION_METAFRAME,
|
|
@@ -2216,26 +2223,26 @@ export {
|
|
|
2216
2223
|
as as generateMetaframeId,
|
|
2217
2224
|
Jt as generateMetapageId,
|
|
2218
2225
|
fs as generateNonce,
|
|
2219
|
-
|
|
2226
|
+
hs as getLibraryVersionMatching,
|
|
2220
2227
|
H as getMatchingMetapageVersion,
|
|
2221
2228
|
ps as getMetaframeDefinitionFromUrl,
|
|
2222
|
-
|
|
2229
|
+
ls as getMetapageDefinitionFromUrl,
|
|
2223
2230
|
rs as getUrlParam,
|
|
2224
2231
|
os as getUrlParamDebug,
|
|
2225
2232
|
Bt as hashCode,
|
|
2226
2233
|
Wt as intToRGB,
|
|
2227
|
-
|
|
2234
|
+
_e as isDebugFromUrlsParams,
|
|
2228
2235
|
kt as isIframe,
|
|
2229
2236
|
is as isJsonRpcId,
|
|
2230
|
-
|
|
2237
|
+
he as isPageLoaded,
|
|
2231
2238
|
Ee as log,
|
|
2232
2239
|
qt as matchPipe,
|
|
2233
2240
|
fe as merge,
|
|
2234
2241
|
us as metapageAllSha256Hash,
|
|
2235
2242
|
cs as metapageOnlyEssentailSha256Hash,
|
|
2236
2243
|
Ae as pageLoaded,
|
|
2237
|
-
|
|
2238
|
-
|
|
2244
|
+
xt as possiblyDeserializeDatarefToValue,
|
|
2245
|
+
Vt as possiblySerializeValueToDataref,
|
|
2239
2246
|
ue as serializeInputs,
|
|
2240
2247
|
rt as stringToRgb
|
|
2241
2248
|
};
|