@metapages/metapage 1.8.17 → 1.8.19
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 +404 -391
- package/dist/index.js.map +1 -1
- package/dist/metapage/Metapage.d.ts +12 -10
- package/dist/metapage/Metapage.d.ts.map +1 -1
- package/dist/metapage/v2/metaframe.d.ts +1 -0
- package/dist/metapage/v2/metaframe.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/metapage/Metapage.ts +208 -197
- package/src/metapage/v2/metaframe.ts +3 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const It = ["0.3", "0.4", "0.5", "0.6", "1", "2"], Ct = ["0.2", "0.3", "1", "2"], We = "2", Le = "2", Mi = "metaframe.json", Ii = "metapage/definition", Ci = "metapage/state",
|
|
1
|
+
const It = ["0.3", "0.4", "0.5", "0.6", "1", "2"], Ct = ["0.2", "0.3", "1", "2"], We = "2", Le = "2", Mi = "metaframe.json", Ii = "metapage/definition", Ci = "metapage/state", Vt = Ct[Ct.length - 1], En = It[It.length - 1], Mn = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, $t = (t) => {
|
|
2
2
|
if (typeof t != "string")
|
|
3
3
|
throw new TypeError("Invalid argument expected string");
|
|
4
4
|
const e = t.match(Mn);
|
|
@@ -50,7 +50,7 @@ var Wt = { exports: {} };
|
|
|
50
50
|
retryOn: []
|
|
51
51
|
};
|
|
52
52
|
return r = Object.assign(a, r), function(l, c) {
|
|
53
|
-
var d = r.retries,
|
|
53
|
+
var d = r.retries, _ = r.retryDelay, v = r.retryOn;
|
|
54
54
|
if (c && c.retries !== void 0)
|
|
55
55
|
if (s(c.retries))
|
|
56
56
|
d = c.retries;
|
|
@@ -58,7 +58,7 @@ var Wt = { exports: {} };
|
|
|
58
58
|
throw new i("retries must be a positive integer");
|
|
59
59
|
if (c && c.retryDelay !== void 0)
|
|
60
60
|
if (s(c.retryDelay) || typeof c.retryDelay == "function")
|
|
61
|
-
|
|
61
|
+
_ = c.retryDelay;
|
|
62
62
|
else
|
|
63
63
|
throw new i("retryDelay must be a positive integer or a function returning a positive integer");
|
|
64
64
|
if (c && c.retryOn)
|
|
@@ -66,42 +66,42 @@ var Wt = { exports: {} };
|
|
|
66
66
|
v = c.retryOn;
|
|
67
67
|
else
|
|
68
68
|
throw new i("retryOn property expects an array or function");
|
|
69
|
-
return new Promise(function(
|
|
69
|
+
return new Promise(function(m, S) {
|
|
70
70
|
var w = function(b) {
|
|
71
71
|
var A = typeof Request < "u" && l instanceof Request ? l.clone() : l;
|
|
72
72
|
o(A, c).then(function(E) {
|
|
73
73
|
if (Array.isArray(v) && v.indexOf(E.status) === -1)
|
|
74
|
-
|
|
74
|
+
m(E);
|
|
75
75
|
else if (typeof v == "function")
|
|
76
76
|
try {
|
|
77
|
-
return Promise.resolve(v(b, null, E)).then(function(
|
|
78
|
-
|
|
79
|
-
}).catch(
|
|
80
|
-
} catch (
|
|
81
|
-
R
|
|
77
|
+
return Promise.resolve(v(b, null, E)).then(function(R) {
|
|
78
|
+
R ? $(b, null, E) : m(E);
|
|
79
|
+
}).catch(S);
|
|
80
|
+
} catch (R) {
|
|
81
|
+
S(R);
|
|
82
82
|
}
|
|
83
83
|
else
|
|
84
|
-
b < d ? $(b, null, E) :
|
|
84
|
+
b < d ? $(b, null, E) : m(E);
|
|
85
85
|
}).catch(function(E) {
|
|
86
86
|
if (typeof v == "function")
|
|
87
87
|
try {
|
|
88
|
-
Promise.resolve(v(b, E, null)).then(function(
|
|
89
|
-
|
|
90
|
-
}).catch(function(
|
|
91
|
-
R
|
|
88
|
+
Promise.resolve(v(b, E, null)).then(function(R) {
|
|
89
|
+
R ? $(b, E, null) : S(E);
|
|
90
|
+
}).catch(function(R) {
|
|
91
|
+
S(R);
|
|
92
92
|
});
|
|
93
|
-
} catch (
|
|
94
|
-
R
|
|
93
|
+
} catch (R) {
|
|
94
|
+
S(R);
|
|
95
95
|
}
|
|
96
96
|
else
|
|
97
|
-
b < d ? $(b, E, null) :
|
|
97
|
+
b < d ? $(b, E, null) : S(E);
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
100
|
function $(b, A, E) {
|
|
101
|
-
var
|
|
101
|
+
var R = typeof _ == "function" ? _(b, A, E) : _;
|
|
102
102
|
setTimeout(function() {
|
|
103
103
|
w(++b);
|
|
104
|
-
},
|
|
104
|
+
}, R);
|
|
105
105
|
}
|
|
106
106
|
w(0);
|
|
107
107
|
});
|
|
@@ -117,7 +117,7 @@ var Wt = { exports: {} };
|
|
|
117
117
|
});
|
|
118
118
|
})(Wt);
|
|
119
119
|
var xn = Wt.exports;
|
|
120
|
-
const yt = /* @__PURE__ */ mt(xn),
|
|
120
|
+
const yt = /* @__PURE__ */ mt(xn), J = {
|
|
121
121
|
Remove: "remove",
|
|
122
122
|
Replace: "replace",
|
|
123
123
|
Add: "add"
|
|
@@ -259,7 +259,7 @@ function qt(t, e) {
|
|
|
259
259
|
} else
|
|
260
260
|
throw new Error("Please check mark() to ensure that it is a stable marker draftable function.");
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function q(t) {
|
|
263
263
|
t.copy || (t.copy = qt(t.original, t.options));
|
|
264
264
|
}
|
|
265
265
|
function Ae(t) {
|
|
@@ -353,7 +353,7 @@ function Qt(t, e, n) {
|
|
|
353
353
|
var a;
|
|
354
354
|
if (be(r)) {
|
|
355
355
|
const u = P(r);
|
|
356
|
-
|
|
356
|
+
q(u);
|
|
357
357
|
const l = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
|
|
358
358
|
Te(s ? i : t, o, l);
|
|
359
359
|
} else
|
|
@@ -404,12 +404,12 @@ function Hn(t, e, n, s, i) {
|
|
|
404
404
|
if (r.get(l.toString()) && u[l] !== o[l]) {
|
|
405
405
|
const c = e.concat([l]), d = _e(c, i);
|
|
406
406
|
n.push({
|
|
407
|
-
op:
|
|
407
|
+
op: J.Replace,
|
|
408
408
|
path: d,
|
|
409
409
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
410
410
|
value: Fe(u[l])
|
|
411
411
|
}), s.push({
|
|
412
|
-
op:
|
|
412
|
+
op: J.Replace,
|
|
413
413
|
path: d,
|
|
414
414
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
415
415
|
value: Fe(o[l])
|
|
@@ -418,7 +418,7 @@ function Hn(t, e, n, s, i) {
|
|
|
418
418
|
for (let l = o.length; l < u.length; l += 1) {
|
|
419
419
|
const c = e.concat([l]), d = _e(c, i);
|
|
420
420
|
n.push({
|
|
421
|
-
op:
|
|
421
|
+
op: J.Add,
|
|
422
422
|
path: d,
|
|
423
423
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
424
424
|
value: Fe(u[l])
|
|
@@ -429,27 +429,27 @@ function Hn(t, e, n, s, i) {
|
|
|
429
429
|
if (l) {
|
|
430
430
|
const c = e.concat(["length"]), d = _e(c, i);
|
|
431
431
|
s.push({
|
|
432
|
-
op:
|
|
432
|
+
op: J.Replace,
|
|
433
433
|
path: d,
|
|
434
434
|
value: o.length
|
|
435
435
|
});
|
|
436
436
|
} else
|
|
437
437
|
for (let c = u.length; o.length < c; c -= 1) {
|
|
438
|
-
const d = e.concat([c - 1]),
|
|
438
|
+
const d = e.concat([c - 1]), _ = _e(d, i);
|
|
439
439
|
s.push({
|
|
440
|
-
op:
|
|
441
|
-
path:
|
|
440
|
+
op: J.Remove,
|
|
441
|
+
path: _
|
|
442
442
|
});
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
function Nn({ original: t, copy: e, assignedMap: n }, s, i, o, r) {
|
|
447
447
|
n.forEach((a, u) => {
|
|
448
|
-
const l = pe(t, u), c = Fe(pe(e, u)), d = a ? Ie(t, u) ?
|
|
449
|
-
if (fe(l, c) && d ===
|
|
448
|
+
const l = pe(t, u), c = Fe(pe(e, u)), d = a ? Ie(t, u) ? J.Replace : J.Add : J.Remove;
|
|
449
|
+
if (fe(l, c) && d === J.Replace)
|
|
450
450
|
return;
|
|
451
|
-
const
|
|
452
|
-
i.push(d ===
|
|
451
|
+
const _ = s.concat(u), v = _e(_, r);
|
|
452
|
+
i.push(d === J.Remove ? { op: d, path: v } : { op: d, path: v, value: c }), o.push(d === J.Add ? { op: J.Remove, path: v } : d === J.Remove ? { op: J.Add, path: v, value: l } : { op: J.Replace, path: v, value: l });
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
455
|
function jn({ original: t, copy: e }, n, s, i, o) {
|
|
@@ -458,11 +458,11 @@ function jn({ original: t, copy: e }, n, s, i, o) {
|
|
|
458
458
|
if (!e.has(a)) {
|
|
459
459
|
const u = n.concat([r]), l = _e(u, o);
|
|
460
460
|
s.push({
|
|
461
|
-
op:
|
|
461
|
+
op: J.Remove,
|
|
462
462
|
path: l,
|
|
463
463
|
value: a
|
|
464
464
|
}), i.unshift({
|
|
465
|
-
op:
|
|
465
|
+
op: J.Add,
|
|
466
466
|
path: l,
|
|
467
467
|
value: a
|
|
468
468
|
});
|
|
@@ -472,11 +472,11 @@ function jn({ original: t, copy: e }, n, s, i, o) {
|
|
|
472
472
|
if (!t.has(a)) {
|
|
473
473
|
const u = n.concat([r]), l = _e(u, o);
|
|
474
474
|
s.push({
|
|
475
|
-
op:
|
|
475
|
+
op: J.Add,
|
|
476
476
|
path: l,
|
|
477
477
|
value: a
|
|
478
478
|
}), i.unshift({
|
|
479
|
-
op:
|
|
479
|
+
op: J.Remove,
|
|
480
480
|
path: l,
|
|
481
481
|
value: a
|
|
482
482
|
});
|
|
@@ -509,18 +509,18 @@ const ze = (t, e, n = !1) => {
|
|
|
509
509
|
},
|
|
510
510
|
set(t, e) {
|
|
511
511
|
const n = P(this), s = Y(n);
|
|
512
|
-
return (!s.has(t) || !fe(s.get(t), e)) && (
|
|
512
|
+
return (!s.has(t) || !fe(s.get(t), e)) && (q(n), ue(n), n.assignedMap.set(t, !0), n.copy.set(t, e), wt(n, t, e, $e)), this;
|
|
513
513
|
},
|
|
514
514
|
delete(t) {
|
|
515
515
|
if (!this.has(t))
|
|
516
516
|
return !1;
|
|
517
517
|
const e = P(this);
|
|
518
|
-
return
|
|
518
|
+
return q(e), ue(e), e.original.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.copy.delete(t), !0;
|
|
519
519
|
},
|
|
520
520
|
clear() {
|
|
521
521
|
const t = P(this);
|
|
522
522
|
if (this.size) {
|
|
523
|
-
|
|
523
|
+
q(t), ue(t), t.assignedMap = /* @__PURE__ */ new Map();
|
|
524
524
|
for (const [e] of t.original)
|
|
525
525
|
t.assignedMap.set(e, !1);
|
|
526
526
|
t.copy.clear();
|
|
@@ -544,7 +544,7 @@ const ze = (t, e, n = !1) => {
|
|
|
544
544
|
finalities: s.finalities,
|
|
545
545
|
options: s.options
|
|
546
546
|
});
|
|
547
|
-
return
|
|
547
|
+
return q(s), s.copy.set(t, r), r;
|
|
548
548
|
},
|
|
549
549
|
keys() {
|
|
550
550
|
return Y(P(this)).keys();
|
|
@@ -612,19 +612,19 @@ const ze = (t, e, n = !1) => {
|
|
|
612
612
|
const e = P(this);
|
|
613
613
|
if (e.setMap.has(t))
|
|
614
614
|
return !0;
|
|
615
|
-
|
|
615
|
+
q(e);
|
|
616
616
|
const n = P(t);
|
|
617
617
|
return !!(n && e.setMap.has(n.original));
|
|
618
618
|
},
|
|
619
619
|
add(t) {
|
|
620
620
|
const e = P(this);
|
|
621
|
-
return this.has(t) || (
|
|
621
|
+
return this.has(t) || (q(e), ue(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), wt(e, t, t, $e)), this;
|
|
622
622
|
},
|
|
623
623
|
delete(t) {
|
|
624
624
|
if (!this.has(t))
|
|
625
625
|
return !1;
|
|
626
626
|
const e = P(this);
|
|
627
|
-
|
|
627
|
+
q(e), ue(e);
|
|
628
628
|
const n = P(t);
|
|
629
629
|
return n && e.setMap.has(n.original) ? (e.assignedMap.set(n.original, !1), e.setMap.delete(n.original)) : (!n && e.setMap.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.setMap.delete(t));
|
|
630
630
|
},
|
|
@@ -632,14 +632,14 @@ const ze = (t, e, n = !1) => {
|
|
|
632
632
|
if (!this.size)
|
|
633
633
|
return;
|
|
634
634
|
const t = P(this);
|
|
635
|
-
|
|
635
|
+
q(t), ue(t);
|
|
636
636
|
for (const e of t.original)
|
|
637
637
|
t.assignedMap.set(e, !1);
|
|
638
638
|
t.setMap.clear();
|
|
639
639
|
},
|
|
640
640
|
values() {
|
|
641
641
|
const t = P(this);
|
|
642
|
-
|
|
642
|
+
q(t);
|
|
643
643
|
const e = t.setMap.keys();
|
|
644
644
|
return {
|
|
645
645
|
[Symbol.iterator]: () => this.values(),
|
|
@@ -648,7 +648,7 @@ const ze = (t, e, n = !1) => {
|
|
|
648
648
|
},
|
|
649
649
|
entries() {
|
|
650
650
|
const t = P(this);
|
|
651
|
-
|
|
651
|
+
q(t);
|
|
652
652
|
const e = t.setMap.keys();
|
|
653
653
|
return {
|
|
654
654
|
[Symbol.iterator]: () => this.entries(),
|
|
@@ -709,7 +709,7 @@ const ze = (t, e, n = !1) => {
|
|
|
709
709
|
if (t.options.strict && ze(u, t.options), t.finalized || !se(u, t.options))
|
|
710
710
|
return u;
|
|
711
711
|
if (u === et(t.original, e)) {
|
|
712
|
-
if (
|
|
712
|
+
if (q(t), t.copy[e] = vt({
|
|
713
713
|
original: t.original[e],
|
|
714
714
|
parentDraft: t,
|
|
715
715
|
key: t.type === 1 ? Number(e) : e,
|
|
@@ -717,7 +717,7 @@ const ze = (t, e, n = !1) => {
|
|
|
717
717
|
options: t.options
|
|
718
718
|
}), typeof r == "function") {
|
|
719
719
|
const l = P(t.copy[e]);
|
|
720
|
-
return
|
|
720
|
+
return q(l), ue(l), l.copy;
|
|
721
721
|
}
|
|
722
722
|
return t.copy[e];
|
|
723
723
|
}
|
|
@@ -734,7 +734,7 @@ const ze = (t, e, n = !1) => {
|
|
|
734
734
|
if (o != null && o.set)
|
|
735
735
|
return o.set.call(t.proxy, n), !0;
|
|
736
736
|
const r = et(Y(t), e), a = P(r);
|
|
737
|
-
return a && fe(a.original, n) ? (t.copy[e] = n, t.assignedMap = (s = t.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (fe(n, r) && (n !== void 0 || Ie(t.original, e)) || (
|
|
737
|
+
return a && fe(a.original, n) ? (t.copy[e] = n, t.assignedMap = (s = t.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (fe(n, r) && (n !== void 0 || Ie(t.original, e)) || (q(t), ue(t), Ie(t.original, e) && fe(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, wt(t, e, n, $e)), !0);
|
|
738
738
|
},
|
|
739
739
|
has(t, e) {
|
|
740
740
|
return e in Y(t);
|
|
@@ -762,7 +762,7 @@ const ze = (t, e, n = !1) => {
|
|
|
762
762
|
},
|
|
763
763
|
deleteProperty(t, e) {
|
|
764
764
|
var n;
|
|
765
|
-
return t.type === 1 ? Zt.set.call(this, t, e, void 0, t.proxy) : (et(t.original, e) !== void 0 || e in t.original ? (
|
|
765
|
+
return t.type === 1 ? Zt.set.call(this, t, e, void 0, t.proxy) : (et(t.original, e) !== void 0 || e in t.original ? (q(t), ue(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
|
|
766
766
|
}
|
|
767
767
|
};
|
|
768
768
|
function vt(t) {
|
|
@@ -782,23 +782,23 @@ function vt(t) {
|
|
|
782
782
|
const { proxy: u, revoke: l } = Proxy.revocable(r === 1 ? Object.assign([], a) : a, Zt);
|
|
783
783
|
if (i.revoke.push(l), Yt.add(u), a.proxy = u, n) {
|
|
784
784
|
const c = n;
|
|
785
|
-
c.finalities.draft.push((d,
|
|
786
|
-
var v,
|
|
787
|
-
const
|
|
785
|
+
c.finalities.draft.push((d, _) => {
|
|
786
|
+
var v, m;
|
|
787
|
+
const S = P(u);
|
|
788
788
|
let w = c.type === 3 ? c.setMap : c.copy;
|
|
789
789
|
const $ = pe(w, s), b = P($);
|
|
790
790
|
if (b) {
|
|
791
791
|
let A = b.original;
|
|
792
|
-
b.operated && (A = _t($)), at(b), ut(b, $e, d,
|
|
792
|
+
b.operated && (A = _t($)), at(b), ut(b, $e, d, _), c.options.enableAutoFreeze && (c.options.updatedValues = (v = c.options.updatedValues) !== null && v !== void 0 ? v : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(A, b.original)), Te(w, s, A);
|
|
793
793
|
}
|
|
794
|
-
(
|
|
795
|
-
A(d,
|
|
794
|
+
(m = S.callbacks) === null || m === void 0 || m.forEach((A) => {
|
|
795
|
+
A(d, _);
|
|
796
796
|
});
|
|
797
797
|
});
|
|
798
798
|
} else {
|
|
799
799
|
const c = P(u);
|
|
800
|
-
c.finalities.draft.push((d,
|
|
801
|
-
at(c), ut(c, $e, d,
|
|
800
|
+
c.finalities.draft.push((d, _) => {
|
|
801
|
+
at(c), ut(c, $e, d, _);
|
|
802
802
|
});
|
|
803
803
|
}
|
|
804
804
|
return u;
|
|
@@ -813,11 +813,11 @@ function zn(t, e, n, s, i) {
|
|
|
813
813
|
const l = u ? e[0] : r ? r.operated ? r.copy : r.original : t;
|
|
814
814
|
return r && ot(r), i && Re(l, l, r == null ? void 0 : r.options.updatedValues), [
|
|
815
815
|
l,
|
|
816
|
-
n && u ? [{ op:
|
|
817
|
-
s && u ? [{ op:
|
|
816
|
+
n && u ? [{ op: J.Replace, path: [], value: e[0] }] : n,
|
|
817
|
+
s && u ? [{ op: J.Replace, path: [], value: a }] : s
|
|
818
818
|
];
|
|
819
819
|
}
|
|
820
|
-
function
|
|
820
|
+
function Jn(t, e) {
|
|
821
821
|
var n;
|
|
822
822
|
const s = {
|
|
823
823
|
draft: [],
|
|
@@ -888,37 +888,37 @@ function Ht(t) {
|
|
|
888
888
|
throw new Error(`current() is only used for Draft, parameter: ${t}`);
|
|
889
889
|
return en(t);
|
|
890
890
|
}
|
|
891
|
-
const
|
|
891
|
+
const Gn = (t) => {
|
|
892
892
|
if (t !== void 0 && Object.prototype.toString.call(t) !== "[object Object]")
|
|
893
893
|
throw new Error(`Invalid options: ${String(t)}, 'options' should be an object.`);
|
|
894
894
|
return function e(n, s, i) {
|
|
895
895
|
var o, r, a;
|
|
896
896
|
if (typeof n == "function" && typeof s != "function")
|
|
897
|
-
return function(
|
|
898
|
-
return e(
|
|
897
|
+
return function(R, ...H) {
|
|
898
|
+
return e(R, (O) => n.call(this, O, ...H), s);
|
|
899
899
|
};
|
|
900
900
|
const u = n, l = s;
|
|
901
901
|
let c = i;
|
|
902
902
|
if (typeof s != "function" && (c = s), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
|
|
903
903
|
throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
|
|
904
904
|
c = Object.assign(Object.assign({}, t), c);
|
|
905
|
-
const d = be(u) ? Ht(u) : u,
|
|
906
|
-
for (const
|
|
907
|
-
if (typeof
|
|
908
|
-
throw new Error(`Invalid mark: ${
|
|
909
|
-
const L =
|
|
905
|
+
const d = be(u) ? Ht(u) : u, _ = Array.isArray(c.mark) ? (R, H) => {
|
|
906
|
+
for (const O of c.mark) {
|
|
907
|
+
if (typeof O != "function")
|
|
908
|
+
throw new Error(`Invalid mark: ${O}, 'mark' should be a function.`);
|
|
909
|
+
const L = O(R, H);
|
|
910
910
|
if (L)
|
|
911
911
|
return L;
|
|
912
912
|
}
|
|
913
|
-
} : c.mark, v = (o = c.enablePatches) !== null && o !== void 0 ? o : !1,
|
|
913
|
+
} : c.mark, v = (o = c.enablePatches) !== null && o !== void 0 ? o : !1, m = (r = c.strict) !== null && r !== void 0 ? r : !1, w = {
|
|
914
914
|
enableAutoFreeze: (a = c.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
915
|
-
mark:
|
|
916
|
-
strict:
|
|
915
|
+
mark: _,
|
|
916
|
+
strict: m,
|
|
917
917
|
enablePatches: v
|
|
918
918
|
};
|
|
919
919
|
if (!se(d, w) && typeof d == "object" && d !== null)
|
|
920
920
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
921
|
-
const [$, b] =
|
|
921
|
+
const [$, b] = Jn(d, w);
|
|
922
922
|
if (typeof s != "function") {
|
|
923
923
|
if (!se(d, w))
|
|
924
924
|
throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
|
|
@@ -927,43 +927,43 @@ const Vn = (t) => {
|
|
|
927
927
|
let A;
|
|
928
928
|
try {
|
|
929
929
|
A = l($);
|
|
930
|
-
} catch (
|
|
931
|
-
throw ot(P($)),
|
|
930
|
+
} catch (R) {
|
|
931
|
+
throw ot(P($)), R;
|
|
932
932
|
}
|
|
933
|
-
const E = (
|
|
933
|
+
const E = (R) => {
|
|
934
934
|
const H = P($);
|
|
935
|
-
if (!be(
|
|
936
|
-
if (
|
|
935
|
+
if (!be(R)) {
|
|
936
|
+
if (R !== void 0 && !fe(R, $) && (H != null && H.operated))
|
|
937
937
|
throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
|
|
938
|
-
const L =
|
|
938
|
+
const L = R == null ? void 0 : R[Ln];
|
|
939
939
|
if (L) {
|
|
940
940
|
const U = L[0];
|
|
941
|
-
return w.strict && typeof
|
|
941
|
+
return w.strict && typeof R == "object" && R !== null && ft({
|
|
942
942
|
rootDraft: H,
|
|
943
|
-
value:
|
|
943
|
+
value: R,
|
|
944
944
|
useRawReturn: !0
|
|
945
945
|
}), b([U]);
|
|
946
946
|
}
|
|
947
|
-
if (
|
|
948
|
-
return typeof
|
|
947
|
+
if (R !== void 0)
|
|
948
|
+
return typeof R == "object" && R !== null && ft({ rootDraft: H, value: R }), b([R]);
|
|
949
949
|
}
|
|
950
|
-
if (
|
|
950
|
+
if (R === $ || R === void 0)
|
|
951
951
|
return b([]);
|
|
952
|
-
const
|
|
953
|
-
if (w ===
|
|
954
|
-
if (
|
|
952
|
+
const O = P(R);
|
|
953
|
+
if (w === O.options) {
|
|
954
|
+
if (O.operated)
|
|
955
955
|
throw new Error("Cannot return a modified child draft.");
|
|
956
|
-
return b([Ht(
|
|
956
|
+
return b([Ht(R)]);
|
|
957
957
|
}
|
|
958
|
-
return b([
|
|
958
|
+
return b([R]);
|
|
959
959
|
};
|
|
960
|
-
return A instanceof Promise ? A.then(E, (
|
|
961
|
-
throw ot(P($)),
|
|
960
|
+
return A instanceof Promise ? A.then(E, (R) => {
|
|
961
|
+
throw ot(P($)), R;
|
|
962
962
|
}) : E(A);
|
|
963
963
|
};
|
|
964
|
-
}, C =
|
|
964
|
+
}, C = Gn();
|
|
965
965
|
Object.prototype.constructor.toString();
|
|
966
|
-
const
|
|
966
|
+
const Vn = yt(fetch), tn = async (t, e) => {
|
|
967
967
|
if (!t)
|
|
968
968
|
throw "Metapage definition null";
|
|
969
969
|
if (t.version || (t = C(t, (s) => {
|
|
@@ -972,7 +972,7 @@ const Jn = yt(fetch), tn = async (t, e) => {
|
|
|
972
972
|
throw 'Missing "version" argument';
|
|
973
973
|
if (j(e, Le) > 0)
|
|
974
974
|
try {
|
|
975
|
-
return await (await
|
|
975
|
+
return await (await Vn(`https://module.metapage.io/conversion/metapage/v${e}`, {
|
|
976
976
|
redirect: "follow",
|
|
977
977
|
retries: 3,
|
|
978
978
|
retryDelay: 1e3,
|
|
@@ -1330,10 +1330,10 @@ var x;
|
|
|
1330
1330
|
(function(t) {
|
|
1331
1331
|
t.Inputs = "inputs", t.Outputs = "outputs", t.State = "state", t.Definition = "definition", t.Error = "error", t.Warning = "warning", t.UrlHashUpdate = "urlhashupdate", t.Message = "Message";
|
|
1332
1332
|
})(x || (x = {}));
|
|
1333
|
-
var
|
|
1333
|
+
var X;
|
|
1334
1334
|
(function(t) {
|
|
1335
1335
|
t.InputsUpdate = "InputsUpdate", t.OutputsUpdate = "OutputsUpdate", t.SetupIframeClientRequest = "SetupIframeClientRequest", t.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", t.HashParamsUpdate = "HashParamsUpdate";
|
|
1336
|
-
})(
|
|
1336
|
+
})(X || (X = {}));
|
|
1337
1337
|
var me;
|
|
1338
1338
|
(function(t) {
|
|
1339
1339
|
t.InputsUpdate = "InputsUpdate", t.MessageAck = "MessageAck", t.SetupIframeServerResponse = "SetupIframeServerResponse";
|
|
@@ -1360,11 +1360,11 @@ var rn = { exports: {} };
|
|
|
1360
1360
|
function i(u, l, c) {
|
|
1361
1361
|
this.fn = u, this.context = l, this.once = c || !1;
|
|
1362
1362
|
}
|
|
1363
|
-
function o(u, l, c, d,
|
|
1363
|
+
function o(u, l, c, d, _) {
|
|
1364
1364
|
if (typeof c != "function")
|
|
1365
1365
|
throw new TypeError("The listener must be a function");
|
|
1366
|
-
var v = new i(c, d || u,
|
|
1367
|
-
return u._events[
|
|
1366
|
+
var v = new i(c, d || u, _), m = n ? n + l : l;
|
|
1367
|
+
return u._events[m] ? u._events[m].fn ? u._events[m] = [u._events[m], v] : u._events[m].push(v) : (u._events[m] = v, u._eventsCount++), u;
|
|
1368
1368
|
}
|
|
1369
1369
|
function r(u, l) {
|
|
1370
1370
|
--u._eventsCount === 0 ? u._events = new s() : delete u._events[l];
|
|
@@ -1385,17 +1385,17 @@ var rn = { exports: {} };
|
|
|
1385
1385
|
return [];
|
|
1386
1386
|
if (d.fn)
|
|
1387
1387
|
return [d.fn];
|
|
1388
|
-
for (var
|
|
1389
|
-
|
|
1390
|
-
return
|
|
1388
|
+
for (var _ = 0, v = d.length, m = new Array(v); _ < v; _++)
|
|
1389
|
+
m[_] = d[_].fn;
|
|
1390
|
+
return m;
|
|
1391
1391
|
}, a.prototype.listenerCount = function(l) {
|
|
1392
1392
|
var c = n ? n + l : l, d = this._events[c];
|
|
1393
1393
|
return d ? d.fn ? 1 : d.length : 0;
|
|
1394
|
-
}, a.prototype.emit = function(l, c, d,
|
|
1395
|
-
var
|
|
1396
|
-
if (!this._events[
|
|
1394
|
+
}, a.prototype.emit = function(l, c, d, _, v, m) {
|
|
1395
|
+
var S = n ? n + l : l;
|
|
1396
|
+
if (!this._events[S])
|
|
1397
1397
|
return !1;
|
|
1398
|
-
var w = this._events[
|
|
1398
|
+
var w = this._events[S], $ = arguments.length, b, A;
|
|
1399
1399
|
if (w.fn) {
|
|
1400
1400
|
switch (w.once && this.removeListener(l, w.fn, void 0, !0), $) {
|
|
1401
1401
|
case 1:
|
|
@@ -1405,17 +1405,17 @@ var rn = { exports: {} };
|
|
|
1405
1405
|
case 3:
|
|
1406
1406
|
return w.fn.call(w.context, c, d), !0;
|
|
1407
1407
|
case 4:
|
|
1408
|
-
return w.fn.call(w.context, c, d,
|
|
1408
|
+
return w.fn.call(w.context, c, d, _), !0;
|
|
1409
1409
|
case 5:
|
|
1410
|
-
return w.fn.call(w.context, c, d,
|
|
1410
|
+
return w.fn.call(w.context, c, d, _, v), !0;
|
|
1411
1411
|
case 6:
|
|
1412
|
-
return w.fn.call(w.context, c, d,
|
|
1412
|
+
return w.fn.call(w.context, c, d, _, v, m), !0;
|
|
1413
1413
|
}
|
|
1414
1414
|
for (A = 1, b = new Array($ - 1); A < $; A++)
|
|
1415
1415
|
b[A - 1] = arguments[A];
|
|
1416
1416
|
w.fn.apply(w.context, b);
|
|
1417
1417
|
} else {
|
|
1418
|
-
var E = w.length,
|
|
1418
|
+
var E = w.length, R;
|
|
1419
1419
|
for (A = 0; A < E; A++)
|
|
1420
1420
|
switch (w[A].once && this.removeListener(l, w[A].fn, void 0, !0), $) {
|
|
1421
1421
|
case 1:
|
|
@@ -1428,12 +1428,12 @@ var rn = { exports: {} };
|
|
|
1428
1428
|
w[A].fn.call(w[A].context, c, d);
|
|
1429
1429
|
break;
|
|
1430
1430
|
case 4:
|
|
1431
|
-
w[A].fn.call(w[A].context, c, d,
|
|
1431
|
+
w[A].fn.call(w[A].context, c, d, _);
|
|
1432
1432
|
break;
|
|
1433
1433
|
default:
|
|
1434
1434
|
if (!b)
|
|
1435
|
-
for (
|
|
1436
|
-
b[
|
|
1435
|
+
for (R = 1, b = new Array($ - 1); R < $; R++)
|
|
1436
|
+
b[R - 1] = arguments[R];
|
|
1437
1437
|
w[A].fn.apply(w[A].context, b);
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
@@ -1442,18 +1442,18 @@ var rn = { exports: {} };
|
|
|
1442
1442
|
return o(this, l, c, d, !1);
|
|
1443
1443
|
}, a.prototype.once = function(l, c, d) {
|
|
1444
1444
|
return o(this, l, c, d, !0);
|
|
1445
|
-
}, a.prototype.removeListener = function(l, c, d,
|
|
1445
|
+
}, a.prototype.removeListener = function(l, c, d, _) {
|
|
1446
1446
|
var v = n ? n + l : l;
|
|
1447
1447
|
if (!this._events[v])
|
|
1448
1448
|
return this;
|
|
1449
1449
|
if (!c)
|
|
1450
1450
|
return r(this, v), this;
|
|
1451
|
-
var
|
|
1452
|
-
if (
|
|
1453
|
-
|
|
1451
|
+
var m = this._events[v];
|
|
1452
|
+
if (m.fn)
|
|
1453
|
+
m.fn === c && (!_ || m.once) && (!d || m.context === d) && r(this, v);
|
|
1454
1454
|
else {
|
|
1455
|
-
for (var
|
|
1456
|
-
(
|
|
1455
|
+
for (var S = 0, w = [], $ = m.length; S < $; S++)
|
|
1456
|
+
(m[S].fn !== c || _ && !m[S].once || d && m[S].context !== d) && w.push(m[S]);
|
|
1457
1457
|
w.length ? this._events[v] = w.length === 1 ? w[0] : w : r(this, v);
|
|
1458
1458
|
}
|
|
1459
1459
|
return this;
|
|
@@ -1497,8 +1497,8 @@ var ys = function(t, e) {
|
|
|
1497
1497
|
}
|
|
1498
1498
|
var l = i.push(r) - 1, c = Object.keys(r).sort(s && s(r));
|
|
1499
1499
|
for (u = "", a = 0; a < c.length; a++) {
|
|
1500
|
-
var d = c[a],
|
|
1501
|
-
|
|
1500
|
+
var d = c[a], _ = o(r[d]);
|
|
1501
|
+
_ && (u && (u += ","), u += JSON.stringify(d) + ":" + _);
|
|
1502
1502
|
}
|
|
1503
1503
|
return i.splice(l, 1), "{" + u + "}";
|
|
1504
1504
|
}
|
|
@@ -1616,8 +1616,8 @@ var ks = function(t, e) {
|
|
|
1616
1616
|
}
|
|
1617
1617
|
var l = i.push(r) - 1, c = Object.keys(r).sort(s && s(r));
|
|
1618
1618
|
for (u = "", a = 0; a < c.length; a++) {
|
|
1619
|
-
var d = c[a],
|
|
1620
|
-
|
|
1619
|
+
var d = c[a], _ = o(r[d]);
|
|
1620
|
+
_ && (u && (u += ","), u += JSON.stringify(d) + ":" + _);
|
|
1621
1621
|
}
|
|
1622
1622
|
return i.splice(l, 1), "{" + u + "}";
|
|
1623
1623
|
}
|
|
@@ -1649,7 +1649,7 @@ class Ns extends Rt.EventEmitter {
|
|
|
1649
1649
|
return this._definition;
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
|
-
const
|
|
1652
|
+
const Je = (t, e) => e ? C(t, (n) => {
|
|
1653
1653
|
Object.keys(e).forEach((s) => {
|
|
1654
1654
|
e[s] === void 0 ? delete n[s] : n[s] = e[s];
|
|
1655
1655
|
});
|
|
@@ -1717,7 +1717,7 @@ class ie extends Rt.EventEmitter {
|
|
|
1717
1717
|
}
|
|
1718
1718
|
const n = this;
|
|
1719
1719
|
Xe().then(() => {
|
|
1720
|
-
this.log("pageLoaded"), window.addEventListener("message", this.onMessage), n.sendRpc(
|
|
1720
|
+
this.log("pageLoaded"), window.addEventListener("message", this.onMessage), n.sendRpc(X.SetupIframeClientRequest, {
|
|
1721
1721
|
version: ie.version
|
|
1722
1722
|
}), n._state = ae.SentSetupIframeClientRequest;
|
|
1723
1723
|
}), e && e.disableHashChangeEvent || window.addEventListener("hashchange", this._onHashUrlChange);
|
|
@@ -1725,9 +1725,9 @@ class ie extends Rt.EventEmitter {
|
|
|
1725
1725
|
_resolveSetupIframeServerResponse(e) {
|
|
1726
1726
|
if (this._state === ae.WaitingForPageLoad)
|
|
1727
1727
|
throw "Got message but page has not finished loading, we should never get in this state";
|
|
1728
|
-
(async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = hn(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 Ce(e.state.inputs) : this._inputPipeValues = e.state.inputs), this._state = ae.Ready, this.sendRpc(
|
|
1728
|
+
(async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = hn(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 Ce(e.state.inputs) : this._inputPipeValues = e.state.inputs), this._state = ae.Ready, this.sendRpc(X.SetupIframeServerResponseAck, {
|
|
1729
1729
|
version: ie.version
|
|
1730
|
-
}), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(z.Inputs, this._inputPipeValues), this.listenerCount(z.Input) > 0 && Object.keys(this._inputPipeValues).forEach((n) => this.emit(z.Input, n, this._inputPipeValues[n]))), this.emit(z.Connected), this.sendRpc(
|
|
1730
|
+
}), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(z.Inputs, this._inputPipeValues), this.listenerCount(z.Input) > 0 && Object.keys(this._inputPipeValues).forEach((n) => this.emit(z.Input, n, this._inputPipeValues[n]))), this.emit(z.Connected), this.sendRpc(X.OutputsUpdate, this._outputPipeValues)))();
|
|
1731
1731
|
}
|
|
1732
1732
|
isConnected() {
|
|
1733
1733
|
return this._state === ae.Ready;
|
|
@@ -1783,12 +1783,12 @@ class ie extends Rt.EventEmitter {
|
|
|
1783
1783
|
s[e] = n, this.setInputs(s);
|
|
1784
1784
|
}
|
|
1785
1785
|
async setInputs(e) {
|
|
1786
|
-
this.isInputOutputBlobSerialization && (e = await Ce(e)), this.sendRpc(
|
|
1786
|
+
this.isInputOutputBlobSerialization && (e = await Ce(e)), this.sendRpc(X.InputsUpdate, e);
|
|
1787
1787
|
}
|
|
1788
1788
|
async setInternalInputsAndNotify(e) {
|
|
1789
1789
|
this.isInputOutputBlobSerialization && (e = await Ce(e));
|
|
1790
1790
|
const n = e;
|
|
1791
|
-
if (this._inputPipeValues =
|
|
1791
|
+
if (this._inputPipeValues = Je(this._inputPipeValues, e), this._inputPipeValues !== n) {
|
|
1792
1792
|
Object.keys(e).forEach((s) => {
|
|
1793
1793
|
try {
|
|
1794
1794
|
this.emit(z.Input, s, e[s]);
|
|
@@ -1817,7 +1817,7 @@ class ie extends Rt.EventEmitter {
|
|
|
1817
1817
|
async setOutputs(e) {
|
|
1818
1818
|
this.isInputOutputBlobSerialization && (e = await Ke(e));
|
|
1819
1819
|
const n = e;
|
|
1820
|
-
this._outputPipeValues =
|
|
1820
|
+
this._outputPipeValues = Je(this._outputPipeValues, e), this._outputPipeValues !== n && this._state === ae.Ready && this.sendRpc(X.OutputsUpdate, e);
|
|
1821
1821
|
}
|
|
1822
1822
|
disableNotifyOnHashUrlChange() {
|
|
1823
1823
|
window.removeEventListener("hashchange", this._onHashUrlChange);
|
|
@@ -1827,7 +1827,7 @@ class ie extends Rt.EventEmitter {
|
|
|
1827
1827
|
hash: window.location.hash,
|
|
1828
1828
|
metaframe: this.id
|
|
1829
1829
|
};
|
|
1830
|
-
this.sendRpc(
|
|
1830
|
+
this.sendRpc(X.HashParamsUpdate, n);
|
|
1831
1831
|
}
|
|
1832
1832
|
sendRpc(e, n) {
|
|
1833
1833
|
if (this._isIframe) {
|
|
@@ -1921,17 +1921,17 @@ ie.MESSAGE = z.Message;
|
|
|
1921
1921
|
ie.deserializeInputs = Ce;
|
|
1922
1922
|
ie.serializeInputs = Ke;
|
|
1923
1923
|
var qe = {};
|
|
1924
|
-
const oe = "\\\\/", jt = `[^${oe}]`, le = "\\.", Fs = "\\+", zs = "\\?", Qe = "\\/",
|
|
1924
|
+
const oe = "\\\\/", jt = `[^${oe}]`, le = "\\.", Fs = "\\+", zs = "\\?", Qe = "\\/", Js = "(?=.)", mn = "[^/]", Et = `(?:${Qe}|$)`, yn = `(?:^|${Qe})`, Mt = `${le}{1,2}${Et}`, Gs = `(?!${le})`, Vs = `(?!${yn}${Mt})`, Ws = `(?!${le}{0,1}${Et})`, Ks = `(?!${Mt})`, Xs = `[^.${Qe}]`, qs = `${mn}*?`, Qs = "/", gn = {
|
|
1925
1925
|
DOT_LITERAL: le,
|
|
1926
1926
|
PLUS_LITERAL: Fs,
|
|
1927
1927
|
QMARK_LITERAL: zs,
|
|
1928
1928
|
SLASH_LITERAL: Qe,
|
|
1929
|
-
ONE_CHAR:
|
|
1929
|
+
ONE_CHAR: Js,
|
|
1930
1930
|
QMARK: mn,
|
|
1931
1931
|
END_ANCHOR: Et,
|
|
1932
1932
|
DOTS_SLASH: Mt,
|
|
1933
|
-
NO_DOT:
|
|
1934
|
-
NO_DOTS:
|
|
1933
|
+
NO_DOT: Gs,
|
|
1934
|
+
NO_DOTS: Vs,
|
|
1935
1935
|
NO_DOT_SLASH: Ws,
|
|
1936
1936
|
NO_DOTS_SLASH: Ks,
|
|
1937
1937
|
QMARK_NO_DOT: Xs,
|
|
@@ -2145,41 +2145,41 @@ const Ut = qe, {
|
|
|
2145
2145
|
/* ) */
|
|
2146
2146
|
CHAR_RIGHT_SQUARE_BRACKET: ri
|
|
2147
2147
|
/* ] */
|
|
2148
|
-
} = Ye,
|
|
2148
|
+
} = Ye, Jt = (t) => t === _n || t === Me, Gt = (t) => {
|
|
2149
2149
|
t.isPrefix !== !0 && (t.depth = t.isGlobstar ? 1 / 0 : 1);
|
|
2150
2150
|
}, oi = (t, e) => {
|
|
2151
2151
|
const n = e || {}, s = t.length - 1, i = n.parts === !0 || n.scanToEnd === !0, o = [], r = [], a = [];
|
|
2152
|
-
let u = t, l = -1, c = 0, d = 0,
|
|
2153
|
-
const U = () => l >= s, f = () => u.charCodeAt(l + 1), M = () => (H =
|
|
2152
|
+
let u = t, l = -1, c = 0, d = 0, _ = !1, v = !1, m = !1, S = !1, w = !1, $ = !1, b = !1, A = !1, E = !1, R = 0, H, O, L = { value: "", depth: 0, isGlob: !1 };
|
|
2153
|
+
const U = () => l >= s, f = () => u.charCodeAt(l + 1), M = () => (H = O, u.charCodeAt(++l));
|
|
2154
2154
|
for (; l < s; ) {
|
|
2155
|
-
|
|
2155
|
+
O = M();
|
|
2156
2156
|
let W;
|
|
2157
|
-
if (
|
|
2158
|
-
b = L.backslashes = !0,
|
|
2157
|
+
if (O === Me) {
|
|
2158
|
+
b = L.backslashes = !0, O = M(), O === it && ($ = !0);
|
|
2159
2159
|
continue;
|
|
2160
2160
|
}
|
|
2161
|
-
if ($ === !0 ||
|
|
2162
|
-
for (
|
|
2163
|
-
if (
|
|
2161
|
+
if ($ === !0 || O === it) {
|
|
2162
|
+
for (R++; U() !== !0 && (O = M()); ) {
|
|
2163
|
+
if (O === Me) {
|
|
2164
2164
|
b = L.backslashes = !0, M();
|
|
2165
2165
|
continue;
|
|
2166
2166
|
}
|
|
2167
|
-
if (
|
|
2168
|
-
|
|
2167
|
+
if (O === it) {
|
|
2168
|
+
R++;
|
|
2169
2169
|
continue;
|
|
2170
2170
|
}
|
|
2171
|
-
if ($ !== !0 &&
|
|
2172
|
-
if (
|
|
2171
|
+
if ($ !== !0 && O === st && (O = M()) === st) {
|
|
2172
|
+
if (_ = L.isBrace = !0, m = L.isGlob = !0, E = !0, i === !0)
|
|
2173
2173
|
continue;
|
|
2174
2174
|
break;
|
|
2175
2175
|
}
|
|
2176
|
-
if ($ !== !0 &&
|
|
2177
|
-
if (
|
|
2176
|
+
if ($ !== !0 && O === ti) {
|
|
2177
|
+
if (_ = L.isBrace = !0, m = L.isGlob = !0, E = !0, i === !0)
|
|
2178
2178
|
continue;
|
|
2179
2179
|
break;
|
|
2180
2180
|
}
|
|
2181
|
-
if (
|
|
2182
|
-
$ = !1,
|
|
2181
|
+
if (O === ii && (R--, R === 0)) {
|
|
2182
|
+
$ = !1, _ = L.isBrace = !0, E = !0;
|
|
2183
2183
|
break;
|
|
2184
2184
|
}
|
|
2185
2185
|
}
|
|
@@ -2187,7 +2187,7 @@ const Ut = qe, {
|
|
|
2187
2187
|
continue;
|
|
2188
2188
|
break;
|
|
2189
2189
|
}
|
|
2190
|
-
if (
|
|
2190
|
+
if (O === _n) {
|
|
2191
2191
|
if (o.push(l), r.push(L), L = { value: "", depth: 0, isGlob: !1 }, E === !0)
|
|
2192
2192
|
continue;
|
|
2193
2193
|
if (H === st && l === c + 1) {
|
|
@@ -2197,15 +2197,15 @@ const Ut = qe, {
|
|
|
2197
2197
|
d = l + 1;
|
|
2198
2198
|
continue;
|
|
2199
2199
|
}
|
|
2200
|
-
if (n.noext !== !0 && (
|
|
2201
|
-
if (
|
|
2202
|
-
for (; U() !== !0 && (
|
|
2203
|
-
if (
|
|
2204
|
-
b = L.backslashes = !0,
|
|
2200
|
+
if (n.noext !== !0 && (O === si || O === ei || O === nt || O === Ft || O === Bt) === !0 && f() === rt) {
|
|
2201
|
+
if (m = L.isGlob = !0, S = L.isExtglob = !0, E = !0, i === !0) {
|
|
2202
|
+
for (; U() !== !0 && (O = M()); ) {
|
|
2203
|
+
if (O === Me) {
|
|
2204
|
+
b = L.backslashes = !0, O = M();
|
|
2205
2205
|
continue;
|
|
2206
2206
|
}
|
|
2207
|
-
if (
|
|
2208
|
-
|
|
2207
|
+
if (O === zt) {
|
|
2208
|
+
m = L.isGlob = !0, E = !0;
|
|
2209
2209
|
break;
|
|
2210
2210
|
}
|
|
2211
2211
|
}
|
|
@@ -2213,40 +2213,40 @@ const Ut = qe, {
|
|
|
2213
2213
|
}
|
|
2214
2214
|
break;
|
|
2215
2215
|
}
|
|
2216
|
-
if (
|
|
2217
|
-
if (H === nt && (w = L.isGlobstar = !0),
|
|
2216
|
+
if (O === nt) {
|
|
2217
|
+
if (H === nt && (w = L.isGlobstar = !0), m = L.isGlob = !0, E = !0, i === !0)
|
|
2218
2218
|
continue;
|
|
2219
2219
|
break;
|
|
2220
2220
|
}
|
|
2221
|
-
if (
|
|
2222
|
-
if (
|
|
2221
|
+
if (O === Ft) {
|
|
2222
|
+
if (m = L.isGlob = !0, E = !0, i === !0)
|
|
2223
2223
|
continue;
|
|
2224
2224
|
break;
|
|
2225
2225
|
}
|
|
2226
|
-
if (
|
|
2226
|
+
if (O === ni)
|
|
2227
2227
|
for (; U() !== !0 && (W = M()); ) {
|
|
2228
2228
|
if (W === Me) {
|
|
2229
2229
|
b = L.backslashes = !0, M();
|
|
2230
2230
|
continue;
|
|
2231
2231
|
}
|
|
2232
2232
|
if (W === ri) {
|
|
2233
|
-
if (v = L.isBracket = !0,
|
|
2233
|
+
if (v = L.isBracket = !0, m = L.isGlob = !0, E = !0, i === !0)
|
|
2234
2234
|
continue;
|
|
2235
2235
|
break;
|
|
2236
2236
|
}
|
|
2237
2237
|
}
|
|
2238
|
-
if (n.nonegate !== !0 &&
|
|
2238
|
+
if (n.nonegate !== !0 && O === Bt && l === c) {
|
|
2239
2239
|
A = L.negated = !0, c++;
|
|
2240
2240
|
continue;
|
|
2241
2241
|
}
|
|
2242
|
-
if (n.noparen !== !0 &&
|
|
2243
|
-
if (
|
|
2244
|
-
for (; U() !== !0 && (
|
|
2245
|
-
if (
|
|
2246
|
-
b = L.backslashes = !0,
|
|
2242
|
+
if (n.noparen !== !0 && O === rt) {
|
|
2243
|
+
if (m = L.isGlob = !0, i === !0) {
|
|
2244
|
+
for (; U() !== !0 && (O = M()); ) {
|
|
2245
|
+
if (O === rt) {
|
|
2246
|
+
b = L.backslashes = !0, O = M();
|
|
2247
2247
|
continue;
|
|
2248
2248
|
}
|
|
2249
|
-
if (
|
|
2249
|
+
if (O === zt) {
|
|
2250
2250
|
E = !0;
|
|
2251
2251
|
break;
|
|
2252
2252
|
}
|
|
@@ -2255,50 +2255,50 @@ const Ut = qe, {
|
|
|
2255
2255
|
}
|
|
2256
2256
|
break;
|
|
2257
2257
|
}
|
|
2258
|
-
if (
|
|
2258
|
+
if (m === !0) {
|
|
2259
2259
|
if (E = !0, i === !0)
|
|
2260
2260
|
continue;
|
|
2261
2261
|
break;
|
|
2262
2262
|
}
|
|
2263
2263
|
}
|
|
2264
|
-
n.noext === !0 && (
|
|
2264
|
+
n.noext === !0 && (S = !1, m = !1);
|
|
2265
2265
|
let I = u, B = "", h = "";
|
|
2266
|
-
c > 0 && (B = u.slice(0, c), u = u.slice(c), d -= c), I &&
|
|
2266
|
+
c > 0 && (B = u.slice(0, c), u = u.slice(c), d -= c), I && m === !0 && d > 0 ? (I = u.slice(0, d), h = u.slice(d)) : m === !0 ? (I = "", h = u) : I = u, I && I !== "" && I !== "/" && I !== u && Jt(I.charCodeAt(I.length - 1)) && (I = I.slice(0, -1)), n.unescape === !0 && (h && (h = Ut.removeBackslashes(h)), I && b === !0 && (I = Ut.removeBackslashes(I)));
|
|
2267
2267
|
const p = {
|
|
2268
2268
|
prefix: B,
|
|
2269
2269
|
input: t,
|
|
2270
2270
|
start: c,
|
|
2271
2271
|
base: I,
|
|
2272
2272
|
glob: h,
|
|
2273
|
-
isBrace:
|
|
2273
|
+
isBrace: _,
|
|
2274
2274
|
isBracket: v,
|
|
2275
|
-
isGlob:
|
|
2276
|
-
isExtglob:
|
|
2275
|
+
isGlob: m,
|
|
2276
|
+
isExtglob: S,
|
|
2277
2277
|
isGlobstar: w,
|
|
2278
2278
|
negated: A
|
|
2279
2279
|
};
|
|
2280
|
-
if (n.tokens === !0 && (p.maxDepth = 0,
|
|
2280
|
+
if (n.tokens === !0 && (p.maxDepth = 0, Jt(O) || r.push(L), p.tokens = r), n.parts === !0 || n.tokens === !0) {
|
|
2281
2281
|
let W;
|
|
2282
2282
|
for (let k = 0; k < o.length; k++) {
|
|
2283
2283
|
const re = W ? W + 1 : c, ce = o[k], Q = t.slice(re, ce);
|
|
2284
|
-
n.tokens && (k === 0 && c !== 0 ? (r[k].isPrefix = !0, r[k].value = B) : r[k].value = Q,
|
|
2284
|
+
n.tokens && (k === 0 && c !== 0 ? (r[k].isPrefix = !0, r[k].value = B) : r[k].value = Q, Gt(r[k]), p.maxDepth += r[k].depth), (k !== 0 || Q !== "") && a.push(Q), W = ce;
|
|
2285
2285
|
}
|
|
2286
2286
|
if (W && W + 1 < t.length) {
|
|
2287
2287
|
const k = t.slice(W + 1);
|
|
2288
|
-
a.push(k), n.tokens && (r[r.length - 1].value = k,
|
|
2288
|
+
a.push(k), n.tokens && (r[r.length - 1].value = k, Gt(r[r.length - 1]), p.maxDepth += r[r.length - 1].depth);
|
|
2289
2289
|
}
|
|
2290
2290
|
p.slashes = o, p.parts = a;
|
|
2291
2291
|
}
|
|
2292
2292
|
return p;
|
|
2293
2293
|
};
|
|
2294
2294
|
var ai = oi;
|
|
2295
|
-
const
|
|
2296
|
-
MAX_LENGTH:
|
|
2295
|
+
const Ge = Ye, ne = qe, {
|
|
2296
|
+
MAX_LENGTH: Ve,
|
|
2297
2297
|
POSIX_REGEX_SOURCE: ui,
|
|
2298
2298
|
REGEX_NON_SPECIAL_CHARS: ci,
|
|
2299
2299
|
REGEX_SPECIAL_CHARS_BACKREF: li,
|
|
2300
2300
|
REPLACEMENTS: bn
|
|
2301
|
-
} =
|
|
2301
|
+
} = Ge, fi = (t, e) => {
|
|
2302
2302
|
if (typeof e.expandRange == "function")
|
|
2303
2303
|
return e.expandRange(...t, e);
|
|
2304
2304
|
t.sort();
|
|
@@ -2313,24 +2313,24 @@ const Ve = Ye, ne = qe, {
|
|
|
2313
2313
|
if (typeof t != "string")
|
|
2314
2314
|
throw new TypeError("Expected a string");
|
|
2315
2315
|
t = bn[t] || t;
|
|
2316
|
-
const n = { ...e }, s = typeof n.maxLength == "number" ? Math.min(
|
|
2316
|
+
const n = { ...e }, s = typeof n.maxLength == "number" ? Math.min(Ve, n.maxLength) : Ve;
|
|
2317
2317
|
let i = t.length;
|
|
2318
2318
|
if (i > s)
|
|
2319
2319
|
throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${s}`);
|
|
2320
|
-
const o = { type: "bos", value: "", output: n.prepend || "" }, r = [o], a = n.capture ? "" : "?:", u =
|
|
2320
|
+
const o = { type: "bos", value: "", output: n.prepend || "" }, r = [o], a = n.capture ? "" : "?:", u = Ge.globChars(n.windows), l = Ge.extglobChars(u), {
|
|
2321
2321
|
DOT_LITERAL: c,
|
|
2322
2322
|
PLUS_LITERAL: d,
|
|
2323
|
-
SLASH_LITERAL:
|
|
2323
|
+
SLASH_LITERAL: _,
|
|
2324
2324
|
ONE_CHAR: v,
|
|
2325
|
-
DOTS_SLASH:
|
|
2326
|
-
NO_DOT:
|
|
2325
|
+
DOTS_SLASH: m,
|
|
2326
|
+
NO_DOT: S,
|
|
2327
2327
|
NO_DOT_SLASH: w,
|
|
2328
2328
|
NO_DOTS_SLASH: $,
|
|
2329
2329
|
QMARK: b,
|
|
2330
2330
|
QMARK_NO_DOT: A,
|
|
2331
2331
|
STAR: E,
|
|
2332
|
-
START_ANCHOR:
|
|
2333
|
-
} = u, H = (
|
|
2332
|
+
START_ANCHOR: R
|
|
2333
|
+
} = u, H = (g) => `(${a}(?:(?!${R}${g.dot ? m : c}).)*?)`, O = n.dot ? "" : S, L = n.dot ? b : A;
|
|
2334
2334
|
let U = n.bash === !0 ? H(n) : E;
|
|
2335
2335
|
n.capture && (U = `(${U})`), typeof n.noext == "boolean" && (n.noextglob = n.noext);
|
|
2336
2336
|
const f = {
|
|
@@ -2353,54 +2353,54 @@ const Ve = Ye, ne = qe, {
|
|
|
2353
2353
|
t = ne.removePrefix(t, f), i = t.length;
|
|
2354
2354
|
const M = [], I = [], B = [];
|
|
2355
2355
|
let h = o, p;
|
|
2356
|
-
const W = () => f.index === i - 1, k = f.peek = (
|
|
2357
|
-
f.consumed +=
|
|
2358
|
-
}, De = (
|
|
2359
|
-
f.output +=
|
|
2356
|
+
const W = () => f.index === i - 1, k = f.peek = (g = 1) => t[f.index + g], re = f.advance = () => t[++f.index], ce = () => t.slice(f.index + 1), Q = (g = "", N = 0) => {
|
|
2357
|
+
f.consumed += g, f.index += N;
|
|
2358
|
+
}, De = (g) => {
|
|
2359
|
+
f.output += g.output != null ? g.output : g.value, Q(g.value);
|
|
2360
2360
|
}, Sn = () => {
|
|
2361
|
-
let
|
|
2361
|
+
let g = 1;
|
|
2362
2362
|
for (; k() === "!" && (k(2) !== "(" || k(3) === "?"); )
|
|
2363
|
-
re(), f.start++,
|
|
2364
|
-
return
|
|
2365
|
-
}, ke = (
|
|
2366
|
-
f[
|
|
2367
|
-
}, ye = (
|
|
2368
|
-
f[
|
|
2369
|
-
}, T = (
|
|
2363
|
+
re(), f.start++, g++;
|
|
2364
|
+
return g % 2 === 0 ? !1 : (f.negated = !0, f.start++, !0);
|
|
2365
|
+
}, ke = (g) => {
|
|
2366
|
+
f[g]++, B.push(g);
|
|
2367
|
+
}, ye = (g) => {
|
|
2368
|
+
f[g]--, B.pop();
|
|
2369
|
+
}, T = (g) => {
|
|
2370
2370
|
if (h.type === "globstar") {
|
|
2371
|
-
const N = f.braces > 0 && (
|
|
2372
|
-
|
|
2371
|
+
const N = f.braces > 0 && (g.type === "comma" || g.type === "brace"), y = g.extglob === !0 || M.length && (g.type === "pipe" || g.type === "paren");
|
|
2372
|
+
g.type !== "slash" && g.type !== "paren" && !N && !y && (f.output = f.output.slice(0, -h.output.length), h.type = "star", h.value = "*", h.output = U, f.output += h.output);
|
|
2373
2373
|
}
|
|
2374
|
-
if (M.length &&
|
|
2375
|
-
h.value +=
|
|
2374
|
+
if (M.length && g.type !== "paren" && !l[g.value] && (M[M.length - 1].inner += g.value), (g.value || g.output) && De(g), h && h.type === "text" && g.type === "text") {
|
|
2375
|
+
h.value += g.value, h.output = (h.output || "") + g.value;
|
|
2376
2376
|
return;
|
|
2377
2377
|
}
|
|
2378
|
-
|
|
2379
|
-
}, He = (
|
|
2380
|
-
const
|
|
2381
|
-
|
|
2382
|
-
const D = (n.capture ? "(" : "") +
|
|
2383
|
-
ke("parens"), T({ type:
|
|
2384
|
-
}, An = (
|
|
2385
|
-
let N =
|
|
2386
|
-
if (
|
|
2387
|
-
let
|
|
2388
|
-
|
|
2378
|
+
g.prev = h, r.push(g), h = g;
|
|
2379
|
+
}, He = (g, N) => {
|
|
2380
|
+
const y = { ...l[N], conditions: 1, inner: "" };
|
|
2381
|
+
y.prev = h, y.parens = f.parens, y.output = f.output;
|
|
2382
|
+
const D = (n.capture ? "(" : "") + y.open;
|
|
2383
|
+
ke("parens"), T({ type: g, value: N, output: f.output ? "" : v }), T({ type: "paren", extglob: !0, value: re(), output: D }), M.push(y);
|
|
2384
|
+
}, An = (g) => {
|
|
2385
|
+
let N = g.close + (n.capture ? ")" : "");
|
|
2386
|
+
if (g.type === "negate") {
|
|
2387
|
+
let y = U;
|
|
2388
|
+
g.inner && g.inner.length > 1 && g.inner.includes("/") && (y = H(n)), (y !== U || W() || /^\)+$/.test(ce())) && (N = g.close = `)$))${y}`), g.prev.type === "bos" && W() && (f.negatedExtglob = !0);
|
|
2389
2389
|
}
|
|
2390
2390
|
T({ type: "paren", extglob: !0, value: p, output: N }), ye("parens");
|
|
2391
2391
|
};
|
|
2392
2392
|
if (n.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(t)) {
|
|
2393
|
-
let
|
|
2394
|
-
return
|
|
2393
|
+
let g = !1, N = t.replace(li, (y, D, F, K, V, Ze) => K === "\\" ? (g = !0, y) : K === "?" ? D ? D + K + (V ? b.repeat(V.length) : "") : Ze === 0 ? L + (V ? b.repeat(V.length) : "") : b.repeat(F.length) : K === "." ? c.repeat(F.length) : K === "*" ? D ? D + K + (V ? U : "") : U : D ? y : `\\${y}`);
|
|
2394
|
+
return g === !0 && (n.unescape === !0 ? N = N.replace(/\\/g, "") : N = N.replace(/\\+/g, (y) => y.length % 2 === 0 ? "\\\\" : y ? "\\" : "")), N === t && n.contains === !0 ? (f.output = t, f) : (f.output = ne.wrapOutput(N, f, e), f);
|
|
2395
2395
|
}
|
|
2396
2396
|
for (; !W(); ) {
|
|
2397
2397
|
if (p = re(), p === "\0")
|
|
2398
2398
|
continue;
|
|
2399
2399
|
if (p === "\\") {
|
|
2400
|
-
const
|
|
2401
|
-
if (
|
|
2400
|
+
const y = k();
|
|
2401
|
+
if (y === "/" && n.bash !== !0 || y === "." || y === ";")
|
|
2402
2402
|
continue;
|
|
2403
|
-
if (!
|
|
2403
|
+
if (!y) {
|
|
2404
2404
|
p += "\\", T({ type: "text", value: p });
|
|
2405
2405
|
continue;
|
|
2406
2406
|
}
|
|
@@ -2413,11 +2413,11 @@ const Ve = Ye, ne = qe, {
|
|
|
2413
2413
|
}
|
|
2414
2414
|
if (f.brackets > 0 && (p !== "]" || h.value === "[" || h.value === "[^")) {
|
|
2415
2415
|
if (n.posix !== !1 && p === ":") {
|
|
2416
|
-
const
|
|
2417
|
-
if (
|
|
2418
|
-
const D = h.value.lastIndexOf("["), F = h.value.slice(0, D), K = h.value.slice(D + 2),
|
|
2419
|
-
if (
|
|
2420
|
-
h.value = F +
|
|
2416
|
+
const y = h.value.slice(1);
|
|
2417
|
+
if (y.includes("[") && (h.posix = !0, y.includes(":"))) {
|
|
2418
|
+
const D = h.value.lastIndexOf("["), F = h.value.slice(0, D), K = h.value.slice(D + 2), V = ui[K];
|
|
2419
|
+
if (V) {
|
|
2420
|
+
h.value = F + V, f.backtrack = !0, re(), !o.output && r.indexOf(h) === 1 && (o.output = v);
|
|
2421
2421
|
continue;
|
|
2422
2422
|
}
|
|
2423
2423
|
}
|
|
@@ -2440,8 +2440,8 @@ const Ve = Ye, ne = qe, {
|
|
|
2440
2440
|
if (p === ")") {
|
|
2441
2441
|
if (f.parens === 0 && n.strictBrackets === !0)
|
|
2442
2442
|
throw new SyntaxError(ve("opening", "("));
|
|
2443
|
-
const
|
|
2444
|
-
if (
|
|
2443
|
+
const y = M[M.length - 1];
|
|
2444
|
+
if (y && f.parens === y.parens + 1) {
|
|
2445
2445
|
An(M.pop());
|
|
2446
2446
|
continue;
|
|
2447
2447
|
}
|
|
@@ -2470,8 +2470,8 @@ const Ve = Ye, ne = qe, {
|
|
|
2470
2470
|
continue;
|
|
2471
2471
|
}
|
|
2472
2472
|
ye("brackets");
|
|
2473
|
-
const
|
|
2474
|
-
if (h.posix !== !0 &&
|
|
2473
|
+
const y = h.value.slice(1);
|
|
2474
|
+
if (h.posix !== !0 && y[0] === "^" && !y.includes("/") && (p = `/${p}`), h.value += p, De({ value: p }), n.literalBrackets === !1 || ne.hasRegexChars(y))
|
|
2475
2475
|
continue;
|
|
2476
2476
|
const D = ne.escapeRegex(h.value);
|
|
2477
2477
|
if (f.output = f.output.slice(0, -h.value.length), n.literalBrackets === !0) {
|
|
@@ -2483,34 +2483,34 @@ const Ve = Ye, ne = qe, {
|
|
|
2483
2483
|
}
|
|
2484
2484
|
if (p === "{" && n.nobrace !== !0) {
|
|
2485
2485
|
ke("braces");
|
|
2486
|
-
const
|
|
2486
|
+
const y = {
|
|
2487
2487
|
type: "brace",
|
|
2488
2488
|
value: p,
|
|
2489
2489
|
output: "(",
|
|
2490
2490
|
outputIndex: f.output.length,
|
|
2491
2491
|
tokensIndex: f.tokens.length
|
|
2492
2492
|
};
|
|
2493
|
-
I.push(
|
|
2493
|
+
I.push(y), T(y);
|
|
2494
2494
|
continue;
|
|
2495
2495
|
}
|
|
2496
2496
|
if (p === "}") {
|
|
2497
|
-
const
|
|
2498
|
-
if (n.nobrace === !0 || !
|
|
2497
|
+
const y = I[I.length - 1];
|
|
2498
|
+
if (n.nobrace === !0 || !y) {
|
|
2499
2499
|
T({ type: "text", value: p, output: p });
|
|
2500
2500
|
continue;
|
|
2501
2501
|
}
|
|
2502
2502
|
let D = ")";
|
|
2503
|
-
if (
|
|
2503
|
+
if (y.dots === !0) {
|
|
2504
2504
|
const F = r.slice(), K = [];
|
|
2505
|
-
for (let
|
|
2506
|
-
F[
|
|
2505
|
+
for (let V = F.length - 1; V >= 0 && (r.pop(), F[V].type !== "brace"); V--)
|
|
2506
|
+
F[V].type !== "dots" && K.unshift(F[V].value);
|
|
2507
2507
|
D = fi(K, n), f.backtrack = !0;
|
|
2508
2508
|
}
|
|
2509
|
-
if (
|
|
2510
|
-
const F = f.output.slice(0,
|
|
2511
|
-
|
|
2512
|
-
for (const
|
|
2513
|
-
f.output +=
|
|
2509
|
+
if (y.comma !== !0 && y.dots !== !0) {
|
|
2510
|
+
const F = f.output.slice(0, y.outputIndex), K = f.tokens.slice(y.tokensIndex);
|
|
2511
|
+
y.value = y.output = "\\{", p = D = "\\}", f.output = F;
|
|
2512
|
+
for (const V of K)
|
|
2513
|
+
f.output += V.output || V.value;
|
|
2514
2514
|
}
|
|
2515
2515
|
T({ type: "brace", value: p, output: D }), ye("braces"), I.pop();
|
|
2516
2516
|
continue;
|
|
@@ -2520,9 +2520,9 @@ const Ve = Ye, ne = qe, {
|
|
|
2520
2520
|
continue;
|
|
2521
2521
|
}
|
|
2522
2522
|
if (p === ",") {
|
|
2523
|
-
let
|
|
2523
|
+
let y = p;
|
|
2524
2524
|
const D = I[I.length - 1];
|
|
2525
|
-
D && B[B.length - 1] === "braces" && (D.comma = !0,
|
|
2525
|
+
D && B[B.length - 1] === "braces" && (D.comma = !0, y = "|"), T({ type: "comma", value: p, output: y });
|
|
2526
2526
|
continue;
|
|
2527
2527
|
}
|
|
2528
2528
|
if (p === "/") {
|
|
@@ -2530,14 +2530,14 @@ const Ve = Ye, ne = qe, {
|
|
|
2530
2530
|
f.start = f.index + 1, f.consumed = "", f.output = "", r.pop(), h = o;
|
|
2531
2531
|
continue;
|
|
2532
2532
|
}
|
|
2533
|
-
T({ type: "slash", value: p, output:
|
|
2533
|
+
T({ type: "slash", value: p, output: _ });
|
|
2534
2534
|
continue;
|
|
2535
2535
|
}
|
|
2536
2536
|
if (p === ".") {
|
|
2537
2537
|
if (f.braces > 0 && h.type === "dot") {
|
|
2538
2538
|
h.value === "." && (h.output = c);
|
|
2539
|
-
const
|
|
2540
|
-
h.type = "dots", h.output += p, h.value += p,
|
|
2539
|
+
const y = I[I.length - 1];
|
|
2540
|
+
h.type = "dots", h.output += p, h.value += p, y.dots = !0;
|
|
2541
2541
|
continue;
|
|
2542
2542
|
}
|
|
2543
2543
|
if (f.braces + f.parens === 0 && h.type !== "bos" && h.type !== "slash") {
|
|
@@ -2603,16 +2603,16 @@ const Ve = Ye, ne = qe, {
|
|
|
2603
2603
|
}
|
|
2604
2604
|
if (p !== "*") {
|
|
2605
2605
|
(p === "$" || p === "^") && (p = `\\${p}`);
|
|
2606
|
-
const
|
|
2607
|
-
|
|
2606
|
+
const y = ci.exec(ce());
|
|
2607
|
+
y && (p += y[0], f.index += y[0].length), T({ type: "text", value: p });
|
|
2608
2608
|
continue;
|
|
2609
2609
|
}
|
|
2610
2610
|
if (h && (h.type === "globstar" || h.star === !0)) {
|
|
2611
2611
|
h.type = "star", h.star = !0, h.value += p, h.output = U, f.backtrack = !0, f.globstar = !0, Q(p);
|
|
2612
2612
|
continue;
|
|
2613
2613
|
}
|
|
2614
|
-
let
|
|
2615
|
-
if (n.noextglob !== !0 && /^\([^?]/.test(
|
|
2614
|
+
let g = ce();
|
|
2615
|
+
if (n.noextglob !== !0 && /^\([^?]/.test(g)) {
|
|
2616
2616
|
He("star", p);
|
|
2617
2617
|
continue;
|
|
2618
2618
|
}
|
|
@@ -2621,37 +2621,37 @@ const Ve = Ye, ne = qe, {
|
|
|
2621
2621
|
Q(p);
|
|
2622
2622
|
continue;
|
|
2623
2623
|
}
|
|
2624
|
-
const
|
|
2625
|
-
if (n.bash === !0 && (!F ||
|
|
2624
|
+
const y = h.prev, D = y.prev, F = y.type === "slash" || y.type === "bos", K = D && (D.type === "star" || D.type === "globstar");
|
|
2625
|
+
if (n.bash === !0 && (!F || g[0] && g[0] !== "/")) {
|
|
2626
2626
|
T({ type: "star", value: p, output: "" });
|
|
2627
2627
|
continue;
|
|
2628
2628
|
}
|
|
2629
|
-
const
|
|
2630
|
-
if (!F &&
|
|
2629
|
+
const V = f.braces > 0 && (y.type === "comma" || y.type === "brace"), Ze = M.length && (y.type === "pipe" || y.type === "paren");
|
|
2630
|
+
if (!F && y.type !== "paren" && !V && !Ze) {
|
|
2631
2631
|
T({ type: "star", value: p, output: "" });
|
|
2632
2632
|
continue;
|
|
2633
2633
|
}
|
|
2634
|
-
for (;
|
|
2634
|
+
for (; g.slice(0, 3) === "/**"; ) {
|
|
2635
2635
|
const Ne = t[f.index + 4];
|
|
2636
2636
|
if (Ne && Ne !== "/")
|
|
2637
2637
|
break;
|
|
2638
|
-
|
|
2638
|
+
g = g.slice(3), Q("/**", 3);
|
|
2639
2639
|
}
|
|
2640
|
-
if (
|
|
2640
|
+
if (y.type === "bos" && W()) {
|
|
2641
2641
|
h.type = "globstar", h.value += p, h.output = H(n), f.output = h.output, f.globstar = !0, Q(p);
|
|
2642
2642
|
continue;
|
|
2643
2643
|
}
|
|
2644
|
-
if (
|
|
2645
|
-
f.output = f.output.slice(0, -(
|
|
2644
|
+
if (y.type === "slash" && y.prev.type !== "bos" && !K && W()) {
|
|
2645
|
+
f.output = f.output.slice(0, -(y.output + h.output).length), y.output = `(?:${y.output}`, h.type = "globstar", h.output = H(n) + (n.strictSlashes ? ")" : "|$)"), h.value += p, f.globstar = !0, f.output += y.output + h.output, Q(p);
|
|
2646
2646
|
continue;
|
|
2647
2647
|
}
|
|
2648
|
-
if (
|
|
2649
|
-
const Ne =
|
|
2650
|
-
f.output = f.output.slice(0, -(
|
|
2648
|
+
if (y.type === "slash" && y.prev.type !== "bos" && g[0] === "/") {
|
|
2649
|
+
const Ne = g[1] !== void 0 ? "|$" : "";
|
|
2650
|
+
f.output = f.output.slice(0, -(y.output + h.output).length), y.output = `(?:${y.output}`, h.type = "globstar", h.output = `${H(n)}${_}|${_}${Ne})`, h.value += p, f.output += y.output + h.output, f.globstar = !0, Q(p + re()), T({ type: "slash", value: "/", output: "" });
|
|
2651
2651
|
continue;
|
|
2652
2652
|
}
|
|
2653
|
-
if (
|
|
2654
|
-
h.type = "globstar", h.value += p, h.output = `(?:^|${
|
|
2653
|
+
if (y.type === "bos" && g[0] === "/") {
|
|
2654
|
+
h.type = "globstar", h.value += p, h.output = `(?:^|${_}|${H(n)}${_})`, f.output = h.output, f.globstar = !0, Q(p + re()), T({ type: "slash", value: "/", output: "" });
|
|
2655
2655
|
continue;
|
|
2656
2656
|
}
|
|
2657
2657
|
f.output = f.output.slice(0, -h.output.length), h.type = "globstar", h.output = H(n), h.value += p, f.output += h.output, f.globstar = !0, Q(p);
|
|
@@ -2659,14 +2659,14 @@ const Ve = Ye, ne = qe, {
|
|
|
2659
2659
|
}
|
|
2660
2660
|
const N = { type: "star", value: p, output: U };
|
|
2661
2661
|
if (n.bash === !0) {
|
|
2662
|
-
N.output = ".*?", (h.type === "bos" || h.type === "slash") && (N.output =
|
|
2662
|
+
N.output = ".*?", (h.type === "bos" || h.type === "slash") && (N.output = O + N.output), T(N);
|
|
2663
2663
|
continue;
|
|
2664
2664
|
}
|
|
2665
2665
|
if (h && (h.type === "bracket" || h.type === "paren") && n.regex === !0) {
|
|
2666
2666
|
N.output = p, T(N);
|
|
2667
2667
|
continue;
|
|
2668
2668
|
}
|
|
2669
|
-
(f.index === f.start || h.type === "slash" || h.type === "dot") && (h.type === "dot" ? (f.output += w, h.output += w) : n.dot === !0 ? (f.output += $, h.output += $) : (f.output +=
|
|
2669
|
+
(f.index === f.start || h.type === "slash" || h.type === "dot") && (h.type === "dot" ? (f.output += w, h.output += w) : n.dot === !0 ? (f.output += $, h.output += $) : (f.output += O, h.output += O), k() !== "*" && (f.output += v, h.output += v)), T(N);
|
|
2670
2670
|
}
|
|
2671
2671
|
for (; f.brackets > 0; ) {
|
|
2672
2672
|
if (n.strictBrackets === !0)
|
|
@@ -2683,15 +2683,15 @@ const Ve = Ye, ne = qe, {
|
|
|
2683
2683
|
throw new SyntaxError(ve("closing", "}"));
|
|
2684
2684
|
f.output = ne.escapeLast(f.output, "{"), ye("braces");
|
|
2685
2685
|
}
|
|
2686
|
-
if (n.strictSlashes !== !0 && (h.type === "star" || h.type === "bracket") && T({ type: "maybe_slash", value: "", output: `${
|
|
2686
|
+
if (n.strictSlashes !== !0 && (h.type === "star" || h.type === "bracket") && T({ type: "maybe_slash", value: "", output: `${_}?` }), f.backtrack === !0) {
|
|
2687
2687
|
f.output = "";
|
|
2688
|
-
for (const
|
|
2689
|
-
f.output +=
|
|
2688
|
+
for (const g of f.tokens)
|
|
2689
|
+
f.output += g.output != null ? g.output : g.value, g.suffix && (f.output += g.suffix);
|
|
2690
2690
|
}
|
|
2691
2691
|
return f;
|
|
2692
2692
|
};
|
|
2693
2693
|
wn.fastpaths = (t, e) => {
|
|
2694
|
-
const n = { ...e }, s = typeof n.maxLength == "number" ? Math.min(
|
|
2694
|
+
const n = { ...e }, s = typeof n.maxLength == "number" ? Math.min(Ve, n.maxLength) : Ve, i = t.length;
|
|
2695
2695
|
if (i > s)
|
|
2696
2696
|
throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${s}`);
|
|
2697
2697
|
t = bn[t] || t;
|
|
@@ -2703,50 +2703,50 @@ wn.fastpaths = (t, e) => {
|
|
|
2703
2703
|
NO_DOT: l,
|
|
2704
2704
|
NO_DOTS: c,
|
|
2705
2705
|
NO_DOTS_SLASH: d,
|
|
2706
|
-
STAR:
|
|
2706
|
+
STAR: _,
|
|
2707
2707
|
START_ANCHOR: v
|
|
2708
|
-
} =
|
|
2709
|
-
let b = n.bash === !0 ? ".*?" :
|
|
2708
|
+
} = Ge.globChars(n.windows), m = n.dot ? c : l, S = n.dot ? d : l, w = n.capture ? "" : "?:", $ = { negated: !1, prefix: "" };
|
|
2709
|
+
let b = n.bash === !0 ? ".*?" : _;
|
|
2710
2710
|
n.capture && (b = `(${b})`);
|
|
2711
|
-
const A = (
|
|
2712
|
-
switch (
|
|
2711
|
+
const A = (O) => O.noglobstar === !0 ? b : `(${w}(?:(?!${v}${O.dot ? u : o}).)*?)`, E = (O) => {
|
|
2712
|
+
switch (O) {
|
|
2713
2713
|
case "*":
|
|
2714
|
-
return `${
|
|
2714
|
+
return `${m}${a}${b}`;
|
|
2715
2715
|
case ".*":
|
|
2716
2716
|
return `${o}${a}${b}`;
|
|
2717
2717
|
case "*.*":
|
|
2718
|
-
return `${
|
|
2718
|
+
return `${m}${b}${o}${a}${b}`;
|
|
2719
2719
|
case "*/*":
|
|
2720
|
-
return `${
|
|
2720
|
+
return `${m}${b}${r}${a}${S}${b}`;
|
|
2721
2721
|
case "**":
|
|
2722
|
-
return
|
|
2722
|
+
return m + A(n);
|
|
2723
2723
|
case "**/*":
|
|
2724
|
-
return `(?:${
|
|
2724
|
+
return `(?:${m}${A(n)}${r})?${S}${a}${b}`;
|
|
2725
2725
|
case "**/*.*":
|
|
2726
|
-
return `(?:${
|
|
2726
|
+
return `(?:${m}${A(n)}${r})?${S}${b}${o}${a}${b}`;
|
|
2727
2727
|
case "**/.*":
|
|
2728
|
-
return `(?:${
|
|
2728
|
+
return `(?:${m}${A(n)}${r})?${o}${a}${b}`;
|
|
2729
2729
|
default: {
|
|
2730
|
-
const L = /^(.*?)\.(\w+)$/.exec(
|
|
2730
|
+
const L = /^(.*?)\.(\w+)$/.exec(O);
|
|
2731
2731
|
if (!L)
|
|
2732
2732
|
return;
|
|
2733
2733
|
const U = E(L[1]);
|
|
2734
2734
|
return U ? U + o + L[2] : void 0;
|
|
2735
2735
|
}
|
|
2736
2736
|
}
|
|
2737
|
-
},
|
|
2738
|
-
let H = E(
|
|
2737
|
+
}, R = ne.removePrefix(t, $);
|
|
2738
|
+
let H = E(R);
|
|
2739
2739
|
return H && n.strictSlashes !== !0 && (H += `${r}?`), H;
|
|
2740
2740
|
};
|
|
2741
2741
|
var pi = wn;
|
|
2742
|
-
const hi = ai, dt = pi, vn = qe, di = Ye, mi = (t) => t && typeof t == "object" && !Array.isArray(t),
|
|
2742
|
+
const hi = ai, dt = pi, vn = qe, di = Ye, mi = (t) => t && typeof t == "object" && !Array.isArray(t), G = (t, e, n = !1) => {
|
|
2743
2743
|
if (Array.isArray(t)) {
|
|
2744
|
-
const c = t.map((
|
|
2745
|
-
return (
|
|
2744
|
+
const c = t.map((_) => G(_, e, n));
|
|
2745
|
+
return (_) => {
|
|
2746
2746
|
for (const v of c) {
|
|
2747
|
-
const
|
|
2748
|
-
if (
|
|
2749
|
-
return
|
|
2747
|
+
const m = v(_);
|
|
2748
|
+
if (m)
|
|
2749
|
+
return m;
|
|
2750
2750
|
}
|
|
2751
2751
|
return !1;
|
|
2752
2752
|
};
|
|
@@ -2754,49 +2754,49 @@ const hi = ai, dt = pi, vn = qe, di = Ye, mi = (t) => t && typeof t == "object"
|
|
|
2754
2754
|
const s = mi(t) && t.tokens && t.input;
|
|
2755
2755
|
if (t === "" || typeof t != "string" && !s)
|
|
2756
2756
|
throw new TypeError("Expected pattern to be a non-empty string");
|
|
2757
|
-
const i = e || {}, o = i.windows, r = s ?
|
|
2757
|
+
const i = e || {}, o = i.windows, r = s ? G.compileRe(t, e) : G.makeRe(t, e, !1, !0), a = r.state;
|
|
2758
2758
|
delete r.state;
|
|
2759
2759
|
let u = () => !1;
|
|
2760
2760
|
if (i.ignore) {
|
|
2761
2761
|
const c = { ...e, ignore: null, onMatch: null, onResult: null };
|
|
2762
|
-
u =
|
|
2762
|
+
u = G(i.ignore, c, n);
|
|
2763
2763
|
}
|
|
2764
2764
|
const l = (c, d = !1) => {
|
|
2765
|
-
const { isMatch:
|
|
2766
|
-
return typeof i.onResult == "function" && i.onResult(
|
|
2765
|
+
const { isMatch: _, match: v, output: m } = G.test(c, r, e, { glob: t, posix: o }), S = { glob: t, state: a, regex: r, posix: o, input: c, output: m, match: v, isMatch: _ };
|
|
2766
|
+
return typeof i.onResult == "function" && i.onResult(S), _ === !1 ? (S.isMatch = !1, d ? S : !1) : u(c) ? (typeof i.onIgnore == "function" && i.onIgnore(S), S.isMatch = !1, d ? S : !1) : (typeof i.onMatch == "function" && i.onMatch(S), d ? S : !0);
|
|
2767
2767
|
};
|
|
2768
2768
|
return n && (l.state = a), l;
|
|
2769
2769
|
};
|
|
2770
|
-
|
|
2770
|
+
G.test = (t, e, n, { glob: s, posix: i } = {}) => {
|
|
2771
2771
|
if (typeof t != "string")
|
|
2772
2772
|
throw new TypeError("Expected input to be a string");
|
|
2773
2773
|
if (t === "")
|
|
2774
2774
|
return { isMatch: !1, output: "" };
|
|
2775
2775
|
const o = n || {}, r = o.format || (i ? vn.toPosixSlashes : null);
|
|
2776
2776
|
let a = t === s, u = a && r ? r(t) : t;
|
|
2777
|
-
return a === !1 && (u = r ? r(t) : t, a = u === s), (a === !1 || o.capture === !0) && (o.matchBase === !0 || o.basename === !0 ? a =
|
|
2777
|
+
return a === !1 && (u = r ? r(t) : t, a = u === s), (a === !1 || o.capture === !0) && (o.matchBase === !0 || o.basename === !0 ? a = G.matchBase(t, e, n, i) : a = e.exec(u)), { isMatch: !!a, match: a, output: u };
|
|
2778
2778
|
};
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2779
|
+
G.matchBase = (t, e, n) => (e instanceof RegExp ? e : G.makeRe(e, n)).test(vn.basename(t));
|
|
2780
|
+
G.isMatch = (t, e, n) => G(e, n)(t);
|
|
2781
|
+
G.parse = (t, e) => Array.isArray(t) ? t.map((n) => G.parse(n, e)) : dt(t, { ...e, fastpaths: !1 });
|
|
2782
|
+
G.scan = (t, e) => hi(t, e);
|
|
2783
|
+
G.compileRe = (t, e, n = !1, s = !1) => {
|
|
2784
2784
|
if (n === !0)
|
|
2785
2785
|
return t.output;
|
|
2786
2786
|
const i = e || {}, o = i.contains ? "" : "^", r = i.contains ? "" : "$";
|
|
2787
2787
|
let a = `${o}(?:${t.output})${r}`;
|
|
2788
2788
|
t && t.negated === !0 && (a = `^(?!${a}).*$`);
|
|
2789
|
-
const u =
|
|
2789
|
+
const u = G.toRegex(a, e);
|
|
2790
2790
|
return s === !0 && (u.state = t), u;
|
|
2791
2791
|
};
|
|
2792
|
-
|
|
2792
|
+
G.makeRe = (t, e, n = !1, s = !1) => {
|
|
2793
2793
|
if (!t || typeof t != "string")
|
|
2794
2794
|
throw new TypeError("Expected a non-empty string");
|
|
2795
2795
|
const i = e || {};
|
|
2796
2796
|
let o = { negated: !1, fastpaths: !0 }, r = "", a;
|
|
2797
|
-
return t.startsWith("./") && (t = t.slice(2), r = o.prefix = "./"), i.fastpaths !== !1 && (t[0] === "." || t[0] === "*") && (a = dt.fastpaths(t, e)), a === void 0 ? (o = dt(t, e), o.prefix = r + (o.prefix || "")) : o.output = a,
|
|
2797
|
+
return t.startsWith("./") && (t = t.slice(2), r = o.prefix = "./"), i.fastpaths !== !1 && (t[0] === "." || t[0] === "*") && (a = dt.fastpaths(t, e)), a === void 0 ? (o = dt(t, e), o.prefix = r + (o.prefix || "")) : o.output = a, G.compileRe(o, e, n, s);
|
|
2798
2798
|
};
|
|
2799
|
-
|
|
2799
|
+
G.toRegex = (t, e) => {
|
|
2800
2800
|
try {
|
|
2801
2801
|
const n = e || {};
|
|
2802
2802
|
return new RegExp(t, n.flags || (n.nocase ? "i" : ""));
|
|
@@ -2806,8 +2806,8 @@ V.toRegex = (t, e) => {
|
|
|
2806
2806
|
return /$^/;
|
|
2807
2807
|
}
|
|
2808
2808
|
};
|
|
2809
|
-
|
|
2810
|
-
var yi =
|
|
2809
|
+
G.constants = di;
|
|
2810
|
+
var yi = G, gi = yi;
|
|
2811
2811
|
const _i = /* @__PURE__ */ mt(gi), Rn = yt(fetch), bi = async (t, e) => {
|
|
2812
2812
|
const n = new URL(t);
|
|
2813
2813
|
n.pathname = n.pathname + (n.pathname.endsWith("/") ? "metapage.json" : "/metapage.json");
|
|
@@ -2841,7 +2841,7 @@ const _i = /* @__PURE__ */ mt(gi), Rn = yt(fetch), bi = async (t, e) => {
|
|
|
2841
2841
|
console.error(`Error fetching metaframe definition from ${n.href}: ${i}`);
|
|
2842
2842
|
return;
|
|
2843
2843
|
}
|
|
2844
|
-
},
|
|
2844
|
+
}, Ji = (t) => t ? !(t != null && t.inputs && Object.keys(t.inputs).length > 0 || t != null && t.outputs && Object.keys(t.outputs).length > 0 || t != null && t.allow || t != null && t.metadata && Object.keys(t.metadata).length > 0) : !0;
|
|
2845
2845
|
class vi extends Rt.EventEmitter {
|
|
2846
2846
|
constructor(e, n, s, i, o, r = !1) {
|
|
2847
2847
|
if (super(), this.inputs = {}, this.outputs = {}, this._disposables = [], this._rpcListeners = [], this._loaded = !1, this._onLoaded = [], this._sendInputsAfterRegistration = !1, this._cachedEventInputsUpdate = {
|
|
@@ -2863,21 +2863,21 @@ class vi extends Rt.EventEmitter {
|
|
|
2863
2863
|
const u = this;
|
|
2864
2864
|
this.iframe = new Promise((l) => {
|
|
2865
2865
|
Xe().then(async () => {
|
|
2866
|
-
var c, d,
|
|
2866
|
+
var c, d, _, v;
|
|
2867
2867
|
if (u._iframe) {
|
|
2868
|
-
if ((v = (
|
|
2868
|
+
if ((v = (_ = (d = (c = this._metapage) == null ? void 0 : c._definition) == null ? void 0 : d.metaframes) == null ? void 0 : _[this.id]) != null && v.allow)
|
|
2869
2869
|
u._iframe.allow = this._metapage._definition.metaframes[this.id].allow, this._debug && this.log(`mf allow=${u._iframe.allow} from this._metapage?._definition`);
|
|
2870
2870
|
else {
|
|
2871
|
-
let
|
|
2872
|
-
if (
|
|
2871
|
+
let m = Ot(this.url, "definition");
|
|
2872
|
+
if (m = m && (m != null && m.version) ? await pt(m) : void 0, !u._iframe)
|
|
2873
2873
|
return;
|
|
2874
|
-
if (
|
|
2875
|
-
u._iframe.allow =
|
|
2874
|
+
if (m != null && m.allow)
|
|
2875
|
+
u._iframe.allow = m.allow;
|
|
2876
2876
|
else {
|
|
2877
|
-
let
|
|
2878
|
-
if (this._debug && this.log(`mf metaframeDef=${JSON.stringify(
|
|
2877
|
+
let S = await u.getDefinition();
|
|
2878
|
+
if (this._debug && this.log(`mf metaframeDef=${JSON.stringify(S)}`), S = S && (S != null && S.version) ? await pt(S) : void 0, this._debug && this.log(`mf metaframeDef=${JSON.stringify(S)}`), !u._iframe)
|
|
2879
2879
|
return;
|
|
2880
|
-
|
|
2880
|
+
S && S.allow && (u._iframe.allow = S.allow);
|
|
2881
2881
|
}
|
|
2882
2882
|
}
|
|
2883
2883
|
this._debug && this.log(`mf allow=${u._iframe.allow} from ${this.url}`), u._iframe.src = this.url, l(u._iframe);
|
|
@@ -2918,7 +2918,7 @@ Error: ${n != null && n.message ? n == null ? void 0 : n.message : n == null ? v
|
|
|
2918
2918
|
setInputs(e) {
|
|
2919
2919
|
this.log({ m: "MetapageIFrameRpcClient", inputs: e });
|
|
2920
2920
|
const n = e;
|
|
2921
|
-
if (this.inputs =
|
|
2921
|
+
if (this.inputs = Je(this.inputs, e), this.inputs === n)
|
|
2922
2922
|
return this;
|
|
2923
2923
|
if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit(x.Inputs, this.inputs), this._metapage.listenerCount(x.Inputs) > 0) {
|
|
2924
2924
|
var s = {};
|
|
@@ -2933,7 +2933,7 @@ Error: ${n != null && n.message ? n == null ? void 0 : n.message : n == null ? v
|
|
|
2933
2933
|
}
|
|
2934
2934
|
setOutputs(e) {
|
|
2935
2935
|
const n = e;
|
|
2936
|
-
if (this.outputs =
|
|
2936
|
+
if (this.outputs = Je(this.outputs, e), this.outputs === n)
|
|
2937
2937
|
return this;
|
|
2938
2938
|
if (this.emit(x.Outputs, e), this._metapage.listenerCount(x.Outputs) > 0) {
|
|
2939
2939
|
var s = {};
|
|
@@ -2975,7 +2975,7 @@ Error: ${n != null && n.message ? n == null ? void 0 : n.message : n == null ? v
|
|
|
2975
2975
|
state: {
|
|
2976
2976
|
inputs: this.inputs
|
|
2977
2977
|
},
|
|
2978
|
-
version:
|
|
2978
|
+
version: Vt
|
|
2979
2979
|
};
|
|
2980
2980
|
this.sendRpcInternal(me.SetupIframeServerResponse, e);
|
|
2981
2981
|
}
|
|
@@ -3052,7 +3052,7 @@ const ge = C({
|
|
|
3052
3052
|
inputs: {},
|
|
3053
3053
|
outputs: {}
|
|
3054
3054
|
}
|
|
3055
|
-
}, (t) => t),
|
|
3055
|
+
}, (t) => t), Gi = (t) => he(t), Ri = (t, e) => !!(!e || e === "**" || t === e || _i.isMatch(t, e)), Oi = "bcbcbc";
|
|
3056
3056
|
class ee extends Ns {
|
|
3057
3057
|
static async from(e, n) {
|
|
3058
3058
|
if (e == null)
|
|
@@ -3067,7 +3067,7 @@ class ee extends Ns {
|
|
|
3067
3067
|
return s.setDefinition(e);
|
|
3068
3068
|
}
|
|
3069
3069
|
constructor(e) {
|
|
3070
|
-
super(), this._state = ge, this._metaframes = C({}, (n) => n), this.debug = ht(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = C({}, (n) => n), this._inputMap = {}, this._id = e && e.id ? e.id : js(), this._consoleBackgroundColor = e && e.color ? e.color : Oi, 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.setMetadata = this.setMetadata.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), Xe().then(() => {
|
|
3070
|
+
super(), this._state = ge, this._metaframes = C({}, (n) => n), this.debug = ht(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = C({}, (n) => n), this._inputMap = {}, this._id = e && e.id ? e.id : js(), this._consoleBackgroundColor = e && e.color ? e.color : Oi, 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.onMessageJsonRpc = this.onMessageJsonRpc.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.setMetadata = this.setMetadata.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), Xe().then(() => {
|
|
3071
3071
|
this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
|
|
3072
3072
|
});
|
|
3073
3073
|
}
|
|
@@ -3224,7 +3224,7 @@ class ee extends Ns {
|
|
|
3224
3224
|
if (e.jsonrpc !== "2.0")
|
|
3225
3225
|
return !1;
|
|
3226
3226
|
switch (e.method) {
|
|
3227
|
-
case
|
|
3227
|
+
case X.SetupIframeClientRequest:
|
|
3228
3228
|
return !0;
|
|
3229
3229
|
default:
|
|
3230
3230
|
var s = e.iframeId;
|
|
@@ -3313,67 +3313,80 @@ class ee extends Ns {
|
|
|
3313
3313
|
});
|
|
3314
3314
|
}));
|
|
3315
3315
|
}
|
|
3316
|
+
setMetaframeOutputs(e, n) {
|
|
3317
|
+
this.onMessageJsonRpc({
|
|
3318
|
+
iframeId: e,
|
|
3319
|
+
parentId: this._id,
|
|
3320
|
+
jsonrpc: "2.0",
|
|
3321
|
+
method: X.OutputsUpdate,
|
|
3322
|
+
id: "_",
|
|
3323
|
+
params: n
|
|
3324
|
+
});
|
|
3325
|
+
}
|
|
3316
3326
|
onMessage(e) {
|
|
3317
3327
|
if (typeof e.data == "object") {
|
|
3318
|
-
const
|
|
3319
|
-
if (!this.isValidJSONRpcMessage(
|
|
3320
|
-
return;
|
|
3321
|
-
var n = r.method;
|
|
3322
|
-
const a = r.iframeId;
|
|
3323
|
-
if (!a || n !== "SetupIframeClientRequest" && r.parentId !== this._id)
|
|
3328
|
+
const n = e.data;
|
|
3329
|
+
if (!this.isValidJSONRpcMessage(n))
|
|
3324
3330
|
return;
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
+
this.onMessageJsonRpc(n);
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
onMessageJsonRpc(e) {
|
|
3335
|
+
var n = e.method;
|
|
3336
|
+
const s = e.iframeId;
|
|
3337
|
+
if (!s || n !== "SetupIframeClientRequest" && e.parentId !== this._id)
|
|
3338
|
+
return;
|
|
3339
|
+
const i = this.getMetaframe(s);
|
|
3340
|
+
if (i) {
|
|
3341
|
+
switch (e._messageCount = ++this._internalReceivedMessageCounter, this.debug && this.log(`processing ${JSON.stringify(e, null, " ").substring(0, 500)}`), n) {
|
|
3342
|
+
case X.SetupIframeClientRequest:
|
|
3343
|
+
i.register();
|
|
3331
3344
|
break;
|
|
3332
|
-
case
|
|
3333
|
-
if (
|
|
3334
|
-
const
|
|
3335
|
-
|
|
3345
|
+
case X.SetupIframeServerResponseAck:
|
|
3346
|
+
if (i) {
|
|
3347
|
+
const l = e.params;
|
|
3348
|
+
i.registered(l.version);
|
|
3336
3349
|
}
|
|
3337
3350
|
break;
|
|
3338
|
-
case
|
|
3339
|
-
const
|
|
3340
|
-
if (!
|
|
3351
|
+
case X.OutputsUpdate:
|
|
3352
|
+
const u = e.params;
|
|
3353
|
+
if (!u || Object.keys(u).length === 0)
|
|
3341
3354
|
break;
|
|
3342
|
-
if (this._metaframes[
|
|
3343
|
-
var
|
|
3344
|
-
this.setOutputStateOnlyMetaframeInputMap(
|
|
3345
|
-
var
|
|
3346
|
-
const
|
|
3347
|
-
|
|
3348
|
-
const
|
|
3349
|
-
|
|
3350
|
-
|
|
3355
|
+
if (this._metaframes[s]) {
|
|
3356
|
+
var o = this._metaframes[s];
|
|
3357
|
+
this.setOutputStateOnlyMetaframeInputMap(s, u), o.setOutputs(u);
|
|
3358
|
+
var r = !1;
|
|
3359
|
+
const l = Object.keys(u), c = {};
|
|
3360
|
+
l.forEach((d, _) => {
|
|
3361
|
+
const v = this.getInputsFromOutput(s, d);
|
|
3362
|
+
v.length > 0 && v.forEach((m) => {
|
|
3363
|
+
c[m.metaframe] || (c[m.metaframe] = {}), c[m.metaframe][m.pipe] = u[d], r = !0;
|
|
3351
3364
|
});
|
|
3352
|
-
}),
|
|
3353
|
-
this._metaframes[
|
|
3354
|
-
})), this.listenerCount(x.State) > 0 && ge !== this._state && this.emit(x.State, this._state), this.debug &&
|
|
3365
|
+
}), r && (this.setInputStateOnlyMetapageInstanceInputs(c), Object.keys(c).forEach((d) => {
|
|
3366
|
+
this._metaframes[d].setInputs(c[d]);
|
|
3367
|
+
})), this.listenerCount(x.State) > 0 && ge !== this._state && this.emit(x.State, this._state), this.debug && o.ack({ jsonrpc: e, state: this._state });
|
|
3355
3368
|
} else
|
|
3356
|
-
this.error(`missing metaframe=${
|
|
3369
|
+
this.error(`missing metaframe=${s}`);
|
|
3357
3370
|
break;
|
|
3358
|
-
case
|
|
3359
|
-
var
|
|
3360
|
-
this.debug && this.log(`inputs ${JSON.stringify(
|
|
3361
|
-
jsonrpc:
|
|
3371
|
+
case X.InputsUpdate:
|
|
3372
|
+
var a = e.params;
|
|
3373
|
+
this.debug && this.log(`inputs ${JSON.stringify(a)} from ${s}`), this._metaframes[s] ? (this.setInputStateOnlyMetaframeInputMap(s, a), this._metaframes[s].setInputs(a), this.listenerCount(x.State) > 0 && ge !== this._state && this.emit(x.State, this._state), this.debug && this._metaframes[s].ack({
|
|
3374
|
+
jsonrpc: e,
|
|
3362
3375
|
state: this._state
|
|
3363
|
-
})) : (console.error(`InputsUpdate failed no metaframe id: "${
|
|
3376
|
+
})) : (console.error(`InputsUpdate failed no metaframe id: "${s}"`), this.error(`InputsUpdate failed no metaframe id: "${s}"`));
|
|
3364
3377
|
break;
|
|
3365
|
-
case
|
|
3366
|
-
if (
|
|
3367
|
-
const
|
|
3368
|
-
|
|
3369
|
-
|
|
3378
|
+
case X.HashParamsUpdate:
|
|
3379
|
+
if (i) {
|
|
3380
|
+
const l = e.params, c = new URL(i.url);
|
|
3381
|
+
c.hash = l.hash, i.url = c.href, this._definition = C(this._definition, (d) => {
|
|
3382
|
+
d.metaframes[l.metaframe].url = c.href;
|
|
3370
3383
|
}), this._emitDefinitionEvent();
|
|
3371
3384
|
}
|
|
3372
3385
|
break;
|
|
3373
3386
|
default:
|
|
3374
3387
|
this.debug && this.log(`Unknown RPC method: "${n}"`);
|
|
3375
3388
|
}
|
|
3376
|
-
this.listenerCount(x.Message) > 0 && this.emit(x.Message,
|
|
3389
|
+
this.listenerCount(x.Message) > 0 && this.emit(x.Message, e);
|
|
3377
3390
|
}
|
|
3378
3391
|
}
|
|
3379
3392
|
logInternal(e, n, s) {
|
|
@@ -3382,7 +3395,7 @@ class ee extends Ns {
|
|
|
3382
3395
|
typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), i = this._id ? `Metapage[${this._id}] ${i}` : i, At(i, n, s);
|
|
3383
3396
|
}
|
|
3384
3397
|
}
|
|
3385
|
-
ee.version =
|
|
3398
|
+
ee.version = Vt;
|
|
3386
3399
|
ee.DEFINITION = x.Definition;
|
|
3387
3400
|
ee.ERROR = x.Error;
|
|
3388
3401
|
ee.INPUTS = x.Inputs;
|
|
@@ -3427,8 +3440,8 @@ function Si(t) {
|
|
|
3427
3440
|
}
|
|
3428
3441
|
return e;
|
|
3429
3442
|
}
|
|
3430
|
-
async function
|
|
3431
|
-
var
|
|
3443
|
+
async function Vi(t) {
|
|
3444
|
+
var R, H, O, L, U;
|
|
3432
3445
|
let { url: e, definition: n, onOutputs: s, rootDiv: i, options: o = {} } = t;
|
|
3433
3446
|
if (!e && !n)
|
|
3434
3447
|
throw new Error("Either url or definition must be provided");
|
|
@@ -3446,7 +3459,7 @@ async function Ji(t) {
|
|
|
3446
3459
|
}
|
|
3447
3460
|
const a = [];
|
|
3448
3461
|
s && a.push(r.addListenerReturnDisposer(x.Outputs, s));
|
|
3449
|
-
const u = (H = (
|
|
3462
|
+
const u = (H = (R = n == null ? void 0 : n.meta) == null ? void 0 : R.layouts) == null ? void 0 : H["react-grid-layout"], l = u == null ? void 0 : u.layout;
|
|
3450
3463
|
if (!u || !l)
|
|
3451
3464
|
throw new Error("No valid layout found in metapage definition");
|
|
3452
3465
|
const c = /* @__PURE__ */ new Set(), d = l.map((f, M) => {
|
|
@@ -3454,13 +3467,13 @@ async function Ji(t) {
|
|
|
3454
3467
|
return I && On(I.url) ? { index: M, y: f.y, id: f.i } : null;
|
|
3455
3468
|
}).filter((f) => f !== null);
|
|
3456
3469
|
if (d.length > 0) {
|
|
3457
|
-
const f = d.reduce((I, B) => B.y < I.y ? B : I), M = ((
|
|
3470
|
+
const f = d.reduce((I, B) => B.y < I.y ? B : I), M = ((O = l.find((I) => I.i === f.id)) == null ? void 0 : O.y) ?? 0;
|
|
3458
3471
|
l.forEach((I) => {
|
|
3459
3472
|
I.y >= M && c.add(I.i);
|
|
3460
3473
|
});
|
|
3461
3474
|
}
|
|
3462
|
-
const
|
|
3463
|
-
let v = l.filter((f) =>
|
|
3475
|
+
const _ = r.getMetaframeIds().filter((f) => !c.has(f));
|
|
3476
|
+
let v = l.filter((f) => _.includes(f.i));
|
|
3464
3477
|
if (v.length === 0)
|
|
3465
3478
|
return {
|
|
3466
3479
|
metapage: r,
|
|
@@ -3472,7 +3485,7 @@ async function Ji(t) {
|
|
|
3472
3485
|
}
|
|
3473
3486
|
};
|
|
3474
3487
|
v.sort((f, M) => f.y !== M.y ? f.y - M.y : f.x - M.x);
|
|
3475
|
-
const
|
|
3488
|
+
const m = {
|
|
3476
3489
|
display: "grid",
|
|
3477
3490
|
gridTemplateColumns: "repeat(1, 1fr)",
|
|
3478
3491
|
gridAutoRows: "1fr",
|
|
@@ -3485,7 +3498,7 @@ async function Ji(t) {
|
|
|
3485
3498
|
alignContent: "start",
|
|
3486
3499
|
alignItems: "start",
|
|
3487
3500
|
overflow: "hidden"
|
|
3488
|
-
},
|
|
3501
|
+
}, S = {
|
|
3489
3502
|
width: "100%",
|
|
3490
3503
|
height: "100%",
|
|
3491
3504
|
overflow: "hidden",
|
|
@@ -3494,11 +3507,11 @@ async function Ji(t) {
|
|
|
3494
3507
|
};
|
|
3495
3508
|
i.innerHTML = "";
|
|
3496
3509
|
const w = document.createElement("div");
|
|
3497
|
-
Object.assign(w.style,
|
|
3510
|
+
Object.assign(w.style, S);
|
|
3498
3511
|
const $ = document.createElement("div");
|
|
3499
|
-
Object.assign($.style,
|
|
3512
|
+
Object.assign($.style, m);
|
|
3500
3513
|
const b = [];
|
|
3501
|
-
for (const f of
|
|
3514
|
+
for (const f of _) {
|
|
3502
3515
|
const M = l.find((W) => W.i === f);
|
|
3503
3516
|
if (!M)
|
|
3504
3517
|
continue;
|
|
@@ -3568,7 +3581,7 @@ export {
|
|
|
3568
3581
|
ki as INTERNAL_ERROR,
|
|
3569
3582
|
Di as INVALID_PARAMS,
|
|
3570
3583
|
Ti as INVALID_REQUEST,
|
|
3571
|
-
|
|
3584
|
+
X as JsonRpcMethodsFromChild,
|
|
3572
3585
|
me as JsonRpcMethodsFromParent,
|
|
3573
3586
|
Mi as METAFRAME_JSON_FILE,
|
|
3574
3587
|
Ii as METAPAGE_KEY_DEFINITION,
|
|
@@ -3588,7 +3601,7 @@ export {
|
|
|
3588
3601
|
Ct as MetapageVersionsAll,
|
|
3589
3602
|
Li as PARSE_ERROR,
|
|
3590
3603
|
En as VERSION_METAFRAME,
|
|
3591
|
-
|
|
3604
|
+
Vt as VERSION_METAPAGE,
|
|
3592
3605
|
ns as convertMetaframeDefinitionToCurrentVersion,
|
|
3593
3606
|
nn as convertMetaframeDefinitionToVersion,
|
|
3594
3607
|
pt as convertMetaframeJsonToCurrentVersion,
|
|
@@ -3599,7 +3612,7 @@ export {
|
|
|
3599
3612
|
Ui as generateMetaframeId,
|
|
3600
3613
|
js as generateMetapageId,
|
|
3601
3614
|
Bi as generateNonce,
|
|
3602
|
-
|
|
3615
|
+
Gi as getLibraryVersionMatching,
|
|
3603
3616
|
te as getMatchingMetaframeVersion,
|
|
3604
3617
|
he as getMatchingMetapageVersion,
|
|
3605
3618
|
wi as getMetaframeDefinitionFromUrl,
|
|
@@ -3609,20 +3622,20 @@ export {
|
|
|
3609
3622
|
Us as hashCode,
|
|
3610
3623
|
Bs as intToRGB,
|
|
3611
3624
|
ht as isDebugFromUrlsParams,
|
|
3612
|
-
|
|
3625
|
+
Ji as isEmptyMetaframeDefinition,
|
|
3613
3626
|
Hs as isIframe,
|
|
3614
3627
|
Hi as isJsonRpcId,
|
|
3615
3628
|
tt as isPageLoaded,
|
|
3616
3629
|
At as log,
|
|
3617
3630
|
Ri as matchPipe,
|
|
3618
|
-
|
|
3631
|
+
Je as merge,
|
|
3619
3632
|
Fi as metapageAllSha256Hash,
|
|
3620
3633
|
zi as metapageOnlyEssentailSha256Hash,
|
|
3621
3634
|
Xe as pageLoaded,
|
|
3622
3635
|
xi as possiblyDeserializeDatarefToFile,
|
|
3623
3636
|
sn as possiblyDeserializeDatarefToValue,
|
|
3624
3637
|
ds as possiblySerializeValueToDataref,
|
|
3625
|
-
|
|
3638
|
+
Vi as renderMetapage,
|
|
3626
3639
|
Ke as serializeInputs,
|
|
3627
3640
|
hn as stringToRgb,
|
|
3628
3641
|
$i as valueToFile
|