@metapages/metapage 1.0.21 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2245 -1356
- package/dist/index.js.map +1 -1
- package/dist/metapage/Metapage.d.ts +3 -3
- package/dist/metapage/Metapage.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/declarations.d.ts +1 -0
- package/src/metapage/Metapage.ts +37 -14
package/dist/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
const
|
|
2
|
-
if (typeof
|
|
1
|
+
const St = ["0.3", "0.4", "0.5", "0.6", "1"], Ot = ["0.2", "0.3", "1"], ft = "1", Ge = "1", Fs = "metaframe.json", zs = "metapage/definition", Gs = "metapage/state", zt = Ot[Ot.length - 1], _n = St[St.length - 1], gn = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Et = (e) => {
|
|
2
|
+
if (typeof e != "string")
|
|
3
3
|
throw new TypeError("Invalid argument expected string");
|
|
4
|
-
const
|
|
5
|
-
if (!
|
|
6
|
-
throw new Error(`Invalid argument not valid semver ('${
|
|
7
|
-
return
|
|
8
|
-
},
|
|
9
|
-
const
|
|
10
|
-
return isNaN(
|
|
11
|
-
},
|
|
12
|
-
if (
|
|
4
|
+
const t = e.match(gn);
|
|
5
|
+
if (!t)
|
|
6
|
+
throw new Error(`Invalid argument not valid semver ('${e}' received)`);
|
|
7
|
+
return t.shift(), t;
|
|
8
|
+
}, Mt = (e) => e === "*" || e === "x" || e === "X", It = (e) => {
|
|
9
|
+
const t = parseInt(e, 10);
|
|
10
|
+
return isNaN(t) ? e : t;
|
|
11
|
+
}, bn = (e, t) => typeof e != typeof t ? [String(e), String(t)] : [e, t], vn = (e, t) => {
|
|
12
|
+
if (Mt(e) || Mt(t))
|
|
13
13
|
return 0;
|
|
14
|
-
const [n, s] =
|
|
14
|
+
const [n, s] = bn(It(e), It(t));
|
|
15
15
|
return n > s ? 1 : n < s ? -1 : 0;
|
|
16
|
-
},
|
|
17
|
-
for (let n = 0; n < Math.max(
|
|
18
|
-
const s =
|
|
16
|
+
}, Ct = (e, t) => {
|
|
17
|
+
for (let n = 0; n < Math.max(e.length, t.length); n++) {
|
|
18
|
+
const s = vn(e[n] || "0", t[n] || "0");
|
|
19
19
|
if (s !== 0)
|
|
20
20
|
return s;
|
|
21
21
|
}
|
|
22
22
|
return 0;
|
|
23
|
-
},
|
|
24
|
-
const n =
|
|
25
|
-
return r !== 0 ? r : i &&
|
|
23
|
+
}, V = (e, t) => {
|
|
24
|
+
const n = Et(e), s = Et(t), i = n.pop(), o = s.pop(), r = Ct(n, s);
|
|
25
|
+
return r !== 0 ? r : i && o ? Ct(i.split("."), o.split(".")) : i || o ? i ? -1 : 1 : 0;
|
|
26
26
|
};
|
|
27
|
-
var
|
|
28
|
-
function
|
|
29
|
-
return
|
|
27
|
+
var wn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
28
|
+
function lt(e) {
|
|
29
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
30
30
|
}
|
|
31
|
-
var
|
|
32
|
-
(function(
|
|
31
|
+
var Gt = { exports: {} };
|
|
32
|
+
(function(e, t) {
|
|
33
33
|
(function(n, s) {
|
|
34
|
-
|
|
35
|
-
})(
|
|
36
|
-
var n = function(
|
|
37
|
-
if (r = r || {}, typeof
|
|
34
|
+
e.exports = s();
|
|
35
|
+
})(wn, function() {
|
|
36
|
+
var n = function(o, r) {
|
|
37
|
+
if (r = r || {}, typeof o != "function")
|
|
38
38
|
throw new i("fetch must be a function");
|
|
39
39
|
if (typeof r != "object")
|
|
40
40
|
throw new i("defaults must be an object");
|
|
@@ -44,615 +44,615 @@ var He = { exports: {} };
|
|
|
44
44
|
throw new i("retryDelay must be a positive integer or a function returning a positive integer");
|
|
45
45
|
if (r.retryOn !== void 0 && !Array.isArray(r.retryOn) && typeof r.retryOn != "function")
|
|
46
46
|
throw new i("retryOn property expects an array or function");
|
|
47
|
-
var
|
|
47
|
+
var a = {
|
|
48
48
|
retries: 3,
|
|
49
49
|
retryDelay: 1e3,
|
|
50
50
|
retryOn: []
|
|
51
51
|
};
|
|
52
|
-
return r = Object.assign(
|
|
53
|
-
var
|
|
52
|
+
return r = Object.assign(a, r), function(f, c) {
|
|
53
|
+
var d = r.retries, g = r.retryDelay, w = r.retryOn;
|
|
54
54
|
if (c && c.retries !== void 0)
|
|
55
55
|
if (s(c.retries))
|
|
56
|
-
|
|
56
|
+
d = c.retries;
|
|
57
57
|
else
|
|
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
|
+
g = 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)
|
|
65
65
|
if (Array.isArray(c.retryOn) || typeof c.retryOn == "function")
|
|
66
|
-
|
|
66
|
+
w = c.retryOn;
|
|
67
67
|
else
|
|
68
68
|
throw new i("retryOn property expects an array or function");
|
|
69
|
-
return new Promise(function(
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
if (Array.isArray(
|
|
74
|
-
|
|
75
|
-
else if (typeof
|
|
69
|
+
return new Promise(function(y, O) {
|
|
70
|
+
var v = function(b) {
|
|
71
|
+
var S = typeof Request < "u" && f instanceof Request ? f.clone() : f;
|
|
72
|
+
o(S, c).then(function(M) {
|
|
73
|
+
if (Array.isArray(w) && w.indexOf(M.status) === -1)
|
|
74
|
+
y(M);
|
|
75
|
+
else if (typeof w == "function")
|
|
76
76
|
try {
|
|
77
|
-
return Promise.resolve(
|
|
78
|
-
|
|
79
|
-
}).catch(
|
|
80
|
-
} catch (
|
|
81
|
-
|
|
77
|
+
return Promise.resolve(w(b, null, M)).then(function(R) {
|
|
78
|
+
R ? x(b, null, M) : y(M);
|
|
79
|
+
}).catch(O);
|
|
80
|
+
} catch (R) {
|
|
81
|
+
O(R);
|
|
82
82
|
}
|
|
83
83
|
else
|
|
84
|
-
|
|
85
|
-
}).catch(function(
|
|
86
|
-
if (typeof
|
|
84
|
+
b < d ? x(b, null, M) : y(M);
|
|
85
|
+
}).catch(function(M) {
|
|
86
|
+
if (typeof w == "function")
|
|
87
87
|
try {
|
|
88
|
-
Promise.resolve(
|
|
89
|
-
|
|
90
|
-
}).catch(function(
|
|
91
|
-
|
|
88
|
+
Promise.resolve(w(b, M, null)).then(function(R) {
|
|
89
|
+
R ? x(b, M, null) : O(M);
|
|
90
|
+
}).catch(function(R) {
|
|
91
|
+
O(R);
|
|
92
92
|
});
|
|
93
|
-
} catch (
|
|
94
|
-
|
|
93
|
+
} catch (R) {
|
|
94
|
+
O(R);
|
|
95
95
|
}
|
|
96
96
|
else
|
|
97
|
-
|
|
97
|
+
b < d ? x(b, M, null) : O(M);
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
|
-
function
|
|
101
|
-
var
|
|
100
|
+
function x(b, S, M) {
|
|
101
|
+
var R = typeof g == "function" ? g(b, S, M) : g;
|
|
102
102
|
setTimeout(function() {
|
|
103
|
-
|
|
104
|
-
},
|
|
103
|
+
v(++b);
|
|
104
|
+
}, R);
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
v(0);
|
|
107
107
|
});
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
|
-
function s(
|
|
111
|
-
return Number.isInteger(
|
|
110
|
+
function s(o) {
|
|
111
|
+
return Number.isInteger(o) && o >= 0;
|
|
112
112
|
}
|
|
113
|
-
function i(
|
|
114
|
-
this.name = "ArgumentError", this.message =
|
|
113
|
+
function i(o) {
|
|
114
|
+
this.name = "ArgumentError", this.message = o;
|
|
115
115
|
}
|
|
116
116
|
return n;
|
|
117
117
|
});
|
|
118
|
-
})(
|
|
119
|
-
var
|
|
120
|
-
const
|
|
118
|
+
})(Gt);
|
|
119
|
+
var Rn = Gt.exports;
|
|
120
|
+
const pt = /* @__PURE__ */ lt(Rn), U = {
|
|
121
121
|
Remove: "remove",
|
|
122
122
|
Replace: "replace",
|
|
123
123
|
Add: "add"
|
|
124
|
-
},
|
|
124
|
+
}, Vt = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), An = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Ne = Symbol.iterator, Y = {
|
|
125
125
|
mutable: "mutable",
|
|
126
126
|
immutable: "immutable"
|
|
127
|
-
},
|
|
128
|
-
function
|
|
129
|
-
return
|
|
127
|
+
}, ht = {};
|
|
128
|
+
function Me(e, t) {
|
|
129
|
+
return e instanceof Map ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
if (
|
|
133
|
-
let n = Reflect.getPrototypeOf(
|
|
131
|
+
function $t(e, t) {
|
|
132
|
+
if (t in e) {
|
|
133
|
+
let n = Reflect.getPrototypeOf(e);
|
|
134
134
|
for (; n; ) {
|
|
135
|
-
const s = Reflect.getOwnPropertyDescriptor(n,
|
|
135
|
+
const s = Reflect.getOwnPropertyDescriptor(n, t);
|
|
136
136
|
if (s)
|
|
137
137
|
return s;
|
|
138
138
|
n = Reflect.getPrototypeOf(n);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
var
|
|
144
|
-
return (
|
|
142
|
+
function q(e) {
|
|
143
|
+
var t;
|
|
144
|
+
return (t = e.copy) !== null && t !== void 0 ? t : e.original;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
return
|
|
146
|
+
function ge(e) {
|
|
147
|
+
return !!$(e);
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
return typeof
|
|
149
|
+
function $(e) {
|
|
150
|
+
return typeof e != "object" ? null : e == null ? void 0 : e[Vt];
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
var
|
|
154
|
-
const n =
|
|
155
|
-
return n ? (
|
|
152
|
+
function dt(e) {
|
|
153
|
+
var t;
|
|
154
|
+
const n = $(e);
|
|
155
|
+
return n ? (t = n.copy) !== null && t !== void 0 ? t : n.original : e;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
if (!
|
|
157
|
+
function ee(e, t) {
|
|
158
|
+
if (!e || typeof e != "object")
|
|
159
159
|
return !1;
|
|
160
160
|
let n;
|
|
161
|
-
return Object.getPrototypeOf(
|
|
161
|
+
return Object.getPrototypeOf(e) === Object.prototype || Array.isArray(e) || e instanceof Map || e instanceof Set || !!(t != null && t.mark) && ((n = t.mark(e, Y)) === Y.immutable || typeof n == "function");
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
if (Object.hasOwnProperty.call(
|
|
165
|
-
const n =
|
|
166
|
-
if (s !== null && (s == null ? void 0 : s.original) !==
|
|
163
|
+
function Kt(e, t = []) {
|
|
164
|
+
if (Object.hasOwnProperty.call(e, "key")) {
|
|
165
|
+
const n = e.parent.copy, s = $(le(n, e.key));
|
|
166
|
+
if (s !== null && (s == null ? void 0 : s.original) !== e.original)
|
|
167
167
|
return null;
|
|
168
|
-
const i =
|
|
169
|
-
if (!(i && n.size >
|
|
168
|
+
const i = e.parent.type === 3, o = i ? Array.from(e.parent.setMap.keys()).indexOf(e.key) : e.key;
|
|
169
|
+
if (!(i && n.size > o || Me(n, o)))
|
|
170
170
|
return null;
|
|
171
|
-
|
|
171
|
+
t.push(o);
|
|
172
172
|
}
|
|
173
|
-
if (
|
|
174
|
-
return
|
|
175
|
-
|
|
173
|
+
if (e.parent)
|
|
174
|
+
return Kt(e.parent, t);
|
|
175
|
+
t.reverse();
|
|
176
176
|
try {
|
|
177
|
-
|
|
177
|
+
Sn(e.copy, t);
|
|
178
178
|
} catch {
|
|
179
179
|
return null;
|
|
180
180
|
}
|
|
181
|
-
return
|
|
181
|
+
return t;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
return Array.isArray(
|
|
183
|
+
function be(e) {
|
|
184
|
+
return Array.isArray(e) ? 1 : e instanceof Map ? 2 : e instanceof Set ? 3 : 0;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
return
|
|
186
|
+
function le(e, t) {
|
|
187
|
+
return be(e) === 2 ? e.get(t) : e[t];
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
|
|
189
|
+
function xe(e, t, n) {
|
|
190
|
+
be(e) === 2 ? e.set(t, n) : e[t] = n;
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
const n =
|
|
194
|
-
return (n ?
|
|
192
|
+
function qe(e, t) {
|
|
193
|
+
const n = $(e);
|
|
194
|
+
return (n ? q(n) : e)[t];
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
return
|
|
196
|
+
function fe(e, t) {
|
|
197
|
+
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
if (
|
|
201
|
-
for (;
|
|
202
|
-
|
|
199
|
+
function nt(e) {
|
|
200
|
+
if (e)
|
|
201
|
+
for (; e.finalities.revoke.length > 0; )
|
|
202
|
+
e.finalities.revoke.pop()();
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
return
|
|
204
|
+
function _e(e, t) {
|
|
205
|
+
return t ? e : [""].concat(e).map((n) => {
|
|
206
206
|
const s = `${n}`;
|
|
207
207
|
return s.indexOf("/") === -1 && s.indexOf("~") === -1 ? s : s.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
208
208
|
}).join("/");
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
for (let n = 0; n <
|
|
212
|
-
const s =
|
|
213
|
-
if (
|
|
214
|
-
throw new Error(`Cannot resolve patch at '${
|
|
210
|
+
function Sn(e, t) {
|
|
211
|
+
for (let n = 0; n < t.length - 1; n += 1) {
|
|
212
|
+
const s = t[n];
|
|
213
|
+
if (e = le(be(e) === 3 ? Array.from(e) : e, s), typeof e != "object")
|
|
214
|
+
throw new Error(`Cannot resolve patch at '${t.join("/")}'.`);
|
|
215
215
|
}
|
|
216
|
-
return
|
|
216
|
+
return e;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
const
|
|
220
|
-
return Reflect.ownKeys(
|
|
221
|
-
let s = Reflect.getOwnPropertyDescriptor(
|
|
218
|
+
function On(e) {
|
|
219
|
+
const t = Object.create(Object.getPrototypeOf(e));
|
|
220
|
+
return Reflect.ownKeys(e).forEach((n) => {
|
|
221
|
+
let s = Reflect.getOwnPropertyDescriptor(e, n);
|
|
222
222
|
if (s.enumerable && s.configurable && s.writable) {
|
|
223
|
-
|
|
223
|
+
t[n] = e[n];
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
s.writable || (s.writable = !0, s.configurable = !0), (s.get || s.set) && (s = {
|
|
227
227
|
configurable: !0,
|
|
228
228
|
writable: !0,
|
|
229
229
|
enumerable: s.enumerable,
|
|
230
|
-
value:
|
|
231
|
-
}), Reflect.defineProperty(
|
|
232
|
-
}),
|
|
230
|
+
value: e[n]
|
|
231
|
+
}), Reflect.defineProperty(t, n, s);
|
|
232
|
+
}), t;
|
|
233
233
|
}
|
|
234
|
-
const
|
|
235
|
-
function
|
|
234
|
+
const En = Object.prototype.propertyIsEnumerable;
|
|
235
|
+
function Wt(e, t) {
|
|
236
236
|
let n;
|
|
237
|
-
if (Array.isArray(
|
|
238
|
-
return Array.prototype.concat.call(
|
|
239
|
-
if (
|
|
240
|
-
return new Set(
|
|
241
|
-
if (
|
|
242
|
-
return new Map(
|
|
243
|
-
if (
|
|
244
|
-
if (n ===
|
|
245
|
-
return
|
|
237
|
+
if (Array.isArray(e))
|
|
238
|
+
return Array.prototype.concat.call(e);
|
|
239
|
+
if (e instanceof Set)
|
|
240
|
+
return new Set(e.values());
|
|
241
|
+
if (e instanceof Map)
|
|
242
|
+
return new Map(e);
|
|
243
|
+
if (t != null && t.mark && (n = t.mark(e, Y), n !== void 0) && n !== Y.mutable) {
|
|
244
|
+
if (n === Y.immutable)
|
|
245
|
+
return On(e);
|
|
246
246
|
if (typeof n == "function") {
|
|
247
|
-
if (
|
|
247
|
+
if (t.enablePatches || t.enableAutoFreeze)
|
|
248
248
|
throw new Error("You can't use mark and patches or auto freeze together.");
|
|
249
249
|
return n();
|
|
250
250
|
}
|
|
251
251
|
throw new Error(`Unsupported mark result: ${n}`);
|
|
252
|
-
} else if (typeof
|
|
252
|
+
} else if (typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype) {
|
|
253
253
|
const s = {};
|
|
254
|
-
return Object.keys(
|
|
255
|
-
s[i] =
|
|
256
|
-
}), Object.getOwnPropertySymbols(
|
|
257
|
-
|
|
254
|
+
return Object.keys(e).forEach((i) => {
|
|
255
|
+
s[i] = e[i];
|
|
256
|
+
}), Object.getOwnPropertySymbols(e).forEach((i) => {
|
|
257
|
+
En.call(e, i) && (s[i] = e[i]);
|
|
258
258
|
}), s;
|
|
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
|
|
263
|
-
|
|
262
|
+
function J(e) {
|
|
263
|
+
e.copy || (e.copy = Wt(e.original, e.options));
|
|
264
264
|
}
|
|
265
|
-
function
|
|
266
|
-
if (!
|
|
267
|
-
return
|
|
268
|
-
if (Array.isArray(
|
|
269
|
-
return
|
|
270
|
-
if (
|
|
271
|
-
return new Map(Array.from(
|
|
272
|
-
if (
|
|
273
|
-
return new Set(Array.from(
|
|
274
|
-
const
|
|
275
|
-
for (const n in
|
|
276
|
-
|
|
277
|
-
return
|
|
265
|
+
function Se(e) {
|
|
266
|
+
if (!ee(e))
|
|
267
|
+
return dt(e);
|
|
268
|
+
if (Array.isArray(e))
|
|
269
|
+
return e.map(Se);
|
|
270
|
+
if (e instanceof Map)
|
|
271
|
+
return new Map(Array.from(e.entries()).map(([n, s]) => [n, Se(s)]));
|
|
272
|
+
if (e instanceof Set)
|
|
273
|
+
return new Set(Array.from(e).map(Se));
|
|
274
|
+
const t = Object.create(Object.getPrototypeOf(e));
|
|
275
|
+
for (const n in e)
|
|
276
|
+
t[n] = Se(e[n]);
|
|
277
|
+
return t;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
280
|
-
return
|
|
279
|
+
function je(e) {
|
|
280
|
+
return ge(e) ? Se(e) : e;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
var
|
|
284
|
-
|
|
282
|
+
function re(e) {
|
|
283
|
+
var t;
|
|
284
|
+
e.assignedMap = (t = e.assignedMap) !== null && t !== void 0 ? t : /* @__PURE__ */ new Map(), e.operated || (e.operated = !0, e.parent && re(e.parent));
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function xt() {
|
|
287
287
|
throw new Error("Cannot modify frozen object");
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function we(e, t, n, s, i) {
|
|
290
290
|
{
|
|
291
291
|
n = n ?? /* @__PURE__ */ new WeakMap(), s = s ?? [], i = i ?? [];
|
|
292
|
-
const r = n.has(
|
|
292
|
+
const r = n.has(e) ? n.get(e) : e;
|
|
293
293
|
if (s.length > 0) {
|
|
294
|
-
const
|
|
295
|
-
if (r && typeof r == "object" &&
|
|
296
|
-
throw s[0] === r ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0,
|
|
297
|
-
if (typeof
|
|
298
|
-
return `[${
|
|
299
|
-
const c = s[
|
|
300
|
-
return typeof
|
|
294
|
+
const a = s.indexOf(r);
|
|
295
|
+
if (r && typeof r == "object" && a !== -1)
|
|
296
|
+
throw s[0] === r ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, a).map((u, f) => {
|
|
297
|
+
if (typeof u == "symbol")
|
|
298
|
+
return `[${u.toString()}]`;
|
|
299
|
+
const c = s[f];
|
|
300
|
+
return typeof u == "object" && (c instanceof Map || c instanceof Set) ? Array.from(c.keys()).indexOf(u) : u;
|
|
301
301
|
}).join("/")}`);
|
|
302
|
-
s.push(r), i.push(
|
|
302
|
+
s.push(r), i.push(t);
|
|
303
303
|
} else
|
|
304
304
|
s.push(r);
|
|
305
305
|
}
|
|
306
|
-
if (Object.isFrozen(
|
|
306
|
+
if (Object.isFrozen(e) || ge(e)) {
|
|
307
307
|
s.pop(), i.pop();
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
310
|
-
switch (
|
|
310
|
+
switch (be(e)) {
|
|
311
311
|
case 2:
|
|
312
|
-
for (const [
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
for (const [a, u] of e)
|
|
313
|
+
we(a, a, n, s, i), we(u, a, n, s, i);
|
|
314
|
+
e.set = e.clear = e.delete = xt;
|
|
315
315
|
break;
|
|
316
316
|
case 3:
|
|
317
|
-
for (const
|
|
318
|
-
|
|
319
|
-
|
|
317
|
+
for (const a of e)
|
|
318
|
+
we(a, a, n, s, i);
|
|
319
|
+
e.add = e.clear = e.delete = xt;
|
|
320
320
|
break;
|
|
321
321
|
case 1:
|
|
322
|
-
Object.freeze(
|
|
322
|
+
Object.freeze(e);
|
|
323
323
|
let r = 0;
|
|
324
|
-
for (const
|
|
325
|
-
|
|
324
|
+
for (const a of e)
|
|
325
|
+
we(a, r, n, s, i), r += 1;
|
|
326
326
|
break;
|
|
327
327
|
default:
|
|
328
|
-
Object.freeze(
|
|
329
|
-
const
|
|
330
|
-
|
|
328
|
+
Object.freeze(e), Object.keys(e).forEach((a) => {
|
|
329
|
+
const u = e[a];
|
|
330
|
+
we(u, a, n, s, i);
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
333
|
s.pop(), i.pop();
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
const n =
|
|
335
|
+
function mt(e, t) {
|
|
336
|
+
const n = be(e);
|
|
337
337
|
if (n === 0)
|
|
338
|
-
Reflect.ownKeys(
|
|
339
|
-
|
|
338
|
+
Reflect.ownKeys(e).forEach((s) => {
|
|
339
|
+
t(s, e[s], e);
|
|
340
340
|
});
|
|
341
341
|
else if (n === 1) {
|
|
342
342
|
let s = 0;
|
|
343
|
-
for (const i of
|
|
344
|
-
|
|
343
|
+
for (const i of e)
|
|
344
|
+
t(s, i, e), s += 1;
|
|
345
345
|
} else
|
|
346
|
-
|
|
346
|
+
e.forEach((s, i) => t(i, s, e));
|
|
347
347
|
}
|
|
348
|
-
function
|
|
349
|
-
if (
|
|
348
|
+
function Jt(e, t, n) {
|
|
349
|
+
if (ge(e) || !ee(e, n) || t.has(e) || Object.isFrozen(e))
|
|
350
350
|
return;
|
|
351
|
-
const s =
|
|
352
|
-
if (
|
|
353
|
-
var
|
|
354
|
-
if (
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
const
|
|
358
|
-
|
|
351
|
+
const s = e instanceof Set, i = s ? /* @__PURE__ */ new Map() : void 0;
|
|
352
|
+
if (t.add(e), mt(e, (o, r) => {
|
|
353
|
+
var a;
|
|
354
|
+
if (ge(r)) {
|
|
355
|
+
const u = $(r);
|
|
356
|
+
J(u);
|
|
357
|
+
const f = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
|
|
358
|
+
xe(s ? i : e, o, f);
|
|
359
359
|
} else
|
|
360
|
-
|
|
360
|
+
Jt(r, t, n);
|
|
361
361
|
}), i) {
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
362
|
+
const o = e, r = Array.from(o);
|
|
363
|
+
o.clear(), r.forEach((a) => {
|
|
364
|
+
o.add(i.has(a) ? i.get(a) : a);
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
function
|
|
369
|
-
const n =
|
|
370
|
-
|
|
368
|
+
function Mn(e, t) {
|
|
369
|
+
const n = e.type === 3 ? e.setMap : e.copy;
|
|
370
|
+
e.finalities.revoke.length > 1 && e.assignedMap.get(t) && n && Jt(le(n, t), e.finalities.handledSet, e.options);
|
|
371
371
|
}
|
|
372
|
-
function
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
function st(e) {
|
|
373
|
+
e.type === 3 && e.copy && (e.copy.clear(), e.setMap.forEach((t) => {
|
|
374
|
+
e.copy.add(dt(t));
|
|
375
375
|
}));
|
|
376
376
|
}
|
|
377
|
-
function
|
|
378
|
-
if (
|
|
377
|
+
function it(e, t, n, s) {
|
|
378
|
+
if (e.operated && e.assignedMap && e.assignedMap.size > 0 && !e.finalized) {
|
|
379
379
|
if (n && s) {
|
|
380
|
-
const
|
|
381
|
-
|
|
380
|
+
const o = Kt(e);
|
|
381
|
+
o && t(e, o, n, s);
|
|
382
382
|
}
|
|
383
|
-
|
|
383
|
+
e.finalized = !0;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
function
|
|
387
|
-
const i =
|
|
388
|
-
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((
|
|
389
|
-
var
|
|
390
|
-
const
|
|
391
|
-
if (
|
|
392
|
-
let
|
|
393
|
-
i.copy && (
|
|
394
|
-
}
|
|
395
|
-
}),
|
|
396
|
-
const
|
|
397
|
-
|
|
386
|
+
function yt(e, t, n, s) {
|
|
387
|
+
const i = $(n);
|
|
388
|
+
i && (i.callbacks || (i.callbacks = []), i.callbacks.push((o, r) => {
|
|
389
|
+
var a;
|
|
390
|
+
const u = e.type === 3 ? e.setMap : e.copy;
|
|
391
|
+
if (fe(le(u, t), n)) {
|
|
392
|
+
let f = i.original;
|
|
393
|
+
i.copy && (f = i.copy), st(e), it(e, s, o, r), e.options.enableAutoFreeze && (e.options.updatedValues = (a = e.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), e.options.updatedValues.set(f, i.original)), xe(u, t, f);
|
|
394
|
+
}
|
|
395
|
+
}), e.options.enableAutoFreeze && i.finalities !== e.finalities && (e.options.enableAutoFreeze = !1)), ee(n, e.options) && e.finalities.draft.push(() => {
|
|
396
|
+
const o = e.type === 3 ? e.setMap : e.copy;
|
|
397
|
+
fe(le(o, t), n) && Mn(e, t);
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
|
-
function
|
|
401
|
-
let { original:
|
|
402
|
-
|
|
403
|
-
for (let
|
|
404
|
-
if (r.get(
|
|
405
|
-
const c =
|
|
400
|
+
function In(e, t, n, s, i) {
|
|
401
|
+
let { original: o, assignedMap: r, options: a } = e, u = e.copy;
|
|
402
|
+
u.length < o.length && ([o, u] = [u, o], [n, s] = [s, n]);
|
|
403
|
+
for (let f = 0; f < o.length; f += 1)
|
|
404
|
+
if (r.get(f.toString()) && u[f] !== o[f]) {
|
|
405
|
+
const c = t.concat([f]), d = _e(c, i);
|
|
406
406
|
n.push({
|
|
407
|
-
op:
|
|
408
|
-
path:
|
|
407
|
+
op: U.Replace,
|
|
408
|
+
path: d,
|
|
409
409
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
410
|
-
value:
|
|
410
|
+
value: je(u[f])
|
|
411
411
|
}), s.push({
|
|
412
|
-
op:
|
|
413
|
-
path:
|
|
412
|
+
op: U.Replace,
|
|
413
|
+
path: d,
|
|
414
414
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
415
|
-
value:
|
|
415
|
+
value: je(o[f])
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
|
-
for (let
|
|
419
|
-
const c =
|
|
418
|
+
for (let f = o.length; f < u.length; f += 1) {
|
|
419
|
+
const c = t.concat([f]), d = _e(c, i);
|
|
420
420
|
n.push({
|
|
421
|
-
op:
|
|
422
|
-
path:
|
|
421
|
+
op: U.Add,
|
|
422
|
+
path: d,
|
|
423
423
|
// If it is a draft, it needs to be deep cloned, and it may also be non-draft.
|
|
424
|
-
value:
|
|
424
|
+
value: je(u[f])
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
|
-
if (
|
|
428
|
-
const { arrayLengthAssignment:
|
|
429
|
-
if (
|
|
430
|
-
const c =
|
|
427
|
+
if (o.length < u.length) {
|
|
428
|
+
const { arrayLengthAssignment: f = !0 } = a.enablePatches;
|
|
429
|
+
if (f) {
|
|
430
|
+
const c = t.concat(["length"]), d = _e(c, i);
|
|
431
431
|
s.push({
|
|
432
|
-
op:
|
|
433
|
-
path:
|
|
434
|
-
value:
|
|
432
|
+
op: U.Replace,
|
|
433
|
+
path: d,
|
|
434
|
+
value: o.length
|
|
435
435
|
});
|
|
436
436
|
} else
|
|
437
|
-
for (let c =
|
|
438
|
-
const
|
|
437
|
+
for (let c = u.length; o.length < c; c -= 1) {
|
|
438
|
+
const d = t.concat([c - 1]), g = _e(d, i);
|
|
439
439
|
s.push({
|
|
440
|
-
op:
|
|
441
|
-
path:
|
|
440
|
+
op: U.Remove,
|
|
441
|
+
path: g
|
|
442
442
|
});
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
function
|
|
447
|
-
n.forEach((
|
|
448
|
-
const
|
|
449
|
-
if (
|
|
446
|
+
function Cn({ original: e, copy: t, assignedMap: n }, s, i, o, r) {
|
|
447
|
+
n.forEach((a, u) => {
|
|
448
|
+
const f = le(e, u), c = je(le(t, u)), d = a ? Me(e, u) ? U.Replace : U.Add : U.Remove;
|
|
449
|
+
if (fe(f, c) && d === U.Replace)
|
|
450
450
|
return;
|
|
451
|
-
const
|
|
452
|
-
i.push(
|
|
451
|
+
const g = s.concat(u), w = _e(g, r);
|
|
452
|
+
i.push(d === U.Remove ? { op: d, path: w } : { op: d, path: w, value: c }), o.push(d === U.Add ? { op: U.Remove, path: w } : d === U.Remove ? { op: U.Add, path: w, value: f } : { op: U.Replace, path: w, value: f });
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function $n({ original: e, copy: t }, n, s, i, o) {
|
|
456
456
|
let r = 0;
|
|
457
|
-
|
|
458
|
-
if (!
|
|
459
|
-
const
|
|
457
|
+
e.forEach((a) => {
|
|
458
|
+
if (!t.has(a)) {
|
|
459
|
+
const u = n.concat([r]), f = _e(u, o);
|
|
460
460
|
s.push({
|
|
461
|
-
op:
|
|
462
|
-
path:
|
|
463
|
-
value:
|
|
461
|
+
op: U.Remove,
|
|
462
|
+
path: f,
|
|
463
|
+
value: a
|
|
464
464
|
}), i.unshift({
|
|
465
|
-
op:
|
|
466
|
-
path:
|
|
467
|
-
value:
|
|
465
|
+
op: U.Add,
|
|
466
|
+
path: f,
|
|
467
|
+
value: a
|
|
468
468
|
});
|
|
469
469
|
}
|
|
470
470
|
r += 1;
|
|
471
|
-
}), r = 0,
|
|
472
|
-
if (!
|
|
473
|
-
const
|
|
471
|
+
}), r = 0, t.forEach((a) => {
|
|
472
|
+
if (!e.has(a)) {
|
|
473
|
+
const u = n.concat([r]), f = _e(u, o);
|
|
474
474
|
s.push({
|
|
475
|
-
op:
|
|
476
|
-
path:
|
|
477
|
-
value:
|
|
475
|
+
op: U.Add,
|
|
476
|
+
path: f,
|
|
477
|
+
value: a
|
|
478
478
|
}), i.unshift({
|
|
479
|
-
op:
|
|
480
|
-
path:
|
|
481
|
-
value:
|
|
479
|
+
op: U.Remove,
|
|
480
|
+
path: f,
|
|
481
|
+
value: a
|
|
482
482
|
});
|
|
483
483
|
}
|
|
484
484
|
r += 1;
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
|
-
function
|
|
488
|
-
const { pathAsArray: i = !0 } =
|
|
489
|
-
switch (
|
|
487
|
+
function Ce(e, t, n, s) {
|
|
488
|
+
const { pathAsArray: i = !0 } = e.options.enablePatches;
|
|
489
|
+
switch (e.type) {
|
|
490
490
|
case 0:
|
|
491
491
|
case 2:
|
|
492
|
-
return
|
|
492
|
+
return Cn(e, t, n, s, i);
|
|
493
493
|
case 1:
|
|
494
|
-
return
|
|
494
|
+
return In(e, t, n, s, i);
|
|
495
495
|
case 3:
|
|
496
|
-
return
|
|
496
|
+
return $n(e, t, n, s, i);
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
|
-
let
|
|
500
|
-
const
|
|
501
|
-
if (typeof
|
|
499
|
+
let xn = !1;
|
|
500
|
+
const Ue = (e, t, n = !1) => {
|
|
501
|
+
if (typeof e == "object" && e !== null && (!ee(e, t) || n) && !xn)
|
|
502
502
|
throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
|
|
503
|
-
},
|
|
503
|
+
}, rt = {
|
|
504
504
|
get size() {
|
|
505
|
-
return
|
|
505
|
+
return q($(this)).size;
|
|
506
506
|
},
|
|
507
|
-
has(
|
|
508
|
-
return
|
|
507
|
+
has(e) {
|
|
508
|
+
return q($(this)).has(e);
|
|
509
509
|
},
|
|
510
|
-
set(
|
|
511
|
-
const n =
|
|
512
|
-
return (!s.has(
|
|
510
|
+
set(e, t) {
|
|
511
|
+
const n = $(this), s = q(n);
|
|
512
|
+
return (!s.has(e) || !fe(s.get(e), t)) && (J(n), re(n), n.assignedMap.set(e, !0), n.copy.set(e, t), yt(n, e, t, Ce)), this;
|
|
513
513
|
},
|
|
514
|
-
delete(
|
|
515
|
-
if (!this.has(
|
|
514
|
+
delete(e) {
|
|
515
|
+
if (!this.has(e))
|
|
516
516
|
return !1;
|
|
517
|
-
const
|
|
518
|
-
return
|
|
517
|
+
const t = $(this);
|
|
518
|
+
return J(t), re(t), t.original.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.copy.delete(e), !0;
|
|
519
519
|
},
|
|
520
520
|
clear() {
|
|
521
|
-
const
|
|
521
|
+
const e = $(this);
|
|
522
522
|
if (this.size) {
|
|
523
|
-
|
|
524
|
-
for (const [
|
|
525
|
-
|
|
526
|
-
|
|
523
|
+
J(e), re(e), e.assignedMap = /* @__PURE__ */ new Map();
|
|
524
|
+
for (const [t] of e.original)
|
|
525
|
+
e.assignedMap.set(t, !1);
|
|
526
|
+
e.copy.clear();
|
|
527
527
|
}
|
|
528
528
|
},
|
|
529
|
-
forEach(
|
|
530
|
-
const n =
|
|
531
|
-
|
|
532
|
-
|
|
529
|
+
forEach(e, t) {
|
|
530
|
+
const n = $(this);
|
|
531
|
+
q(n).forEach((s, i) => {
|
|
532
|
+
e.call(t, this.get(i), i, this);
|
|
533
533
|
});
|
|
534
534
|
},
|
|
535
|
-
get(
|
|
536
|
-
var
|
|
537
|
-
const s =
|
|
538
|
-
if (s.options.strict &&
|
|
535
|
+
get(e) {
|
|
536
|
+
var t, n;
|
|
537
|
+
const s = $(this), i = q(s).get(e), o = ((n = (t = s.options).mark) === null || n === void 0 ? void 0 : n.call(t, i, Y)) === Y.mutable;
|
|
538
|
+
if (s.options.strict && Ue(i, s.options, o), o || s.finalized || !ee(i, s.options) || i !== s.original.get(e))
|
|
539
539
|
return i;
|
|
540
|
-
const r =
|
|
540
|
+
const r = ht.createDraft({
|
|
541
541
|
original: i,
|
|
542
542
|
parentDraft: s,
|
|
543
|
-
key:
|
|
543
|
+
key: e,
|
|
544
544
|
finalities: s.finalities,
|
|
545
545
|
options: s.options
|
|
546
546
|
});
|
|
547
|
-
return
|
|
547
|
+
return J(s), s.copy.set(e, r), r;
|
|
548
548
|
},
|
|
549
549
|
keys() {
|
|
550
|
-
return
|
|
550
|
+
return q($(this)).keys();
|
|
551
551
|
},
|
|
552
552
|
values() {
|
|
553
|
-
const
|
|
553
|
+
const e = this.keys();
|
|
554
554
|
return {
|
|
555
|
-
[
|
|
555
|
+
[Ne]: () => this.values(),
|
|
556
556
|
next: () => {
|
|
557
|
-
const
|
|
558
|
-
return
|
|
557
|
+
const t = e.next();
|
|
558
|
+
return t.done ? t : {
|
|
559
559
|
done: !1,
|
|
560
|
-
value: this.get(
|
|
560
|
+
value: this.get(t.value)
|
|
561
561
|
};
|
|
562
562
|
}
|
|
563
563
|
};
|
|
564
564
|
},
|
|
565
565
|
entries() {
|
|
566
|
-
const
|
|
566
|
+
const e = this.keys();
|
|
567
567
|
return {
|
|
568
|
-
[
|
|
568
|
+
[Ne]: () => this.entries(),
|
|
569
569
|
next: () => {
|
|
570
|
-
const
|
|
571
|
-
if (
|
|
572
|
-
return
|
|
573
|
-
const n = this.get(
|
|
570
|
+
const t = e.next();
|
|
571
|
+
if (t.done)
|
|
572
|
+
return t;
|
|
573
|
+
const n = this.get(t.value);
|
|
574
574
|
return {
|
|
575
575
|
done: !1,
|
|
576
|
-
value: [
|
|
576
|
+
value: [t.value, n]
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
579
|
};
|
|
580
580
|
},
|
|
581
|
-
[
|
|
581
|
+
[Ne]() {
|
|
582
582
|
return this.entries();
|
|
583
583
|
}
|
|
584
|
-
},
|
|
584
|
+
}, Ln = Reflect.ownKeys(rt), Lt = (e, t, { isValuesIterator: n }) => () => {
|
|
585
585
|
var s, i;
|
|
586
|
-
const
|
|
587
|
-
if (
|
|
588
|
-
return
|
|
589
|
-
const r =
|
|
590
|
-
let
|
|
591
|
-
const
|
|
592
|
-
if (
|
|
593
|
-
const c =
|
|
586
|
+
const o = t.next();
|
|
587
|
+
if (o.done)
|
|
588
|
+
return o;
|
|
589
|
+
const r = o.value;
|
|
590
|
+
let a = e.setMap.get(r);
|
|
591
|
+
const u = $(a), f = ((i = (s = e.options).mark) === null || i === void 0 ? void 0 : i.call(s, a, Y)) === Y.mutable;
|
|
592
|
+
if (e.options.strict && Ue(r, e.options, f), !f && !u && ee(r, e.options) && !e.finalized && e.original.has(r)) {
|
|
593
|
+
const c = ht.createDraft({
|
|
594
594
|
original: r,
|
|
595
|
-
parentDraft:
|
|
595
|
+
parentDraft: e,
|
|
596
596
|
key: r,
|
|
597
|
-
finalities:
|
|
598
|
-
options:
|
|
597
|
+
finalities: e.finalities,
|
|
598
|
+
options: e.options
|
|
599
599
|
});
|
|
600
|
-
|
|
600
|
+
e.setMap.set(r, c), a = c;
|
|
601
601
|
} else
|
|
602
|
-
|
|
602
|
+
u && (a = u.proxy);
|
|
603
603
|
return {
|
|
604
604
|
done: !1,
|
|
605
|
-
value: n ?
|
|
605
|
+
value: n ? a : [a, a]
|
|
606
606
|
};
|
|
607
|
-
},
|
|
607
|
+
}, ot = {
|
|
608
608
|
get size() {
|
|
609
|
-
return
|
|
609
|
+
return $(this).setMap.size;
|
|
610
610
|
},
|
|
611
|
-
has(
|
|
612
|
-
const
|
|
613
|
-
if (
|
|
611
|
+
has(e) {
|
|
612
|
+
const t = $(this);
|
|
613
|
+
if (t.setMap.has(e))
|
|
614
614
|
return !0;
|
|
615
|
-
|
|
616
|
-
const n =
|
|
617
|
-
return !!(n &&
|
|
615
|
+
J(t);
|
|
616
|
+
const n = $(e);
|
|
617
|
+
return !!(n && t.setMap.has(n.original));
|
|
618
618
|
},
|
|
619
|
-
add(
|
|
620
|
-
const
|
|
621
|
-
return this.has(
|
|
619
|
+
add(e) {
|
|
620
|
+
const t = $(this);
|
|
621
|
+
return this.has(e) || (J(t), re(t), t.assignedMap.set(e, !0), t.setMap.set(e, e), yt(t, e, e, Ce)), this;
|
|
622
622
|
},
|
|
623
|
-
delete(
|
|
624
|
-
if (!this.has(
|
|
623
|
+
delete(e) {
|
|
624
|
+
if (!this.has(e))
|
|
625
625
|
return !1;
|
|
626
|
-
const
|
|
627
|
-
|
|
628
|
-
const n =
|
|
629
|
-
return n &&
|
|
626
|
+
const t = $(this);
|
|
627
|
+
J(t), re(t);
|
|
628
|
+
const n = $(e);
|
|
629
|
+
return n && t.setMap.has(n.original) ? (t.assignedMap.set(n.original, !1), t.setMap.delete(n.original)) : (!n && t.setMap.has(e) ? t.assignedMap.set(e, !1) : t.assignedMap.delete(e), t.setMap.delete(e));
|
|
630
630
|
},
|
|
631
631
|
clear() {
|
|
632
632
|
if (!this.size)
|
|
633
633
|
return;
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
for (const
|
|
637
|
-
|
|
638
|
-
|
|
634
|
+
const e = $(this);
|
|
635
|
+
J(e), re(e);
|
|
636
|
+
for (const t of e.original)
|
|
637
|
+
e.assignedMap.set(t, !1);
|
|
638
|
+
e.setMap.clear();
|
|
639
639
|
},
|
|
640
640
|
values() {
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
const
|
|
641
|
+
const e = $(this);
|
|
642
|
+
J(e);
|
|
643
|
+
const t = e.setMap.keys();
|
|
644
644
|
return {
|
|
645
645
|
[Symbol.iterator]: () => this.values(),
|
|
646
|
-
next:
|
|
646
|
+
next: Lt(e, t, { isValuesIterator: !0 })
|
|
647
647
|
};
|
|
648
648
|
},
|
|
649
649
|
entries() {
|
|
650
|
-
const
|
|
651
|
-
|
|
652
|
-
const
|
|
650
|
+
const e = $(this);
|
|
651
|
+
J(e);
|
|
652
|
+
const t = e.setMap.keys();
|
|
653
653
|
return {
|
|
654
654
|
[Symbol.iterator]: () => this.entries(),
|
|
655
|
-
next:
|
|
655
|
+
next: Lt(e, t, {
|
|
656
656
|
isValuesIterator: !1
|
|
657
657
|
})
|
|
658
658
|
};
|
|
@@ -660,99 +660,99 @@ const ue = (t, e, n = !1) => {
|
|
|
660
660
|
keys() {
|
|
661
661
|
return this.values();
|
|
662
662
|
},
|
|
663
|
-
[
|
|
663
|
+
[Ne]() {
|
|
664
664
|
return this.values();
|
|
665
665
|
},
|
|
666
|
-
forEach(
|
|
666
|
+
forEach(e, t) {
|
|
667
667
|
const n = this.values();
|
|
668
668
|
let s = n.next();
|
|
669
669
|
for (; !s.done; )
|
|
670
|
-
|
|
670
|
+
e.call(t, s.value, s.value, this), s = n.next();
|
|
671
671
|
}
|
|
672
|
-
},
|
|
673
|
-
get(
|
|
672
|
+
}, Tn = Reflect.ownKeys(ot), Xt = /* @__PURE__ */ new WeakSet(), qt = {
|
|
673
|
+
get(e, t, n) {
|
|
674
674
|
var s, i;
|
|
675
|
-
const
|
|
676
|
-
if (
|
|
677
|
-
return
|
|
678
|
-
if (
|
|
679
|
-
return
|
|
675
|
+
const o = (s = e.copy) === null || s === void 0 ? void 0 : s[t];
|
|
676
|
+
if (o && Xt.has(o))
|
|
677
|
+
return o;
|
|
678
|
+
if (t === Vt)
|
|
679
|
+
return e;
|
|
680
680
|
let r;
|
|
681
|
-
if (
|
|
682
|
-
const
|
|
683
|
-
if (r =
|
|
684
|
-
return
|
|
685
|
-
}
|
|
686
|
-
const
|
|
687
|
-
if (
|
|
688
|
-
if (
|
|
689
|
-
return Object.getOwnPropertyDescriptor(
|
|
690
|
-
const
|
|
691
|
-
if (
|
|
692
|
-
return
|
|
693
|
-
}
|
|
694
|
-
if (
|
|
695
|
-
if (
|
|
696
|
-
return Object.getOwnPropertyDescriptor(
|
|
697
|
-
const
|
|
698
|
-
if (
|
|
699
|
-
return
|
|
700
|
-
}
|
|
701
|
-
if (!
|
|
702
|
-
const
|
|
703
|
-
return
|
|
681
|
+
if (e.options.mark) {
|
|
682
|
+
const f = t === "size" && (e.original instanceof Map || e.original instanceof Set) ? Reflect.get(e.original, t) : Reflect.get(e.original, t, n);
|
|
683
|
+
if (r = e.options.mark(f, Y), r === Y.mutable)
|
|
684
|
+
return e.options.strict && Ue(f, e.options, !0), f;
|
|
685
|
+
}
|
|
686
|
+
const a = q(e);
|
|
687
|
+
if (a instanceof Map && Ln.includes(t)) {
|
|
688
|
+
if (t === "size")
|
|
689
|
+
return Object.getOwnPropertyDescriptor(rt, "size").get.call(e.proxy);
|
|
690
|
+
const f = rt[t];
|
|
691
|
+
if (f)
|
|
692
|
+
return f.bind(e.proxy);
|
|
693
|
+
}
|
|
694
|
+
if (a instanceof Set && Tn.includes(t)) {
|
|
695
|
+
if (t === "size")
|
|
696
|
+
return Object.getOwnPropertyDescriptor(ot, "size").get.call(e.proxy);
|
|
697
|
+
const f = ot[t];
|
|
698
|
+
if (f)
|
|
699
|
+
return f.bind(e.proxy);
|
|
700
|
+
}
|
|
701
|
+
if (!Me(a, t)) {
|
|
702
|
+
const f = $t(a, t);
|
|
703
|
+
return f ? "value" in f ? f.value : (
|
|
704
704
|
// !case: support for getter
|
|
705
|
-
(i =
|
|
705
|
+
(i = f.get) === null || i === void 0 ? void 0 : i.call(e.proxy)
|
|
706
706
|
) : void 0;
|
|
707
707
|
}
|
|
708
|
-
const
|
|
709
|
-
if (
|
|
710
|
-
return
|
|
711
|
-
if (
|
|
712
|
-
if (
|
|
713
|
-
original:
|
|
714
|
-
parentDraft:
|
|
715
|
-
key:
|
|
716
|
-
finalities:
|
|
717
|
-
options:
|
|
708
|
+
const u = a[t];
|
|
709
|
+
if (e.options.strict && Ue(u, e.options), e.finalized || !ee(u, e.options))
|
|
710
|
+
return u;
|
|
711
|
+
if (u === qe(e.original, t)) {
|
|
712
|
+
if (J(e), e.copy[t] = _t({
|
|
713
|
+
original: e.original[t],
|
|
714
|
+
parentDraft: e,
|
|
715
|
+
key: e.type === 1 ? Number(t) : t,
|
|
716
|
+
finalities: e.finalities,
|
|
717
|
+
options: e.options
|
|
718
718
|
}), typeof r == "function") {
|
|
719
|
-
const
|
|
720
|
-
return
|
|
719
|
+
const f = $(e.copy[t]);
|
|
720
|
+
return J(f), re(f), f.copy;
|
|
721
721
|
}
|
|
722
|
-
return
|
|
722
|
+
return e.copy[t];
|
|
723
723
|
}
|
|
724
|
-
return
|
|
724
|
+
return u;
|
|
725
725
|
},
|
|
726
|
-
set(
|
|
726
|
+
set(e, t, n) {
|
|
727
727
|
var s;
|
|
728
|
-
if (
|
|
728
|
+
if (e.type === 3 || e.type === 2)
|
|
729
729
|
throw new Error("Map/Set draft does not support any property assignment.");
|
|
730
730
|
let i;
|
|
731
|
-
if (
|
|
731
|
+
if (e.type === 1 && t !== "length" && !(Number.isInteger(i = Number(t)) && i >= 0 && (t === 0 || i === 0 || String(i) === String(t))))
|
|
732
732
|
throw new Error("Only supports setting array indices and the 'length' property.");
|
|
733
|
-
const
|
|
734
|
-
if (
|
|
735
|
-
return
|
|
736
|
-
const r =
|
|
737
|
-
return
|
|
733
|
+
const o = $t(q(e), t);
|
|
734
|
+
if (o != null && o.set)
|
|
735
|
+
return o.set.call(e.proxy, n), !0;
|
|
736
|
+
const r = qe(q(e), t), a = $(r);
|
|
737
|
+
return a && fe(a.original, n) ? (e.copy[t] = n, e.assignedMap = (s = e.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), e.assignedMap.set(t, !1), !0) : (fe(n, r) && (n !== void 0 || Me(e.original, t)) || (J(e), re(e), Me(e.original, t) && fe(n, e.original[t]) ? e.assignedMap.delete(t) : e.assignedMap.set(t, !0), e.copy[t] = n, yt(e, t, n, Ce)), !0);
|
|
738
738
|
},
|
|
739
|
-
has(
|
|
740
|
-
return
|
|
739
|
+
has(e, t) {
|
|
740
|
+
return t in q(e);
|
|
741
741
|
},
|
|
742
|
-
ownKeys(
|
|
743
|
-
return Reflect.ownKeys(
|
|
742
|
+
ownKeys(e) {
|
|
743
|
+
return Reflect.ownKeys(q(e));
|
|
744
744
|
},
|
|
745
|
-
getOwnPropertyDescriptor(
|
|
746
|
-
const n =
|
|
745
|
+
getOwnPropertyDescriptor(e, t) {
|
|
746
|
+
const n = q(e), s = Reflect.getOwnPropertyDescriptor(n, t);
|
|
747
747
|
return s && {
|
|
748
748
|
writable: !0,
|
|
749
|
-
configurable:
|
|
749
|
+
configurable: e.type !== 1 || t !== "length",
|
|
750
750
|
enumerable: s.enumerable,
|
|
751
|
-
value: n[
|
|
751
|
+
value: n[t]
|
|
752
752
|
};
|
|
753
753
|
},
|
|
754
|
-
getPrototypeOf(
|
|
755
|
-
return Reflect.getPrototypeOf(
|
|
754
|
+
getPrototypeOf(e) {
|
|
755
|
+
return Reflect.getPrototypeOf(e.original);
|
|
756
756
|
},
|
|
757
757
|
setPrototypeOf() {
|
|
758
758
|
throw new Error("Cannot call 'setPrototypeOf()' on drafts");
|
|
@@ -760,702 +760,702 @@ const ue = (t, e, n = !1) => {
|
|
|
760
760
|
defineProperty() {
|
|
761
761
|
throw new Error("Cannot call 'defineProperty()' on drafts");
|
|
762
762
|
},
|
|
763
|
-
deleteProperty(
|
|
763
|
+
deleteProperty(e, t) {
|
|
764
764
|
var n;
|
|
765
|
-
return
|
|
765
|
+
return e.type === 1 ? qt.set.call(this, e, t, void 0, e.proxy) : (qe(e.original, t) !== void 0 || t in e.original ? (J(e), re(e), e.assignedMap.set(t, !1)) : (e.assignedMap = (n = e.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), e.assignedMap.delete(t)), e.copy && delete e.copy[t], !0);
|
|
766
766
|
}
|
|
767
767
|
};
|
|
768
|
-
function
|
|
769
|
-
const { original:
|
|
768
|
+
function _t(e) {
|
|
769
|
+
const { original: t, parentDraft: n, key: s, finalities: i, options: o } = e, r = be(t), a = {
|
|
770
770
|
type: r,
|
|
771
771
|
finalized: !1,
|
|
772
772
|
parent: n,
|
|
773
|
-
original:
|
|
773
|
+
original: t,
|
|
774
774
|
copy: null,
|
|
775
775
|
proxy: null,
|
|
776
776
|
finalities: i,
|
|
777
|
-
options:
|
|
777
|
+
options: o,
|
|
778
778
|
// Mapping of draft Set items to their corresponding draft values.
|
|
779
|
-
setMap: r === 3 ? new Map(
|
|
779
|
+
setMap: r === 3 ? new Map(t.entries()) : void 0
|
|
780
780
|
};
|
|
781
|
-
(s || "key" in
|
|
782
|
-
const { proxy:
|
|
783
|
-
if (i.revoke.push(
|
|
781
|
+
(s || "key" in e) && (a.key = s);
|
|
782
|
+
const { proxy: u, revoke: f } = Proxy.revocable(r === 1 ? Object.assign([], a) : a, qt);
|
|
783
|
+
if (i.revoke.push(f), Xt.add(u), a.proxy = u, n) {
|
|
784
784
|
const c = n;
|
|
785
|
-
c.finalities.draft.push((
|
|
786
|
-
var
|
|
787
|
-
const
|
|
788
|
-
let
|
|
789
|
-
const
|
|
790
|
-
if (
|
|
791
|
-
let
|
|
792
|
-
|
|
785
|
+
c.finalities.draft.push((d, g) => {
|
|
786
|
+
var w, y;
|
|
787
|
+
const O = $(u);
|
|
788
|
+
let v = c.type === 3 ? c.setMap : c.copy;
|
|
789
|
+
const x = le(v, s), b = $(x);
|
|
790
|
+
if (b) {
|
|
791
|
+
let S = b.original;
|
|
792
|
+
b.operated && (S = dt(x)), st(b), it(b, Ce, d, g), c.options.enableAutoFreeze && (c.options.updatedValues = (w = c.options.updatedValues) !== null && w !== void 0 ? w : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(S, b.original)), xe(v, s, S);
|
|
793
793
|
}
|
|
794
|
-
(
|
|
795
|
-
|
|
794
|
+
(y = O.callbacks) === null || y === void 0 || y.forEach((S) => {
|
|
795
|
+
S(d, g);
|
|
796
796
|
});
|
|
797
797
|
});
|
|
798
798
|
} else {
|
|
799
|
-
const c =
|
|
800
|
-
c.finalities.draft.push((
|
|
801
|
-
|
|
799
|
+
const c = $(u);
|
|
800
|
+
c.finalities.draft.push((d, g) => {
|
|
801
|
+
st(c), it(c, Ce, d, g);
|
|
802
802
|
});
|
|
803
803
|
}
|
|
804
|
-
return
|
|
804
|
+
return u;
|
|
805
805
|
}
|
|
806
|
-
|
|
807
|
-
function
|
|
808
|
-
var
|
|
809
|
-
const r =
|
|
806
|
+
ht.createDraft = _t;
|
|
807
|
+
function Dn(e, t, n, s, i) {
|
|
808
|
+
var o;
|
|
809
|
+
const r = $(e), a = (o = r == null ? void 0 : r.original) !== null && o !== void 0 ? o : e, u = !!t.length;
|
|
810
810
|
if (r != null && r.operated)
|
|
811
811
|
for (; r.finalities.draft.length > 0; )
|
|
812
812
|
r.finalities.draft.pop()(n, s);
|
|
813
|
-
const
|
|
814
|
-
return r &&
|
|
815
|
-
|
|
816
|
-
n &&
|
|
817
|
-
s &&
|
|
813
|
+
const f = u ? t[0] : r ? r.operated ? r.copy : r.original : e;
|
|
814
|
+
return r && nt(r), i && we(f, f, r == null ? void 0 : r.options.updatedValues), [
|
|
815
|
+
f,
|
|
816
|
+
n && u ? [{ op: U.Replace, path: [], value: t[0] }] : n,
|
|
817
|
+
s && u ? [{ op: U.Replace, path: [], value: a }] : s
|
|
818
818
|
];
|
|
819
819
|
}
|
|
820
|
-
function
|
|
820
|
+
function Pn(e, t) {
|
|
821
821
|
var n;
|
|
822
822
|
const s = {
|
|
823
823
|
draft: [],
|
|
824
824
|
revoke: [],
|
|
825
825
|
handledSet: /* @__PURE__ */ new WeakSet()
|
|
826
826
|
};
|
|
827
|
-
let i,
|
|
828
|
-
|
|
829
|
-
const
|
|
830
|
-
original:
|
|
827
|
+
let i, o;
|
|
828
|
+
t.enablePatches && (i = [], o = []);
|
|
829
|
+
const a = ((n = t.mark) === null || n === void 0 ? void 0 : n.call(t, e, Y)) === Y.mutable || !ee(e, t) ? e : _t({
|
|
830
|
+
original: e,
|
|
831
831
|
parentDraft: null,
|
|
832
832
|
finalities: s,
|
|
833
|
-
options:
|
|
833
|
+
options: t
|
|
834
834
|
});
|
|
835
835
|
return [
|
|
836
|
-
|
|
837
|
-
(
|
|
838
|
-
const [
|
|
839
|
-
return
|
|
836
|
+
a,
|
|
837
|
+
(u = []) => {
|
|
838
|
+
const [f, c, d] = Dn(a, u, i, o, t.enableAutoFreeze);
|
|
839
|
+
return t.enablePatches ? [f, c, d] : f;
|
|
840
840
|
}
|
|
841
841
|
];
|
|
842
842
|
}
|
|
843
|
-
function
|
|
844
|
-
const { rootDraft:
|
|
845
|
-
|
|
846
|
-
const
|
|
847
|
-
if (
|
|
848
|
-
|
|
849
|
-
const
|
|
850
|
-
if (
|
|
851
|
-
const c = Array.from(
|
|
852
|
-
|
|
843
|
+
function at(e) {
|
|
844
|
+
const { rootDraft: t, value: n, useRawReturn: s = !1, isRoot: i = !0 } = e;
|
|
845
|
+
mt(n, (o, r, a) => {
|
|
846
|
+
const u = $(r);
|
|
847
|
+
if (u && t && u.finalities === t.finalities) {
|
|
848
|
+
e.isContainDraft = !0;
|
|
849
|
+
const f = u.original;
|
|
850
|
+
if (a instanceof Set) {
|
|
851
|
+
const c = Array.from(a);
|
|
852
|
+
a.clear(), c.forEach((d) => a.add(o === d ? f : d));
|
|
853
853
|
} else
|
|
854
|
-
|
|
854
|
+
xe(a, o, f);
|
|
855
855
|
} else
|
|
856
|
-
typeof r == "object" && r !== null && (
|
|
857
|
-
}), i && (
|
|
856
|
+
typeof r == "object" && r !== null && (e.value = r, e.isRoot = !1, at(e));
|
|
857
|
+
}), i && (e.isContainDraft || console.warn("The return value does not contain any draft, please use 'rawReturn()' to wrap the return value to improve performance."), s && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
|
|
858
858
|
}
|
|
859
|
-
function
|
|
860
|
-
const
|
|
861
|
-
if (!
|
|
862
|
-
return
|
|
863
|
-
const n =
|
|
864
|
-
if (
|
|
865
|
-
return
|
|
859
|
+
function Qt(e) {
|
|
860
|
+
const t = $(e);
|
|
861
|
+
if (!ee(e, t == null ? void 0 : t.options))
|
|
862
|
+
return e;
|
|
863
|
+
const n = be(e);
|
|
864
|
+
if (t && !t.operated)
|
|
865
|
+
return t.original;
|
|
866
866
|
let s;
|
|
867
867
|
function i() {
|
|
868
|
-
s = n === 2 ? new Map(
|
|
868
|
+
s = n === 2 ? new Map(e) : n === 3 ? Array.from(t.setMap.values()) : Wt(e, t == null ? void 0 : t.options);
|
|
869
869
|
}
|
|
870
|
-
if (
|
|
871
|
-
|
|
870
|
+
if (t) {
|
|
871
|
+
t.finalized = !0;
|
|
872
872
|
try {
|
|
873
873
|
i();
|
|
874
874
|
} finally {
|
|
875
|
-
|
|
875
|
+
t.finalized = !1;
|
|
876
876
|
}
|
|
877
877
|
} else
|
|
878
|
-
s =
|
|
879
|
-
return
|
|
880
|
-
if (
|
|
878
|
+
s = e;
|
|
879
|
+
return mt(s, (o, r) => {
|
|
880
|
+
if (t && fe(le(t.original, o), r))
|
|
881
881
|
return;
|
|
882
|
-
const
|
|
883
|
-
|
|
882
|
+
const a = Qt(r);
|
|
883
|
+
a !== r && (s === e && i(), xe(s, o, a));
|
|
884
884
|
}), n === 3 ? new Set(s) : s;
|
|
885
885
|
}
|
|
886
|
-
function
|
|
887
|
-
if (!
|
|
888
|
-
throw new Error(`current() is only used for Draft, parameter: ${
|
|
889
|
-
return
|
|
886
|
+
function Tt(e) {
|
|
887
|
+
if (!ge(e))
|
|
888
|
+
throw new Error(`current() is only used for Draft, parameter: ${e}`);
|
|
889
|
+
return Qt(e);
|
|
890
890
|
}
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
893
|
-
throw new Error(`Invalid options: ${String(
|
|
894
|
-
return function
|
|
895
|
-
var
|
|
891
|
+
const Hn = (e) => {
|
|
892
|
+
if (e !== void 0 && Object.prototype.toString.call(e) !== "[object Object]")
|
|
893
|
+
throw new Error(`Invalid options: ${String(e)}, 'options' should be an object.`);
|
|
894
|
+
return function t(n, s, i) {
|
|
895
|
+
var o, r, a;
|
|
896
896
|
if (typeof n == "function" && typeof s != "function")
|
|
897
|
-
return function(
|
|
898
|
-
return
|
|
897
|
+
return function(R, ...P) {
|
|
898
|
+
return t(R, (A) => n.call(this, A, ...P), s);
|
|
899
899
|
};
|
|
900
|
-
const
|
|
900
|
+
const u = n, f = 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
|
-
c = Object.assign(Object.assign({},
|
|
905
|
-
const
|
|
906
|
-
for (const
|
|
907
|
-
if (typeof
|
|
908
|
-
throw new Error(`Invalid mark: ${
|
|
909
|
-
const
|
|
910
|
-
if (
|
|
911
|
-
return
|
|
904
|
+
c = Object.assign(Object.assign({}, e), c);
|
|
905
|
+
const d = ge(u) ? Tt(u) : u, g = Array.isArray(c.mark) ? (R, P) => {
|
|
906
|
+
for (const A of c.mark) {
|
|
907
|
+
if (typeof A != "function")
|
|
908
|
+
throw new Error(`Invalid mark: ${A}, 'mark' should be a function.`);
|
|
909
|
+
const L = A(R, P);
|
|
910
|
+
if (L)
|
|
911
|
+
return L;
|
|
912
912
|
}
|
|
913
|
-
} : c.mark,
|
|
914
|
-
enableAutoFreeze: (
|
|
915
|
-
mark:
|
|
916
|
-
strict:
|
|
917
|
-
enablePatches:
|
|
913
|
+
} : c.mark, w = (o = c.enablePatches) !== null && o !== void 0 ? o : !1, y = (r = c.strict) !== null && r !== void 0 ? r : !1, v = {
|
|
914
|
+
enableAutoFreeze: (a = c.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
|
|
915
|
+
mark: g,
|
|
916
|
+
strict: y,
|
|
917
|
+
enablePatches: w
|
|
918
918
|
};
|
|
919
|
-
if (!
|
|
919
|
+
if (!ee(d, v) && 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 [
|
|
921
|
+
const [x, b] = Pn(d, v);
|
|
922
922
|
if (typeof s != "function") {
|
|
923
|
-
if (!
|
|
923
|
+
if (!ee(d, v))
|
|
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.");
|
|
925
|
-
return [
|
|
925
|
+
return [x, b];
|
|
926
926
|
}
|
|
927
|
-
let
|
|
927
|
+
let S;
|
|
928
928
|
try {
|
|
929
|
-
|
|
930
|
-
} catch (
|
|
931
|
-
throw
|
|
932
|
-
}
|
|
933
|
-
const
|
|
934
|
-
const
|
|
935
|
-
if (!
|
|
936
|
-
if (
|
|
929
|
+
S = f(x);
|
|
930
|
+
} catch (R) {
|
|
931
|
+
throw nt($(x)), R;
|
|
932
|
+
}
|
|
933
|
+
const M = (R) => {
|
|
934
|
+
const P = $(x);
|
|
935
|
+
if (!ge(R)) {
|
|
936
|
+
if (R !== void 0 && !fe(R, x) && (P != null && P.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
|
|
939
|
-
if (
|
|
940
|
-
const
|
|
941
|
-
return
|
|
942
|
-
rootDraft:
|
|
943
|
-
value:
|
|
938
|
+
const L = R == null ? void 0 : R[An];
|
|
939
|
+
if (L) {
|
|
940
|
+
const z = L[0];
|
|
941
|
+
return v.strict && typeof R == "object" && R !== null && at({
|
|
942
|
+
rootDraft: P,
|
|
943
|
+
value: R,
|
|
944
944
|
useRawReturn: !0
|
|
945
|
-
}),
|
|
945
|
+
}), b([z]);
|
|
946
946
|
}
|
|
947
|
-
if (
|
|
948
|
-
return typeof
|
|
947
|
+
if (R !== void 0)
|
|
948
|
+
return typeof R == "object" && R !== null && at({ rootDraft: P, value: R }), b([R]);
|
|
949
949
|
}
|
|
950
|
-
if (
|
|
951
|
-
return
|
|
952
|
-
const
|
|
953
|
-
if (
|
|
954
|
-
if (
|
|
950
|
+
if (R === x || R === void 0)
|
|
951
|
+
return b([]);
|
|
952
|
+
const A = $(R);
|
|
953
|
+
if (v === A.options) {
|
|
954
|
+
if (A.operated)
|
|
955
955
|
throw new Error("Cannot return a modified child draft.");
|
|
956
|
-
return
|
|
956
|
+
return b([Tt(R)]);
|
|
957
957
|
}
|
|
958
|
-
return
|
|
958
|
+
return b([R]);
|
|
959
959
|
};
|
|
960
|
-
return
|
|
961
|
-
throw
|
|
962
|
-
}) : S
|
|
960
|
+
return S instanceof Promise ? S.then(M, (R) => {
|
|
961
|
+
throw nt($(x)), R;
|
|
962
|
+
}) : M(S);
|
|
963
963
|
};
|
|
964
|
-
},
|
|
964
|
+
}, C = Hn();
|
|
965
965
|
Object.prototype.constructor.toString();
|
|
966
|
-
const
|
|
967
|
-
if (!
|
|
966
|
+
const kn = pt(fetch), Yt = async (e, t) => {
|
|
967
|
+
if (!e)
|
|
968
968
|
throw "Metapage definition null";
|
|
969
|
-
if (!
|
|
969
|
+
if (!e.version)
|
|
970
970
|
throw 'Missing "version" key in metapage definition';
|
|
971
|
-
if (!
|
|
971
|
+
if (!t)
|
|
972
972
|
throw 'Missing "version" argument';
|
|
973
|
-
if (
|
|
973
|
+
if (V(t, Ge) > 0)
|
|
974
974
|
try {
|
|
975
|
-
return await (await
|
|
975
|
+
return await (await kn(`https://module.metapage.io/conversion/metapage/${t}`, {
|
|
976
976
|
redirect: "follow",
|
|
977
977
|
retries: 3,
|
|
978
978
|
retryDelay: 1e3,
|
|
979
979
|
method: "POST",
|
|
980
|
-
body: JSON.stringify(
|
|
980
|
+
body: JSON.stringify(e),
|
|
981
981
|
headers: {
|
|
982
982
|
"Content-Type": "application/json"
|
|
983
983
|
}
|
|
984
984
|
})).json();
|
|
985
985
|
} catch (s) {
|
|
986
|
-
throw `Error converting metapage definition to version ${
|
|
986
|
+
throw `Error converting metapage definition to version ${t}: ${s}`;
|
|
987
987
|
}
|
|
988
|
-
return
|
|
989
|
-
},
|
|
990
|
-
if (!
|
|
988
|
+
return jn(e, t);
|
|
989
|
+
}, Nn = async (e) => Yt(e, Ge), jn = (e, t) => {
|
|
990
|
+
if (!e)
|
|
991
991
|
throw "Metapage definition null";
|
|
992
|
-
if (!
|
|
992
|
+
if (!e.version)
|
|
993
993
|
throw 'Missing "version" key in metapage definition';
|
|
994
|
-
let n =
|
|
995
|
-
if (n ===
|
|
996
|
-
return
|
|
997
|
-
let s =
|
|
998
|
-
for (; n !==
|
|
994
|
+
let n = Re(e.version);
|
|
995
|
+
if (n === t)
|
|
996
|
+
return e;
|
|
997
|
+
let s = e;
|
|
998
|
+
for (; n !== t; )
|
|
999
999
|
switch (n) {
|
|
1000
1000
|
case "0.2": {
|
|
1001
|
-
if (
|
|
1002
|
-
s =
|
|
1001
|
+
if (V(t, n) > 0)
|
|
1002
|
+
s = Un(s), n = Re(s.version);
|
|
1003
1003
|
else
|
|
1004
|
-
throw `Cannot convert from version ${n} to ${
|
|
1004
|
+
throw `Cannot convert from version ${n} to ${t}`;
|
|
1005
1005
|
break;
|
|
1006
1006
|
}
|
|
1007
1007
|
case "0.3": {
|
|
1008
|
-
|
|
1008
|
+
V(t, n) > 0 ? (s = Fn(s), n = Re(s.version)) : (s = Bn(s), n = Re(s.version));
|
|
1009
1009
|
break;
|
|
1010
1010
|
}
|
|
1011
1011
|
case "1": {
|
|
1012
|
-
if (
|
|
1013
|
-
throw `Cannot convert from version ${n} to ${
|
|
1014
|
-
s =
|
|
1012
|
+
if (V(t, n) > 0)
|
|
1013
|
+
throw `Cannot convert from version ${n} to ${t}, 1 is the latest version`;
|
|
1014
|
+
s = zn(s), n = Re(s.version);
|
|
1015
1015
|
break;
|
|
1016
1016
|
}
|
|
1017
1017
|
default:
|
|
1018
|
-
throw `Unknow version ${n} to ${
|
|
1018
|
+
throw `Unknow version ${n} to ${t}`;
|
|
1019
1019
|
}
|
|
1020
1020
|
return s;
|
|
1021
|
-
},
|
|
1022
|
-
|
|
1023
|
-
}),
|
|
1024
|
-
|
|
1025
|
-
}),
|
|
1026
|
-
const n =
|
|
1021
|
+
}, Un = (e) => C(e, (t) => {
|
|
1022
|
+
t.version = "0.3";
|
|
1023
|
+
}), Bn = (e) => C(e, (t) => {
|
|
1024
|
+
t.version = "0.2";
|
|
1025
|
+
}), Fn = (e) => C(e, (t) => {
|
|
1026
|
+
const n = t;
|
|
1027
1027
|
delete n.plugins, n.version = "1";
|
|
1028
|
-
}),
|
|
1029
|
-
if (
|
|
1030
|
-
return
|
|
1031
|
-
if (
|
|
1032
|
-
throw `Unknown version: ${
|
|
1033
|
-
if (
|
|
1028
|
+
}), zn = (e) => C(e, (t) => (t.version = "0.3", t)), Re = (e) => {
|
|
1029
|
+
if (e === "latest")
|
|
1030
|
+
return Ge;
|
|
1031
|
+
if (V(e, "0.2") < 0)
|
|
1032
|
+
throw `Unknown version: ${e}`;
|
|
1033
|
+
if (V(e, "0.2") <= 0 && V(e, "0.3") < 0)
|
|
1034
1034
|
return "0.2";
|
|
1035
|
-
if (
|
|
1035
|
+
if (V(e, "0.3") <= 0)
|
|
1036
1036
|
return "0.3";
|
|
1037
|
-
if (
|
|
1037
|
+
if (e === "1")
|
|
1038
1038
|
return "1";
|
|
1039
|
-
throw `Unknown version: ${
|
|
1040
|
-
},
|
|
1041
|
-
if (!
|
|
1039
|
+
throw `Unknown version: ${e}`;
|
|
1040
|
+
}, Gn = pt(fetch), Zt = async (e, t) => {
|
|
1041
|
+
if (!e)
|
|
1042
1042
|
throw "Metapage definition null";
|
|
1043
|
-
if (!
|
|
1043
|
+
if (!e.version)
|
|
1044
1044
|
throw 'Missing "version" key in metapage definition';
|
|
1045
|
-
if (!
|
|
1045
|
+
if (!t)
|
|
1046
1046
|
throw 'Missing "version" argument';
|
|
1047
|
-
if (
|
|
1047
|
+
if (V(t, ft) > 0)
|
|
1048
1048
|
try {
|
|
1049
|
-
return await (await
|
|
1049
|
+
return await (await Gn(`https://module.metapage.io/conversion/metaframe/${t}`, {
|
|
1050
1050
|
redirect: "follow",
|
|
1051
1051
|
retries: 3,
|
|
1052
1052
|
retryDelay: 1e3,
|
|
1053
1053
|
method: "POST",
|
|
1054
|
-
body: JSON.stringify(
|
|
1054
|
+
body: JSON.stringify(e),
|
|
1055
1055
|
headers: {
|
|
1056
1056
|
"Content-Type": "application/json"
|
|
1057
1057
|
}
|
|
1058
1058
|
})).json();
|
|
1059
1059
|
} catch (s) {
|
|
1060
|
-
throw `Error converting metapage definition to version ${
|
|
1060
|
+
throw `Error converting metapage definition to version ${t}: ${s}`;
|
|
1061
1061
|
}
|
|
1062
|
-
return
|
|
1063
|
-
},
|
|
1064
|
-
if (!
|
|
1062
|
+
return Kn(e, t);
|
|
1063
|
+
}, Vn = async (e) => Zt(e, ft), Kn = (e, t) => {
|
|
1064
|
+
if (!e)
|
|
1065
1065
|
throw "Metaframe definition null";
|
|
1066
|
-
if (!
|
|
1066
|
+
if (!e.version)
|
|
1067
1067
|
throw 'Missing "version" key in metaframe definition';
|
|
1068
|
-
let n =
|
|
1069
|
-
if (n ===
|
|
1070
|
-
return
|
|
1071
|
-
let s =
|
|
1072
|
-
for (; n !==
|
|
1068
|
+
let n = ae(e.version);
|
|
1069
|
+
if (n === t)
|
|
1070
|
+
return e;
|
|
1071
|
+
let s = e;
|
|
1072
|
+
for (; n !== t; )
|
|
1073
1073
|
switch (n) {
|
|
1074
1074
|
case "0.3": {
|
|
1075
|
-
if (
|
|
1076
|
-
s =
|
|
1075
|
+
if (V(t, n) > 0)
|
|
1076
|
+
s = Xn(s), n = ae(s.version);
|
|
1077
1077
|
else
|
|
1078
|
-
throw `Cannot convert from version ${n} to ${
|
|
1078
|
+
throw `Cannot convert from version ${n} to ${t}`;
|
|
1079
1079
|
break;
|
|
1080
1080
|
}
|
|
1081
1081
|
case "0.4": {
|
|
1082
|
-
|
|
1082
|
+
V(t, n) > 0 ? (s = qn(s), n = ae(s.version)) : (s = Jn(s), n = ae(s.version));
|
|
1083
1083
|
break;
|
|
1084
1084
|
}
|
|
1085
1085
|
case "0.5": {
|
|
1086
|
-
|
|
1086
|
+
V(t, n) > 0 ? (s = es(s), n = ae(s.version)) : (s = Qn(s), n = ae(s.version));
|
|
1087
1087
|
break;
|
|
1088
1088
|
}
|
|
1089
1089
|
case "0.6": {
|
|
1090
|
-
|
|
1090
|
+
V(t, n) > 0 ? (s = Yn(s), n = ae(s.version)) : (s = ts(s), n = ae(s.version));
|
|
1091
1091
|
break;
|
|
1092
1092
|
}
|
|
1093
1093
|
case "1": {
|
|
1094
|
-
if (
|
|
1095
|
-
throw `Cannot convert from version ${n} to ${
|
|
1096
|
-
s =
|
|
1094
|
+
if (V(t, n) > 0)
|
|
1095
|
+
throw `Cannot convert from version ${n} to ${t}, 1 is the latest version`;
|
|
1096
|
+
s = Zn(s), n = ae(s.version);
|
|
1097
1097
|
break;
|
|
1098
1098
|
}
|
|
1099
1099
|
default:
|
|
1100
|
-
throw `Unknow version ${n} to ${
|
|
1100
|
+
throw `Unknow version ${n} to ${t}`;
|
|
1101
1101
|
}
|
|
1102
1102
|
return s;
|
|
1103
|
-
},
|
|
1104
|
-
if (
|
|
1105
|
-
return
|
|
1106
|
-
},
|
|
1107
|
-
|
|
1108
|
-
}),
|
|
1109
|
-
|
|
1110
|
-
}),
|
|
1111
|
-
if (
|
|
1103
|
+
}, Wn = async (e, t) => {
|
|
1104
|
+
if (e)
|
|
1105
|
+
return Vn(e);
|
|
1106
|
+
}, Jn = (e) => C(e, (t) => {
|
|
1107
|
+
t.version = "0.3", delete t.allow;
|
|
1108
|
+
}), Xn = (e) => C(e, (t) => {
|
|
1109
|
+
t.version = "0.4";
|
|
1110
|
+
}), qn = (e) => C(e, (t) => {
|
|
1111
|
+
if (t.version = "0.5", !(t != null && t.metadata))
|
|
1112
1112
|
return;
|
|
1113
|
-
const n =
|
|
1114
|
-
delete
|
|
1115
|
-
const s =
|
|
1116
|
-
delete
|
|
1117
|
-
const i =
|
|
1118
|
-
delete
|
|
1119
|
-
}),
|
|
1120
|
-
if (
|
|
1113
|
+
const n = t.metadata.title;
|
|
1114
|
+
delete t.metadata.title, t.metadata.name = n;
|
|
1115
|
+
const s = t.metadata.descriptionUrl;
|
|
1116
|
+
delete t.metadata.descriptionUrl, t.metadata.description = s;
|
|
1117
|
+
const i = t.metadata.keywords;
|
|
1118
|
+
delete t.metadata.keywords, t.metadata.tags = i;
|
|
1119
|
+
}), Qn = (e) => C(e, (t) => {
|
|
1120
|
+
if (t.version = "0.4", !(t != null && t.metadata))
|
|
1121
1121
|
return;
|
|
1122
|
-
const n =
|
|
1123
|
-
delete
|
|
1124
|
-
const s =
|
|
1125
|
-
delete
|
|
1126
|
-
const i =
|
|
1127
|
-
delete
|
|
1128
|
-
}),
|
|
1122
|
+
const n = t.metadata.name;
|
|
1123
|
+
delete t.metadata.name, t.metadata.title = n;
|
|
1124
|
+
const s = t.metadata.description;
|
|
1125
|
+
delete t.metadata.description, t.metadata.descriptionUrl = s;
|
|
1126
|
+
const i = t.metadata.tags;
|
|
1127
|
+
delete t.metadata.tags, t.metadata.keywords = i;
|
|
1128
|
+
}), Yn = (e) => C(e, (t) => {
|
|
1129
1129
|
var n;
|
|
1130
|
-
|
|
1131
|
-
}),
|
|
1130
|
+
t.version = "1", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
|
|
1131
|
+
}), Zn = (e) => C(e, (t) => {
|
|
1132
1132
|
var n;
|
|
1133
|
-
|
|
1134
|
-
}),
|
|
1133
|
+
t.version = "0.6", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
|
|
1134
|
+
}), es = (e) => C(e, (t) => {
|
|
1135
1135
|
var n;
|
|
1136
|
-
|
|
1137
|
-
}),
|
|
1136
|
+
t.version = "0.6", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
|
|
1137
|
+
}), ts = (e) => C(e, (t) => {
|
|
1138
1138
|
var n;
|
|
1139
|
-
|
|
1140
|
-
}),
|
|
1141
|
-
if (
|
|
1142
|
-
return
|
|
1143
|
-
if (
|
|
1144
|
-
throw `Unknown version: ${
|
|
1145
|
-
if (
|
|
1139
|
+
t.version = "0.5", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
|
|
1140
|
+
}), ae = (e) => {
|
|
1141
|
+
if (e === "latest")
|
|
1142
|
+
return ft;
|
|
1143
|
+
if (V(e, "0.3") < 0)
|
|
1144
|
+
throw `Unknown version: ${e}`;
|
|
1145
|
+
if (V(e, "0.3") <= 0)
|
|
1146
1146
|
return "0.3";
|
|
1147
|
-
if (
|
|
1147
|
+
if (V(e, "0.4") <= 0)
|
|
1148
1148
|
return "0.4";
|
|
1149
|
-
if (
|
|
1149
|
+
if (V(e, "0.5") <= 0)
|
|
1150
1150
|
return "0.5";
|
|
1151
|
-
if (
|
|
1151
|
+
if (V(e, "0.6") <= 0)
|
|
1152
1152
|
return "0.6";
|
|
1153
|
-
if (
|
|
1153
|
+
if (e === "1")
|
|
1154
1154
|
return "1";
|
|
1155
|
-
throw `Unknown version: ${
|
|
1155
|
+
throw `Unknown version: ${e}`;
|
|
1156
1156
|
};
|
|
1157
|
-
var
|
|
1158
|
-
for (var
|
|
1159
|
-
|
|
1160
|
-
var
|
|
1161
|
-
var
|
|
1157
|
+
var Ae = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Oe = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
1158
|
+
for (var He = 0; He < Ae.length; He++)
|
|
1159
|
+
Oe[Ae.charCodeAt(He)] = He;
|
|
1160
|
+
var ke = function(e) {
|
|
1161
|
+
var t = new Uint8Array(e), n, s = t.length, i = "";
|
|
1162
1162
|
for (n = 0; n < s; n += 3)
|
|
1163
|
-
i +=
|
|
1163
|
+
i += Ae[t[n] >> 2], i += Ae[(t[n] & 3) << 4 | t[n + 1] >> 4], i += Ae[(t[n + 1] & 15) << 2 | t[n + 2] >> 6], i += Ae[t[n + 2] & 63];
|
|
1164
1164
|
return s % 3 === 2 ? i = i.substring(0, i.length - 1) + "=" : s % 3 === 1 && (i = i.substring(0, i.length - 2) + "=="), i;
|
|
1165
|
-
},
|
|
1166
|
-
var
|
|
1167
|
-
|
|
1168
|
-
var
|
|
1165
|
+
}, de = function(e) {
|
|
1166
|
+
var t = e.length * 0.75, n = e.length, s, i = 0, o, r, a, u;
|
|
1167
|
+
e[e.length - 1] === "=" && (t--, e[e.length - 2] === "=" && t--);
|
|
1168
|
+
var f = new ArrayBuffer(t), c = new Uint8Array(f);
|
|
1169
1169
|
for (s = 0; s < n; s += 4)
|
|
1170
|
-
|
|
1171
|
-
return
|
|
1170
|
+
o = Oe[e.charCodeAt(s)], r = Oe[e.charCodeAt(s + 1)], a = Oe[e.charCodeAt(s + 2)], u = Oe[e.charCodeAt(s + 3)], c[i++] = o << 2 | r >> 4, c[i++] = (r & 15) << 4 | a >> 2, c[i++] = (a & 3) << 6 | u & 63;
|
|
1171
|
+
return f;
|
|
1172
1172
|
};
|
|
1173
|
-
const
|
|
1174
|
-
for (const n of Object.keys(
|
|
1175
|
-
const s = await
|
|
1176
|
-
return
|
|
1177
|
-
}
|
|
1178
|
-
}),
|
|
1179
|
-
for (const n of Object.keys(
|
|
1180
|
-
const s = await
|
|
1181
|
-
return
|
|
1182
|
-
}
|
|
1183
|
-
}),
|
|
1184
|
-
if (
|
|
1185
|
-
return new File([
|
|
1186
|
-
if (
|
|
1187
|
-
const i = await
|
|
1188
|
-
return
|
|
1189
|
-
}
|
|
1190
|
-
if (
|
|
1191
|
-
const i =
|
|
1192
|
-
return new File([i.buffer],
|
|
1193
|
-
}
|
|
1194
|
-
if (typeof
|
|
1195
|
-
var s = new Blob([
|
|
1196
|
-
n.type = "text/plain", new File([s],
|
|
1197
|
-
}
|
|
1198
|
-
if (typeof
|
|
1199
|
-
const i = new Blob([JSON.stringify(
|
|
1173
|
+
const Ve = async (e) => C(e, async (t) => {
|
|
1174
|
+
for (const n of Object.keys(e)) {
|
|
1175
|
+
const s = await ns(e[n]);
|
|
1176
|
+
return t[n] = s, t;
|
|
1177
|
+
}
|
|
1178
|
+
}), Ie = async (e) => C(e, async (t) => {
|
|
1179
|
+
for (const n of Object.keys(e)) {
|
|
1180
|
+
const s = await en(e[n]);
|
|
1181
|
+
return t[n] = s, t;
|
|
1182
|
+
}
|
|
1183
|
+
}), Vs = async (e, t, n) => {
|
|
1184
|
+
if (e = en(e), n = n || {}, n.type || (n.type = "application/octet-stream"), e instanceof ArrayBuffer)
|
|
1185
|
+
return new File([e], t, n);
|
|
1186
|
+
if (e instanceof File || e instanceof Blob) {
|
|
1187
|
+
const i = await e.arrayBuffer();
|
|
1188
|
+
return e instanceof File && (n.type = e.type), new File([i], t, n);
|
|
1189
|
+
}
|
|
1190
|
+
if (e instanceof Int8Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray || e instanceof Int16Array || e instanceof Uint16Array || e instanceof Int32Array || e instanceof Uint32Array || e instanceof Float32Array || e instanceof Float64Array) {
|
|
1191
|
+
const i = e;
|
|
1192
|
+
return new File([i.buffer], t, n);
|
|
1193
|
+
}
|
|
1194
|
+
if (typeof e == "string") {
|
|
1195
|
+
var s = new Blob([e], { type: "text/plain" });
|
|
1196
|
+
n.type = "text/plain", new File([s], t, n);
|
|
1197
|
+
}
|
|
1198
|
+
if (typeof e == "object") {
|
|
1199
|
+
const i = new Blob([JSON.stringify(e)], {
|
|
1200
1200
|
type: "application/json"
|
|
1201
1201
|
});
|
|
1202
|
-
n.type = "application/json", new File([i],
|
|
1202
|
+
n.type = "application/json", new File([i], t, n);
|
|
1203
1203
|
}
|
|
1204
|
-
var s = new Blob([
|
|
1205
|
-
return n.type = "text/plain", new File([s],
|
|
1206
|
-
},
|
|
1207
|
-
if (
|
|
1208
|
-
const
|
|
1204
|
+
var s = new Blob([e], { type: "text/plain" });
|
|
1205
|
+
return n.type = "text/plain", new File([s], t, n);
|
|
1206
|
+
}, ns = async (e) => {
|
|
1207
|
+
if (e instanceof Int8Array || e instanceof Uint8Array || e instanceof Uint8ClampedArray || e instanceof Int16Array || e instanceof Uint16Array || e instanceof Int32Array || e instanceof Uint32Array || e instanceof Float32Array || e instanceof Float64Array) {
|
|
1208
|
+
const t = e, n = {
|
|
1209
1209
|
_s: !0,
|
|
1210
|
-
_c:
|
|
1211
|
-
value:
|
|
1212
|
-
byteLength:
|
|
1213
|
-
byteOffset:
|
|
1214
|
-
size:
|
|
1210
|
+
_c: e.constructor.name,
|
|
1211
|
+
value: ke(t.buffer),
|
|
1212
|
+
byteLength: t.byteLength,
|
|
1213
|
+
byteOffset: t.byteOffset,
|
|
1214
|
+
size: t.byteLength
|
|
1215
1215
|
};
|
|
1216
1216
|
return Promise.resolve(n);
|
|
1217
|
-
} else if (
|
|
1218
|
-
const
|
|
1217
|
+
} else if (e instanceof File) {
|
|
1218
|
+
const t = e, n = await t.arrayBuffer();
|
|
1219
1219
|
return {
|
|
1220
1220
|
_s: !0,
|
|
1221
1221
|
_c: File.name,
|
|
1222
|
-
value:
|
|
1223
|
-
name:
|
|
1224
|
-
fileType:
|
|
1225
|
-
lastModified:
|
|
1222
|
+
value: ke(n),
|
|
1223
|
+
name: t.name,
|
|
1224
|
+
fileType: t.type,
|
|
1225
|
+
lastModified: t.lastModified,
|
|
1226
1226
|
size: n.byteLength
|
|
1227
1227
|
};
|
|
1228
|
-
} else if (
|
|
1229
|
-
const
|
|
1228
|
+
} else if (e instanceof Blob) {
|
|
1229
|
+
const t = e, n = await t.arrayBuffer();
|
|
1230
1230
|
return {
|
|
1231
1231
|
_s: !0,
|
|
1232
1232
|
_c: Blob.name,
|
|
1233
|
-
value:
|
|
1234
|
-
fileType:
|
|
1233
|
+
value: ke(n),
|
|
1234
|
+
fileType: t.type,
|
|
1235
1235
|
size: n.byteLength
|
|
1236
1236
|
};
|
|
1237
|
-
} else if (
|
|
1238
|
-
const
|
|
1237
|
+
} else if (e instanceof ArrayBuffer) {
|
|
1238
|
+
const t = e, n = {
|
|
1239
1239
|
_s: !0,
|
|
1240
1240
|
_c: ArrayBuffer.name,
|
|
1241
|
-
value:
|
|
1242
|
-
size:
|
|
1241
|
+
value: ke(t),
|
|
1242
|
+
size: t.byteLength
|
|
1243
1243
|
};
|
|
1244
1244
|
return Promise.resolve(n);
|
|
1245
1245
|
}
|
|
1246
|
-
return Promise.resolve(
|
|
1247
|
-
},
|
|
1248
|
-
if (!(
|
|
1249
|
-
return
|
|
1250
|
-
const
|
|
1246
|
+
return Promise.resolve(e);
|
|
1247
|
+
}, en = (e) => {
|
|
1248
|
+
if (!(e && typeof e == "object" && e._s === !0))
|
|
1249
|
+
return e;
|
|
1250
|
+
const t = e, n = t._c;
|
|
1251
1251
|
if (n === Blob.name) {
|
|
1252
|
-
const r =
|
|
1253
|
-
return new Blob([
|
|
1252
|
+
const r = e;
|
|
1253
|
+
return new Blob([de(t.value)], {
|
|
1254
1254
|
type: r.fileType
|
|
1255
1255
|
});
|
|
1256
1256
|
} else if (n === File.name) {
|
|
1257
|
-
const r =
|
|
1258
|
-
return new File([
|
|
1257
|
+
const r = e;
|
|
1258
|
+
return new File([de(t.value)], r.name, {
|
|
1259
1259
|
type: r.fileType,
|
|
1260
1260
|
lastModified: r.lastModified
|
|
1261
1261
|
});
|
|
1262
1262
|
} else if (n === ArrayBuffer.name)
|
|
1263
|
-
return
|
|
1264
|
-
const s =
|
|
1263
|
+
return de(t.value);
|
|
1264
|
+
const s = e, i = de(s.value), o = s._c;
|
|
1265
1265
|
try {
|
|
1266
|
-
return new globalThis[
|
|
1266
|
+
return new globalThis[o](i);
|
|
1267
1267
|
} catch {
|
|
1268
1268
|
}
|
|
1269
|
-
return
|
|
1270
|
-
},
|
|
1271
|
-
if (!(
|
|
1269
|
+
return e;
|
|
1270
|
+
}, Ks = (e) => {
|
|
1271
|
+
if (!(e && typeof e == "object" && e._s === !0))
|
|
1272
1272
|
return;
|
|
1273
|
-
const
|
|
1273
|
+
const t = e, n = t._c;
|
|
1274
1274
|
if (n === Blob.name) {
|
|
1275
|
-
const r =
|
|
1275
|
+
const r = e, a = new Blob([de(t.value)], {
|
|
1276
1276
|
type: r.fileType
|
|
1277
1277
|
});
|
|
1278
|
-
return new File([
|
|
1279
|
-
type:
|
|
1278
|
+
return new File([a], "file", {
|
|
1279
|
+
type: a.type
|
|
1280
1280
|
});
|
|
1281
1281
|
} else if (n === File.name) {
|
|
1282
|
-
const r =
|
|
1283
|
-
return new File([
|
|
1282
|
+
const r = e;
|
|
1283
|
+
return new File([de(t.value)], r.name, {
|
|
1284
1284
|
type: r.fileType,
|
|
1285
1285
|
lastModified: r.lastModified
|
|
1286
1286
|
});
|
|
1287
1287
|
} else if (n === ArrayBuffer.name) {
|
|
1288
|
-
const r =
|
|
1288
|
+
const r = de(t.value);
|
|
1289
1289
|
return new File([r], "file", {
|
|
1290
1290
|
type: "application/octet-stream"
|
|
1291
1291
|
});
|
|
1292
1292
|
}
|
|
1293
|
-
const s =
|
|
1293
|
+
const s = e, i = de(s.value), o = s._c;
|
|
1294
1294
|
try {
|
|
1295
|
-
const r = new globalThis[
|
|
1295
|
+
const r = new globalThis[o](i);
|
|
1296
1296
|
return new File([r], "file", {
|
|
1297
1297
|
type: "application/octet-stream"
|
|
1298
1298
|
});
|
|
1299
1299
|
} catch {
|
|
1300
1300
|
}
|
|
1301
1301
|
};
|
|
1302
|
-
var
|
|
1303
|
-
(function(
|
|
1304
|
-
|
|
1305
|
-
})(
|
|
1306
|
-
var
|
|
1307
|
-
(function(
|
|
1308
|
-
|
|
1309
|
-
})(
|
|
1310
|
-
var
|
|
1311
|
-
(function(
|
|
1312
|
-
|
|
1313
|
-
})(
|
|
1314
|
-
const
|
|
1315
|
-
function
|
|
1316
|
-
switch (typeof
|
|
1302
|
+
var E;
|
|
1303
|
+
(function(e) {
|
|
1304
|
+
e.Inputs = "inputs", e.Outputs = "outputs", e.State = "state", e.Definition = "definition", e.Error = "error", e.UrlHashUpdate = "urlhashupdate", e.Message = "Message";
|
|
1305
|
+
})(E || (E = {}));
|
|
1306
|
+
var Q;
|
|
1307
|
+
(function(e) {
|
|
1308
|
+
e.InputsUpdate = "InputsUpdate", e.OutputsUpdate = "OutputsUpdate", e.SetupIframeClientRequest = "SetupIframeClientRequest", e.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", e.HashParamsUpdate = "HashParamsUpdate";
|
|
1309
|
+
})(Q || (Q = {}));
|
|
1310
|
+
var ce;
|
|
1311
|
+
(function(e) {
|
|
1312
|
+
e.InputsUpdate = "InputsUpdate", e.MessageAck = "MessageAck", e.SetupIframeServerResponse = "SetupIframeServerResponse";
|
|
1313
|
+
})(ce || (ce = {}));
|
|
1314
|
+
const Ws = -32700, Js = -32600, Xs = -32601, qs = -32602, Qs = -32603;
|
|
1315
|
+
function Ys(e) {
|
|
1316
|
+
switch (typeof e) {
|
|
1317
1317
|
case "string":
|
|
1318
1318
|
return !0;
|
|
1319
1319
|
case "number":
|
|
1320
|
-
return
|
|
1320
|
+
return e % 1 != 0;
|
|
1321
1321
|
case "object":
|
|
1322
|
-
return
|
|
1322
|
+
return e === null ? (console.warn("Use of null ID in JSONRPC 2.0 is discouraged."), !0) : !1;
|
|
1323
1323
|
default:
|
|
1324
1324
|
return !1;
|
|
1325
1325
|
}
|
|
1326
1326
|
}
|
|
1327
|
-
var
|
|
1328
|
-
(function(
|
|
1329
|
-
var
|
|
1327
|
+
var tn = { exports: {} };
|
|
1328
|
+
(function(e) {
|
|
1329
|
+
var t = Object.prototype.hasOwnProperty, n = "~";
|
|
1330
1330
|
function s() {
|
|
1331
1331
|
}
|
|
1332
1332
|
Object.create && (s.prototype = /* @__PURE__ */ Object.create(null), new s().__proto__ || (n = !1));
|
|
1333
|
-
function i(
|
|
1334
|
-
this.fn =
|
|
1333
|
+
function i(u, f, c) {
|
|
1334
|
+
this.fn = u, this.context = f, this.once = c || !1;
|
|
1335
1335
|
}
|
|
1336
|
-
function
|
|
1336
|
+
function o(u, f, c, d, g) {
|
|
1337
1337
|
if (typeof c != "function")
|
|
1338
1338
|
throw new TypeError("The listener must be a function");
|
|
1339
|
-
var
|
|
1340
|
-
return
|
|
1339
|
+
var w = new i(c, d || u, g), y = n ? n + f : f;
|
|
1340
|
+
return u._events[y] ? u._events[y].fn ? u._events[y] = [u._events[y], w] : u._events[y].push(w) : (u._events[y] = w, u._eventsCount++), u;
|
|
1341
1341
|
}
|
|
1342
|
-
function r(
|
|
1343
|
-
--
|
|
1342
|
+
function r(u, f) {
|
|
1343
|
+
--u._eventsCount === 0 ? u._events = new s() : delete u._events[f];
|
|
1344
1344
|
}
|
|
1345
|
-
function
|
|
1345
|
+
function a() {
|
|
1346
1346
|
this._events = new s(), this._eventsCount = 0;
|
|
1347
1347
|
}
|
|
1348
|
-
|
|
1349
|
-
var
|
|
1348
|
+
a.prototype.eventNames = function() {
|
|
1349
|
+
var f = [], c, d;
|
|
1350
1350
|
if (this._eventsCount === 0)
|
|
1351
|
-
return
|
|
1352
|
-
for (
|
|
1353
|
-
|
|
1354
|
-
return Object.getOwnPropertySymbols ?
|
|
1355
|
-
},
|
|
1356
|
-
var c = n ? n +
|
|
1357
|
-
if (!
|
|
1351
|
+
return f;
|
|
1352
|
+
for (d in c = this._events)
|
|
1353
|
+
t.call(c, d) && f.push(n ? d.slice(1) : d);
|
|
1354
|
+
return Object.getOwnPropertySymbols ? f.concat(Object.getOwnPropertySymbols(c)) : f;
|
|
1355
|
+
}, a.prototype.listeners = function(f) {
|
|
1356
|
+
var c = n ? n + f : f, d = this._events[c];
|
|
1357
|
+
if (!d)
|
|
1358
1358
|
return [];
|
|
1359
|
-
if (
|
|
1360
|
-
return [
|
|
1361
|
-
for (var
|
|
1362
|
-
|
|
1363
|
-
return
|
|
1364
|
-
},
|
|
1365
|
-
var c = n ? n +
|
|
1366
|
-
return
|
|
1367
|
-
},
|
|
1368
|
-
var
|
|
1369
|
-
if (!this._events[
|
|
1359
|
+
if (d.fn)
|
|
1360
|
+
return [d.fn];
|
|
1361
|
+
for (var g = 0, w = d.length, y = new Array(w); g < w; g++)
|
|
1362
|
+
y[g] = d[g].fn;
|
|
1363
|
+
return y;
|
|
1364
|
+
}, a.prototype.listenerCount = function(f) {
|
|
1365
|
+
var c = n ? n + f : f, d = this._events[c];
|
|
1366
|
+
return d ? d.fn ? 1 : d.length : 0;
|
|
1367
|
+
}, a.prototype.emit = function(f, c, d, g, w, y) {
|
|
1368
|
+
var O = n ? n + f : f;
|
|
1369
|
+
if (!this._events[O])
|
|
1370
1370
|
return !1;
|
|
1371
|
-
var
|
|
1372
|
-
if (
|
|
1373
|
-
switch (
|
|
1371
|
+
var v = this._events[O], x = arguments.length, b, S;
|
|
1372
|
+
if (v.fn) {
|
|
1373
|
+
switch (v.once && this.removeListener(f, v.fn, void 0, !0), x) {
|
|
1374
1374
|
case 1:
|
|
1375
|
-
return
|
|
1375
|
+
return v.fn.call(v.context), !0;
|
|
1376
1376
|
case 2:
|
|
1377
|
-
return
|
|
1377
|
+
return v.fn.call(v.context, c), !0;
|
|
1378
1378
|
case 3:
|
|
1379
|
-
return
|
|
1379
|
+
return v.fn.call(v.context, c, d), !0;
|
|
1380
1380
|
case 4:
|
|
1381
|
-
return
|
|
1381
|
+
return v.fn.call(v.context, c, d, g), !0;
|
|
1382
1382
|
case 5:
|
|
1383
|
-
return
|
|
1383
|
+
return v.fn.call(v.context, c, d, g, w), !0;
|
|
1384
1384
|
case 6:
|
|
1385
|
-
return
|
|
1385
|
+
return v.fn.call(v.context, c, d, g, w, y), !0;
|
|
1386
1386
|
}
|
|
1387
|
-
for (
|
|
1388
|
-
|
|
1389
|
-
|
|
1387
|
+
for (S = 1, b = new Array(x - 1); S < x; S++)
|
|
1388
|
+
b[S - 1] = arguments[S];
|
|
1389
|
+
v.fn.apply(v.context, b);
|
|
1390
1390
|
} else {
|
|
1391
|
-
var
|
|
1392
|
-
for (
|
|
1393
|
-
switch (
|
|
1391
|
+
var M = v.length, R;
|
|
1392
|
+
for (S = 0; S < M; S++)
|
|
1393
|
+
switch (v[S].once && this.removeListener(f, v[S].fn, void 0, !0), x) {
|
|
1394
1394
|
case 1:
|
|
1395
|
-
|
|
1395
|
+
v[S].fn.call(v[S].context);
|
|
1396
1396
|
break;
|
|
1397
1397
|
case 2:
|
|
1398
|
-
|
|
1398
|
+
v[S].fn.call(v[S].context, c);
|
|
1399
1399
|
break;
|
|
1400
1400
|
case 3:
|
|
1401
|
-
|
|
1401
|
+
v[S].fn.call(v[S].context, c, d);
|
|
1402
1402
|
break;
|
|
1403
1403
|
case 4:
|
|
1404
|
-
|
|
1404
|
+
v[S].fn.call(v[S].context, c, d, g);
|
|
1405
1405
|
break;
|
|
1406
1406
|
default:
|
|
1407
|
-
if (!
|
|
1408
|
-
for (
|
|
1409
|
-
|
|
1410
|
-
|
|
1407
|
+
if (!b)
|
|
1408
|
+
for (R = 1, b = new Array(x - 1); R < x; R++)
|
|
1409
|
+
b[R - 1] = arguments[R];
|
|
1410
|
+
v[S].fn.apply(v[S].context, b);
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
return !0;
|
|
1414
|
-
},
|
|
1415
|
-
return
|
|
1416
|
-
},
|
|
1417
|
-
return
|
|
1418
|
-
},
|
|
1419
|
-
var
|
|
1420
|
-
if (!this._events[
|
|
1414
|
+
}, a.prototype.on = function(f, c, d) {
|
|
1415
|
+
return o(this, f, c, d, !1);
|
|
1416
|
+
}, a.prototype.once = function(f, c, d) {
|
|
1417
|
+
return o(this, f, c, d, !0);
|
|
1418
|
+
}, a.prototype.removeListener = function(f, c, d, g) {
|
|
1419
|
+
var w = n ? n + f : f;
|
|
1420
|
+
if (!this._events[w])
|
|
1421
1421
|
return this;
|
|
1422
1422
|
if (!c)
|
|
1423
|
-
return r(this,
|
|
1424
|
-
var
|
|
1425
|
-
if (
|
|
1426
|
-
|
|
1423
|
+
return r(this, w), this;
|
|
1424
|
+
var y = this._events[w];
|
|
1425
|
+
if (y.fn)
|
|
1426
|
+
y.fn === c && (!g || y.once) && (!d || y.context === d) && r(this, w);
|
|
1427
1427
|
else {
|
|
1428
|
-
for (var
|
|
1429
|
-
(
|
|
1430
|
-
|
|
1428
|
+
for (var O = 0, v = [], x = y.length; O < x; O++)
|
|
1429
|
+
(y[O].fn !== c || g && !y[O].once || d && y[O].context !== d) && v.push(y[O]);
|
|
1430
|
+
v.length ? this._events[w] = v.length === 1 ? v[0] : v : r(this, w);
|
|
1431
1431
|
}
|
|
1432
1432
|
return this;
|
|
1433
|
-
},
|
|
1433
|
+
}, a.prototype.removeAllListeners = function(f) {
|
|
1434
1434
|
var c;
|
|
1435
|
-
return
|
|
1436
|
-
},
|
|
1437
|
-
})(
|
|
1438
|
-
var
|
|
1439
|
-
|
|
1440
|
-
var n = typeof
|
|
1435
|
+
return f ? (c = n ? n + f : f, this._events[c] && r(this, c)) : (this._events = new s(), this._eventsCount = 0), this;
|
|
1436
|
+
}, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = n, a.EventEmitter = a, e.exports = a;
|
|
1437
|
+
})(tn);
|
|
1438
|
+
var gt = tn.exports, ss = function(e, t) {
|
|
1439
|
+
t || (t = {}), typeof t == "function" && (t = { cmp: t });
|
|
1440
|
+
var n = typeof t.cycles == "boolean" ? t.cycles : !1, s = t.cmp && function(o) {
|
|
1441
1441
|
return function(r) {
|
|
1442
|
-
return function(
|
|
1443
|
-
var
|
|
1444
|
-
return
|
|
1442
|
+
return function(a, u) {
|
|
1443
|
+
var f = { key: a, value: r[a] }, c = { key: u, value: r[u] };
|
|
1444
|
+
return o(f, c);
|
|
1445
1445
|
};
|
|
1446
1446
|
};
|
|
1447
|
-
}(
|
|
1448
|
-
return function
|
|
1447
|
+
}(t.cmp), i = [];
|
|
1448
|
+
return function o(r) {
|
|
1449
1449
|
if (r && r.toJSON && typeof r.toJSON == "function" && (r = r.toJSON()), r !== void 0) {
|
|
1450
1450
|
if (typeof r == "number")
|
|
1451
1451
|
return isFinite(r) ? "" + r : "null";
|
|
1452
1452
|
if (typeof r != "object")
|
|
1453
1453
|
return JSON.stringify(r);
|
|
1454
|
-
var
|
|
1454
|
+
var a, u;
|
|
1455
1455
|
if (Array.isArray(r)) {
|
|
1456
|
-
for (
|
|
1457
|
-
|
|
1458
|
-
return
|
|
1456
|
+
for (u = "[", a = 0; a < r.length; a++)
|
|
1457
|
+
a && (u += ","), u += o(r[a]) || "null";
|
|
1458
|
+
return u + "]";
|
|
1459
1459
|
}
|
|
1460
1460
|
if (r === null)
|
|
1461
1461
|
return "null";
|
|
@@ -1464,221 +1464,221 @@ var De = st.exports, Yt = function(t, e) {
|
|
|
1464
1464
|
return JSON.stringify("__cycle__");
|
|
1465
1465
|
throw new TypeError("Converting circular structure to JSON");
|
|
1466
1466
|
}
|
|
1467
|
-
var
|
|
1468
|
-
for (
|
|
1469
|
-
var
|
|
1470
|
-
|
|
1467
|
+
var f = i.push(r) - 1, c = Object.keys(r).sort(s && s(r));
|
|
1468
|
+
for (u = "", a = 0; a < c.length; a++) {
|
|
1469
|
+
var d = c[a], g = o(r[d]);
|
|
1470
|
+
g && (u && (u += ","), u += JSON.stringify(d) + ":" + g);
|
|
1471
1471
|
}
|
|
1472
|
-
return i.splice(
|
|
1472
|
+
return i.splice(f, 1), "{" + u + "}";
|
|
1473
1473
|
}
|
|
1474
|
-
}(
|
|
1474
|
+
}(e);
|
|
1475
1475
|
};
|
|
1476
|
-
const
|
|
1477
|
-
var
|
|
1478
|
-
(function(
|
|
1479
|
-
|
|
1480
|
-
})(
|
|
1481
|
-
const
|
|
1476
|
+
const nn = /* @__PURE__ */ lt(ss);
|
|
1477
|
+
var $e;
|
|
1478
|
+
(function(e) {
|
|
1479
|
+
e.mp_debug = "mp_debug";
|
|
1480
|
+
})($e || ($e = {}));
|
|
1481
|
+
const is = () => {
|
|
1482
1482
|
try {
|
|
1483
1483
|
return window !== window.top;
|
|
1484
1484
|
} catch {
|
|
1485
1485
|
return !1;
|
|
1486
1486
|
}
|
|
1487
|
-
},
|
|
1488
|
-
version:
|
|
1487
|
+
}, sn = {
|
|
1488
|
+
version: Ge,
|
|
1489
1489
|
metaframes: {}
|
|
1490
1490
|
};
|
|
1491
|
-
class
|
|
1491
|
+
class rs extends gt.EventEmitter {
|
|
1492
1492
|
constructor() {
|
|
1493
|
-
super(), this._definition =
|
|
1493
|
+
super(), this._definition = sn, this.getDefinition = this.getDefinition.bind(this);
|
|
1494
1494
|
}
|
|
1495
|
-
error(
|
|
1495
|
+
error(t) {
|
|
1496
1496
|
throw "Subclass should implement";
|
|
1497
1497
|
}
|
|
1498
1498
|
getDefinition() {
|
|
1499
1499
|
return this._definition;
|
|
1500
1500
|
}
|
|
1501
1501
|
}
|
|
1502
|
-
const
|
|
1503
|
-
Object.keys(
|
|
1504
|
-
|
|
1502
|
+
const Be = (e, t) => t ? C(e, (n) => {
|
|
1503
|
+
Object.keys(t).forEach((s) => {
|
|
1504
|
+
t[s] === void 0 ? delete n[s] : n[s] = t[s];
|
|
1505
1505
|
});
|
|
1506
|
-
}) :
|
|
1507
|
-
const
|
|
1508
|
-
return
|
|
1509
|
-
},
|
|
1510
|
-
for (var
|
|
1511
|
-
|
|
1512
|
-
return
|
|
1513
|
-
},
|
|
1514
|
-
|
|
1506
|
+
}) : e, Zs = (e) => window.location.search ? new URLSearchParams(window.location.search).get(e) : null, ei = () => new URLSearchParams(window.location.search).has($e.mp_debug), ut = () => {
|
|
1507
|
+
const e = new URLSearchParams(window.location.search).get($e.mp_debug);
|
|
1508
|
+
return e === "true" || e === "1";
|
|
1509
|
+
}, ti = (e = 8) => bt(e), os = (e = 8) => bt(e), ni = (e = 8) => bt(e), Dt = "abcdefghijklmnopqrstuvwxyz0123456789", bt = (e = 8) => {
|
|
1510
|
+
for (var t = "", n = Dt.length, s = 0; s < e; s++)
|
|
1511
|
+
t += Dt.charAt(Math.floor(Math.random() * n));
|
|
1512
|
+
return t;
|
|
1513
|
+
}, vt = (e, t, n) => {
|
|
1514
|
+
t = t || "000", t && t.trim() == "" && (t = void 0);
|
|
1515
1515
|
let s;
|
|
1516
|
-
if (typeof
|
|
1517
|
-
var i = `color: #${
|
|
1516
|
+
if (typeof e == "string" ? s = e : typeof e == "number" ? s = e + "" : s = JSON.stringify(e, null, " "), t && t.trim() != "") {
|
|
1517
|
+
var i = `color: #${t}`;
|
|
1518
1518
|
n && (i = `${i}; background: #${n}`), s = `%c${s}`, window.console.log(s, i);
|
|
1519
1519
|
} else
|
|
1520
1520
|
window.console.log(s);
|
|
1521
|
-
},
|
|
1522
|
-
var
|
|
1523
|
-
for (let n = 0; n <
|
|
1524
|
-
|
|
1525
|
-
return
|
|
1526
|
-
},
|
|
1527
|
-
var
|
|
1528
|
-
return "00000".substring(0, 6 -
|
|
1529
|
-
},
|
|
1530
|
-
if (
|
|
1531
|
-
|
|
1521
|
+
}, rn = (e) => us(as(e)), as = (e) => {
|
|
1522
|
+
var t = 0;
|
|
1523
|
+
for (let n = 0; n < e.length; n++)
|
|
1524
|
+
t = e.charCodeAt(n) + ((t << 5) - t);
|
|
1525
|
+
return t;
|
|
1526
|
+
}, us = (e) => {
|
|
1527
|
+
var t = (e & 16777215).toString(16).toUpperCase();
|
|
1528
|
+
return "00000".substring(0, 6 - t.length) + t;
|
|
1529
|
+
}, Qe = () => document.readyState == "complete" || document.readyState == "interactive", wt = async () => Qe() ? Promise.resolve() : new Promise((e) => {
|
|
1530
|
+
if (Qe()) {
|
|
1531
|
+
e();
|
|
1532
1532
|
return;
|
|
1533
1533
|
}
|
|
1534
|
-
let
|
|
1534
|
+
let t = !1;
|
|
1535
1535
|
window.addEventListener("load", () => {
|
|
1536
|
-
|
|
1536
|
+
t || (t = !0, e());
|
|
1537
1537
|
}), setTimeout(() => {
|
|
1538
|
-
!
|
|
1538
|
+
!t && Qe() && (t = !0, e());
|
|
1539
1539
|
}, 200);
|
|
1540
|
-
}),
|
|
1541
|
-
const
|
|
1542
|
-
return await
|
|
1543
|
-
},
|
|
1544
|
-
const
|
|
1545
|
-
version:
|
|
1546
|
-
metaframes:
|
|
1540
|
+
}), si = async (e) => {
|
|
1541
|
+
const t = nn(e);
|
|
1542
|
+
return await on(t);
|
|
1543
|
+
}, ii = async (e) => {
|
|
1544
|
+
const t = nn({
|
|
1545
|
+
version: e.version,
|
|
1546
|
+
metaframes: e.metaframes
|
|
1547
1547
|
});
|
|
1548
|
-
return await
|
|
1548
|
+
return await on(t);
|
|
1549
1549
|
};
|
|
1550
|
-
async function
|
|
1551
|
-
const n = new TextEncoder().encode(
|
|
1550
|
+
async function on(e) {
|
|
1551
|
+
const n = new TextEncoder().encode(e), s = await crypto.subtle.digest("SHA-256", n);
|
|
1552
1552
|
return btoa(String.fromCharCode(...new Uint8Array(s)));
|
|
1553
1553
|
}
|
|
1554
|
-
var
|
|
1555
|
-
(function(
|
|
1556
|
-
|
|
1557
|
-
})(
|
|
1558
|
-
var
|
|
1559
|
-
(function(
|
|
1560
|
-
|
|
1561
|
-
})(
|
|
1562
|
-
class
|
|
1563
|
-
constructor(
|
|
1564
|
-
if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state =
|
|
1554
|
+
var he;
|
|
1555
|
+
(function(e) {
|
|
1556
|
+
e.WaitingForPageLoad = "WaitingForPageLoad", e.SentSetupIframeClientRequest = "SentSetupIframeClientRequest", e.Ready = "Ready";
|
|
1557
|
+
})(he || (he = {}));
|
|
1558
|
+
var F;
|
|
1559
|
+
(function(e) {
|
|
1560
|
+
e.Connected = "connected", e.Error = "error", e.Input = "input", e.Inputs = "inputs", e.Message = "message";
|
|
1561
|
+
})(F || (F = {}));
|
|
1562
|
+
class te extends gt.EventEmitter {
|
|
1563
|
+
constructor(t) {
|
|
1564
|
+
if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = he.WaitingForPageLoad, this._messageSendCount = 0, this.debug = ut(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = ut(), this._isIframe = is(), 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) {
|
|
1565
1565
|
this.log("Not an iframe, metaframe code disabled");
|
|
1566
1566
|
return;
|
|
1567
1567
|
}
|
|
1568
1568
|
const n = this;
|
|
1569
|
-
|
|
1570
|
-
this.log("pageLoaded"), window.addEventListener("message", this.onMessage), n.sendRpc(
|
|
1571
|
-
version:
|
|
1572
|
-
}), n._state =
|
|
1573
|
-
}),
|
|
1574
|
-
}
|
|
1575
|
-
_resolveSetupIframeServerResponse(
|
|
1576
|
-
if (this._state ===
|
|
1569
|
+
wt().then(() => {
|
|
1570
|
+
this.log("pageLoaded"), window.addEventListener("message", this.onMessage), n.sendRpc(Q.SetupIframeClientRequest, {
|
|
1571
|
+
version: te.version
|
|
1572
|
+
}), n._state = he.SentSetupIframeClientRequest;
|
|
1573
|
+
}), t && t.disableHashChangeEvent || window.addEventListener("hashchange", this._onHashUrlChange);
|
|
1574
|
+
}
|
|
1575
|
+
_resolveSetupIframeServerResponse(t) {
|
|
1576
|
+
if (this._state === he.WaitingForPageLoad)
|
|
1577
1577
|
throw "Got message but page has not finished loading, we should never get in this state";
|
|
1578
|
-
(async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion =
|
|
1579
|
-
version:
|
|
1580
|
-
}), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(
|
|
1578
|
+
(async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = t.version, this.color = rn(this.id), this._parentId = t.parentId, this.log(`metapage[${this._parentId}](v${this._parentVersion ? this._parentVersion : "unknown"}) registered`), t.state && t.state.inputs && (this.isInputOutputBlobSerialization ? this._inputPipeValues = await Ie(t.state.inputs) : this._inputPipeValues = t.state.inputs), this._state = he.Ready, this.sendRpc(Q.SetupIframeServerResponseAck, {
|
|
1579
|
+
version: te.version
|
|
1580
|
+
}), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(F.Inputs, this._inputPipeValues), Object.keys(this._inputPipeValues).forEach((n) => this.emit(F.Input, n, this._inputPipeValues[n]))), this.emit(F.Inputs, this._inputPipeValues), this.emit(F.Connected)))();
|
|
1581
1581
|
}
|
|
1582
1582
|
async connected() {
|
|
1583
|
-
if (this._state !==
|
|
1584
|
-
return new Promise((
|
|
1583
|
+
if (this._state !== he.Ready)
|
|
1584
|
+
return new Promise((t, n) => {
|
|
1585
1585
|
let s;
|
|
1586
|
-
s = this.addListenerReturnDisposer(
|
|
1587
|
-
|
|
1586
|
+
s = this.addListenerReturnDisposer(F.Connected, () => {
|
|
1587
|
+
t(), s();
|
|
1588
1588
|
});
|
|
1589
1589
|
});
|
|
1590
1590
|
}
|
|
1591
|
-
addListenerReturnDisposer(
|
|
1592
|
-
return super.addListener(
|
|
1593
|
-
super.removeListener(
|
|
1591
|
+
addListenerReturnDisposer(t, n) {
|
|
1592
|
+
return super.addListener(t, n), () => {
|
|
1593
|
+
super.removeListener(t, n);
|
|
1594
1594
|
};
|
|
1595
1595
|
}
|
|
1596
|
-
log(
|
|
1597
|
-
this.debug && this.logInternal(
|
|
1596
|
+
log(t, n, s) {
|
|
1597
|
+
this.debug && this.logInternal(t, n || this.color);
|
|
1598
1598
|
}
|
|
1599
|
-
warn(
|
|
1600
|
-
this.debug && this.logInternal(
|
|
1599
|
+
warn(t) {
|
|
1600
|
+
this.debug && this.logInternal(t, "000", this.color);
|
|
1601
1601
|
}
|
|
1602
|
-
error(
|
|
1603
|
-
this.logInternal(
|
|
1602
|
+
error(t) {
|
|
1603
|
+
this.logInternal(t, this.color, "f00");
|
|
1604
1604
|
}
|
|
1605
|
-
logInternal(
|
|
1605
|
+
logInternal(t, n, s) {
|
|
1606
1606
|
let i;
|
|
1607
|
-
typeof
|
|
1607
|
+
typeof t == "string" ? i = t : typeof t == "number" ? i = t + "" : i = JSON.stringify(t), n = n && n + "", i = (this.id ? `Metaframe[${this.id}] ` : "") + `${i}`, vt(i, n, s);
|
|
1608
1608
|
}
|
|
1609
1609
|
dispose() {
|
|
1610
1610
|
super.removeAllListeners(), window.removeEventListener("message", this.onMessage), this.disableNotifyOnHashUrlChange(), this._inputPipeValues = void 0, this._outputPipeValues = void 0;
|
|
1611
1611
|
}
|
|
1612
|
-
addListener(
|
|
1613
|
-
return super.addListener(
|
|
1612
|
+
addListener(t, n) {
|
|
1613
|
+
return super.addListener(t, n), t === F.Inputs && window.setTimeout(() => {
|
|
1614
1614
|
this._inputPipeValues && n(this._inputPipeValues);
|
|
1615
1615
|
}, 0), this;
|
|
1616
1616
|
}
|
|
1617
|
-
onInput(
|
|
1618
|
-
return this.addListenerReturnDisposer(
|
|
1619
|
-
|
|
1617
|
+
onInput(t, n) {
|
|
1618
|
+
return this.addListenerReturnDisposer(F.Input, (s, i) => {
|
|
1619
|
+
t === s && n(i);
|
|
1620
1620
|
});
|
|
1621
1621
|
}
|
|
1622
|
-
onInputs(
|
|
1623
|
-
return this.addListenerReturnDisposer(
|
|
1622
|
+
onInputs(t) {
|
|
1623
|
+
return this.addListenerReturnDisposer(F.Inputs, t);
|
|
1624
1624
|
}
|
|
1625
|
-
setInput(
|
|
1625
|
+
setInput(t, n) {
|
|
1626
1626
|
var s = {};
|
|
1627
|
-
s[
|
|
1627
|
+
s[t] = n, this.setInputs(s);
|
|
1628
1628
|
}
|
|
1629
|
-
async setInputs(
|
|
1630
|
-
this.isInputOutputBlobSerialization && (
|
|
1629
|
+
async setInputs(t) {
|
|
1630
|
+
this.isInputOutputBlobSerialization && (t = await Ie(t)), this.sendRpc(Q.InputsUpdate, t);
|
|
1631
1631
|
}
|
|
1632
|
-
async setInternalInputsAndNotify(
|
|
1633
|
-
this.isInputOutputBlobSerialization && (
|
|
1634
|
-
const n =
|
|
1635
|
-
if (this._inputPipeValues =
|
|
1636
|
-
Object.keys(
|
|
1632
|
+
async setInternalInputsAndNotify(t) {
|
|
1633
|
+
this.isInputOutputBlobSerialization && (t = await Ie(t));
|
|
1634
|
+
const n = t;
|
|
1635
|
+
if (this._inputPipeValues = Be(this._inputPipeValues, t), this._inputPipeValues !== n) {
|
|
1636
|
+
Object.keys(t).forEach((s) => {
|
|
1637
1637
|
try {
|
|
1638
|
-
this.emit(
|
|
1638
|
+
this.emit(F.Input, s, t[s]);
|
|
1639
1639
|
} catch (i) {
|
|
1640
|
-
console.error(`Error emitting input ${s}: ${i}`), this.emit(
|
|
1640
|
+
console.error(`Error emitting input ${s}: ${i}`), this.emit(F.Error, `Error emitting input ${s}: ${i}`);
|
|
1641
1641
|
}
|
|
1642
1642
|
});
|
|
1643
1643
|
try {
|
|
1644
|
-
this.emit(
|
|
1644
|
+
this.emit(F.Inputs, t);
|
|
1645
1645
|
} catch (s) {
|
|
1646
|
-
console.error(`Error emitting inputs: ${s}`), this.emit(
|
|
1646
|
+
console.error(`Error emitting inputs: ${s}`), this.emit(F.Error, `Error emitting inputs: ${s}`);
|
|
1647
1647
|
}
|
|
1648
1648
|
}
|
|
1649
1649
|
}
|
|
1650
|
-
getInput(
|
|
1651
|
-
return console.assert(!!
|
|
1650
|
+
getInput(t) {
|
|
1651
|
+
return console.assert(!!t), this._inputPipeValues[t];
|
|
1652
1652
|
}
|
|
1653
1653
|
getInputs() {
|
|
1654
1654
|
return this._inputPipeValues;
|
|
1655
1655
|
}
|
|
1656
|
-
setOutput(
|
|
1657
|
-
console.assert(!!
|
|
1656
|
+
setOutput(t, n) {
|
|
1657
|
+
console.assert(!!t);
|
|
1658
1658
|
var s = {};
|
|
1659
|
-
s[
|
|
1659
|
+
s[t] = n, this.setOutputs(s);
|
|
1660
1660
|
}
|
|
1661
|
-
async setOutputs(
|
|
1662
|
-
this.isInputOutputBlobSerialization && (
|
|
1663
|
-
const n =
|
|
1664
|
-
this._outputPipeValues =
|
|
1661
|
+
async setOutputs(t) {
|
|
1662
|
+
this.isInputOutputBlobSerialization && (t = await Ve(t));
|
|
1663
|
+
const n = t;
|
|
1664
|
+
this._outputPipeValues = Be(this._outputPipeValues, t), this._outputPipeValues !== n && this.sendRpc(Q.OutputsUpdate, t);
|
|
1665
1665
|
}
|
|
1666
1666
|
disableNotifyOnHashUrlChange() {
|
|
1667
1667
|
window.removeEventListener("hashchange", this._onHashUrlChange);
|
|
1668
1668
|
}
|
|
1669
|
-
_onHashUrlChange(
|
|
1669
|
+
_onHashUrlChange(t) {
|
|
1670
1670
|
const n = {
|
|
1671
1671
|
hash: window.location.hash,
|
|
1672
1672
|
metaframe: this.id
|
|
1673
1673
|
};
|
|
1674
|
-
this.sendRpc(
|
|
1674
|
+
this.sendRpc(Q.HashParamsUpdate, n);
|
|
1675
1675
|
}
|
|
1676
|
-
sendRpc(
|
|
1676
|
+
sendRpc(t, n) {
|
|
1677
1677
|
if (this._isIframe) {
|
|
1678
1678
|
const s = {
|
|
1679
1679
|
jsonrpc: "2.0",
|
|
1680
1680
|
id: ++this._messageSendCount,
|
|
1681
|
-
method:
|
|
1681
|
+
method: t,
|
|
1682
1682
|
params: n,
|
|
1683
1683
|
iframeId: this.id,
|
|
1684
1684
|
parentId: this._parentId
|
|
@@ -1687,46 +1687,935 @@ class L extends De.EventEmitter {
|
|
|
1687
1687
|
} else
|
|
1688
1688
|
this.log("Cannot send JSON-RPC window message: there is no window.parent which means we are not an iframe");
|
|
1689
1689
|
}
|
|
1690
|
-
onMessage(
|
|
1691
|
-
if (typeof
|
|
1692
|
-
let s =
|
|
1690
|
+
onMessage(t) {
|
|
1691
|
+
if (typeof t.data == "object") {
|
|
1692
|
+
let s = t.data;
|
|
1693
1693
|
if (s.jsonrpc === "2.0") {
|
|
1694
1694
|
var n = s.method;
|
|
1695
|
-
if (!(n ==
|
|
1695
|
+
if (!(n == ce.SetupIframeServerResponse || s.parentId == this._parentId && s.iframeId == this.id)) {
|
|
1696
1696
|
this.log(`window.message: received message but jsonrpc.parentId=${s.parentId} _parentId=${this._parentId} jsonrpc.iframeId=${s.iframeId} id=${this.id}`);
|
|
1697
1697
|
return;
|
|
1698
1698
|
}
|
|
1699
1699
|
switch (n) {
|
|
1700
|
-
case
|
|
1700
|
+
case ce.SetupIframeServerResponse:
|
|
1701
1701
|
this._resolveSetupIframeServerResponse(s.params);
|
|
1702
1702
|
break;
|
|
1703
|
-
case
|
|
1704
|
-
if (this._state !==
|
|
1703
|
+
case ce.InputsUpdate:
|
|
1704
|
+
if (this._state !== he.Ready)
|
|
1705
1705
|
throw "Got InputsUpdate but metaframe is not MetaframeLoadingState.Ready";
|
|
1706
1706
|
this.setInternalInputsAndNotify(s.params.inputs);
|
|
1707
1707
|
break;
|
|
1708
|
-
case
|
|
1708
|
+
case ce.MessageAck:
|
|
1709
1709
|
this.debug && this.log(`ACK: ${JSON.stringify(s)}`);
|
|
1710
1710
|
break;
|
|
1711
1711
|
default:
|
|
1712
1712
|
this.debug && this.log(`window.message: unknown JSON-RPC method: ${JSON.stringify(s)}`);
|
|
1713
1713
|
break;
|
|
1714
1714
|
}
|
|
1715
|
-
this.emit(
|
|
1715
|
+
this.emit(F.Message, s);
|
|
1716
1716
|
}
|
|
1717
1717
|
}
|
|
1718
1718
|
}
|
|
1719
1719
|
}
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1720
|
+
te.version = _n;
|
|
1721
|
+
te.ERROR = F.Error;
|
|
1722
|
+
te.CONNECTED = F.Connected;
|
|
1723
|
+
te.INPUT = F.Input;
|
|
1724
|
+
te.INPUTS = F.Inputs;
|
|
1725
|
+
te.MESSAGE = F.Message;
|
|
1726
|
+
te.deserializeInputs = Ie;
|
|
1727
|
+
te.serializeInputs = Ve;
|
|
1728
|
+
var Ke = {};
|
|
1729
|
+
const ie = "\\\\/", Pt = `[^${ie}]`, ue = "\\.", cs = "\\+", fs = "\\?", We = "\\/", ls = "(?=.)", an = "[^/]", Rt = `(?:${We}|$)`, un = `(?:^|${We})`, At = `${ue}{1,2}${Rt}`, ps = `(?!${ue})`, hs = `(?!${un}${At})`, ds = `(?!${ue}{0,1}${Rt})`, ms = `(?!${At})`, ys = `[^.${We}]`, _s = `${an}*?`, gs = "/", cn = {
|
|
1730
|
+
DOT_LITERAL: ue,
|
|
1731
|
+
PLUS_LITERAL: cs,
|
|
1732
|
+
QMARK_LITERAL: fs,
|
|
1733
|
+
SLASH_LITERAL: We,
|
|
1734
|
+
ONE_CHAR: ls,
|
|
1735
|
+
QMARK: an,
|
|
1736
|
+
END_ANCHOR: Rt,
|
|
1737
|
+
DOTS_SLASH: At,
|
|
1738
|
+
NO_DOT: ps,
|
|
1739
|
+
NO_DOTS: hs,
|
|
1740
|
+
NO_DOT_SLASH: ds,
|
|
1741
|
+
NO_DOTS_SLASH: ms,
|
|
1742
|
+
QMARK_NO_DOT: ys,
|
|
1743
|
+
STAR: _s,
|
|
1744
|
+
START_ANCHOR: un,
|
|
1745
|
+
SEP: gs
|
|
1746
|
+
}, bs = {
|
|
1747
|
+
...cn,
|
|
1748
|
+
SLASH_LITERAL: `[${ie}]`,
|
|
1749
|
+
QMARK: Pt,
|
|
1750
|
+
STAR: `${Pt}*?`,
|
|
1751
|
+
DOTS_SLASH: `${ue}{1,2}(?:[${ie}]|$)`,
|
|
1752
|
+
NO_DOT: `(?!${ue})`,
|
|
1753
|
+
NO_DOTS: `(?!(?:^|[${ie}])${ue}{1,2}(?:[${ie}]|$))`,
|
|
1754
|
+
NO_DOT_SLASH: `(?!${ue}{0,1}(?:[${ie}]|$))`,
|
|
1755
|
+
NO_DOTS_SLASH: `(?!${ue}{1,2}(?:[${ie}]|$))`,
|
|
1756
|
+
QMARK_NO_DOT: `[^.${ie}]`,
|
|
1757
|
+
START_ANCHOR: `(?:^|[${ie}])`,
|
|
1758
|
+
END_ANCHOR: `(?:[${ie}]|$)`,
|
|
1759
|
+
SEP: "\\"
|
|
1760
|
+
}, vs = {
|
|
1761
|
+
alnum: "a-zA-Z0-9",
|
|
1762
|
+
alpha: "a-zA-Z",
|
|
1763
|
+
ascii: "\\x00-\\x7F",
|
|
1764
|
+
blank: " \\t",
|
|
1765
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
1766
|
+
digit: "0-9",
|
|
1767
|
+
graph: "\\x21-\\x7E",
|
|
1768
|
+
lower: "a-z",
|
|
1769
|
+
print: "\\x20-\\x7E ",
|
|
1770
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
1771
|
+
space: " \\t\\r\\n\\v\\f",
|
|
1772
|
+
upper: "A-Z",
|
|
1773
|
+
word: "A-Za-z0-9_",
|
|
1774
|
+
xdigit: "A-Fa-f0-9"
|
|
1775
|
+
};
|
|
1776
|
+
var Je = {
|
|
1777
|
+
MAX_LENGTH: 1024 * 64,
|
|
1778
|
+
POSIX_REGEX_SOURCE: vs,
|
|
1779
|
+
// regular expressions
|
|
1780
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
1781
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
1782
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
1783
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
1784
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
1785
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
1786
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
1787
|
+
REPLACEMENTS: {
|
|
1788
|
+
"***": "*",
|
|
1789
|
+
"**/**": "**",
|
|
1790
|
+
"**/**/**": "**"
|
|
1791
|
+
},
|
|
1792
|
+
// Digits
|
|
1793
|
+
CHAR_0: 48,
|
|
1794
|
+
/* 0 */
|
|
1795
|
+
CHAR_9: 57,
|
|
1796
|
+
/* 9 */
|
|
1797
|
+
// Alphabet chars.
|
|
1798
|
+
CHAR_UPPERCASE_A: 65,
|
|
1799
|
+
/* A */
|
|
1800
|
+
CHAR_LOWERCASE_A: 97,
|
|
1801
|
+
/* a */
|
|
1802
|
+
CHAR_UPPERCASE_Z: 90,
|
|
1803
|
+
/* Z */
|
|
1804
|
+
CHAR_LOWERCASE_Z: 122,
|
|
1805
|
+
/* z */
|
|
1806
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
1807
|
+
/* ( */
|
|
1808
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
1809
|
+
/* ) */
|
|
1810
|
+
CHAR_ASTERISK: 42,
|
|
1811
|
+
/* * */
|
|
1812
|
+
// Non-alphabetic chars.
|
|
1813
|
+
CHAR_AMPERSAND: 38,
|
|
1814
|
+
/* & */
|
|
1815
|
+
CHAR_AT: 64,
|
|
1816
|
+
/* @ */
|
|
1817
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
1818
|
+
/* \ */
|
|
1819
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
1820
|
+
/* \r */
|
|
1821
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
1822
|
+
/* ^ */
|
|
1823
|
+
CHAR_COLON: 58,
|
|
1824
|
+
/* : */
|
|
1825
|
+
CHAR_COMMA: 44,
|
|
1826
|
+
/* , */
|
|
1827
|
+
CHAR_DOT: 46,
|
|
1828
|
+
/* . */
|
|
1829
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
1830
|
+
/* " */
|
|
1831
|
+
CHAR_EQUAL: 61,
|
|
1832
|
+
/* = */
|
|
1833
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
1834
|
+
/* ! */
|
|
1835
|
+
CHAR_FORM_FEED: 12,
|
|
1836
|
+
/* \f */
|
|
1837
|
+
CHAR_FORWARD_SLASH: 47,
|
|
1838
|
+
/* / */
|
|
1839
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
1840
|
+
/* ` */
|
|
1841
|
+
CHAR_HASH: 35,
|
|
1842
|
+
/* # */
|
|
1843
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
1844
|
+
/* - */
|
|
1845
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
1846
|
+
/* < */
|
|
1847
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
1848
|
+
/* { */
|
|
1849
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
1850
|
+
/* [ */
|
|
1851
|
+
CHAR_LINE_FEED: 10,
|
|
1852
|
+
/* \n */
|
|
1853
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
1854
|
+
/* \u00A0 */
|
|
1855
|
+
CHAR_PERCENT: 37,
|
|
1856
|
+
/* % */
|
|
1857
|
+
CHAR_PLUS: 43,
|
|
1858
|
+
/* + */
|
|
1859
|
+
CHAR_QUESTION_MARK: 63,
|
|
1860
|
+
/* ? */
|
|
1861
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
1862
|
+
/* > */
|
|
1863
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
1864
|
+
/* } */
|
|
1865
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
1866
|
+
/* ] */
|
|
1867
|
+
CHAR_SEMICOLON: 59,
|
|
1868
|
+
/* ; */
|
|
1869
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
1870
|
+
/* ' */
|
|
1871
|
+
CHAR_SPACE: 32,
|
|
1872
|
+
/* */
|
|
1873
|
+
CHAR_TAB: 9,
|
|
1874
|
+
/* \t */
|
|
1875
|
+
CHAR_UNDERSCORE: 95,
|
|
1876
|
+
/* _ */
|
|
1877
|
+
CHAR_VERTICAL_LINE: 124,
|
|
1878
|
+
/* | */
|
|
1879
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
1880
|
+
/* \uFEFF */
|
|
1881
|
+
/**
|
|
1882
|
+
* Create EXTGLOB_CHARS
|
|
1883
|
+
*/
|
|
1884
|
+
extglobChars(e) {
|
|
1885
|
+
return {
|
|
1886
|
+
"!": { type: "negate", open: "(?:(?!(?:", close: `))${e.STAR})` },
|
|
1887
|
+
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
1888
|
+
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
1889
|
+
"*": { type: "star", open: "(?:", close: ")*" },
|
|
1890
|
+
"@": { type: "at", open: "(?:", close: ")" }
|
|
1891
|
+
};
|
|
1892
|
+
},
|
|
1893
|
+
/**
|
|
1894
|
+
* Create GLOB_CHARS
|
|
1895
|
+
*/
|
|
1896
|
+
globChars(e) {
|
|
1897
|
+
return e === !0 ? bs : cn;
|
|
1898
|
+
}
|
|
1899
|
+
};
|
|
1900
|
+
(function(e) {
|
|
1901
|
+
const {
|
|
1902
|
+
REGEX_BACKSLASH: t,
|
|
1903
|
+
REGEX_REMOVE_BACKSLASH: n,
|
|
1904
|
+
REGEX_SPECIAL_CHARS: s,
|
|
1905
|
+
REGEX_SPECIAL_CHARS_GLOBAL: i
|
|
1906
|
+
} = Je;
|
|
1907
|
+
e.isObject = (o) => o !== null && typeof o == "object" && !Array.isArray(o), e.hasRegexChars = (o) => s.test(o), e.isRegexChar = (o) => o.length === 1 && e.hasRegexChars(o), e.escapeRegex = (o) => o.replace(i, "\\$1"), e.toPosixSlashes = (o) => o.replace(t, "/"), e.removeBackslashes = (o) => o.replace(n, (r) => r === "\\" ? "" : r), e.supportsLookbehinds = () => {
|
|
1908
|
+
const o = process.version.slice(1).split(".").map(Number);
|
|
1909
|
+
return o.length === 3 && o[0] >= 9 || o[0] === 8 && o[1] >= 10;
|
|
1910
|
+
}, e.escapeLast = (o, r, a) => {
|
|
1911
|
+
const u = o.lastIndexOf(r, a);
|
|
1912
|
+
return u === -1 ? o : o[u - 1] === "\\" ? e.escapeLast(o, r, u - 1) : `${o.slice(0, u)}\\${o.slice(u)}`;
|
|
1913
|
+
}, e.removePrefix = (o, r = {}) => {
|
|
1914
|
+
let a = o;
|
|
1915
|
+
return a.startsWith("./") && (a = a.slice(2), r.prefix = "./"), a;
|
|
1916
|
+
}, e.wrapOutput = (o, r = {}, a = {}) => {
|
|
1917
|
+
const u = a.contains ? "" : "^", f = a.contains ? "" : "$";
|
|
1918
|
+
let c = `${u}(?:${o})${f}`;
|
|
1919
|
+
return r.negated === !0 && (c = `(?:^(?!${c}).*$)`), c;
|
|
1920
|
+
}, e.basename = (o, { windows: r } = {}) => r ? o.replace(/[\\/]$/, "").replace(/.*[\\/]/, "") : o.replace(/\/$/, "").replace(/.*\//, "");
|
|
1921
|
+
})(Ke);
|
|
1922
|
+
const Ht = Ke, {
|
|
1923
|
+
CHAR_ASTERISK: Ye,
|
|
1924
|
+
/* * */
|
|
1925
|
+
CHAR_AT: ws,
|
|
1926
|
+
/* @ */
|
|
1927
|
+
CHAR_BACKWARD_SLASH: Ee,
|
|
1928
|
+
/* \ */
|
|
1929
|
+
CHAR_COMMA: Rs,
|
|
1930
|
+
/* , */
|
|
1931
|
+
CHAR_DOT: Ze,
|
|
1932
|
+
/* . */
|
|
1933
|
+
CHAR_EXCLAMATION_MARK: kt,
|
|
1934
|
+
/* ! */
|
|
1935
|
+
CHAR_FORWARD_SLASH: fn,
|
|
1936
|
+
/* / */
|
|
1937
|
+
CHAR_LEFT_CURLY_BRACE: et,
|
|
1938
|
+
/* { */
|
|
1939
|
+
CHAR_LEFT_PARENTHESES: tt,
|
|
1940
|
+
/* ( */
|
|
1941
|
+
CHAR_LEFT_SQUARE_BRACKET: As,
|
|
1942
|
+
/* [ */
|
|
1943
|
+
CHAR_PLUS: Ss,
|
|
1944
|
+
/* + */
|
|
1945
|
+
CHAR_QUESTION_MARK: Nt,
|
|
1946
|
+
/* ? */
|
|
1947
|
+
CHAR_RIGHT_CURLY_BRACE: Os,
|
|
1948
|
+
/* } */
|
|
1949
|
+
CHAR_RIGHT_PARENTHESES: jt,
|
|
1950
|
+
/* ) */
|
|
1951
|
+
CHAR_RIGHT_SQUARE_BRACKET: Es
|
|
1952
|
+
/* ] */
|
|
1953
|
+
} = Je, Ut = (e) => e === fn || e === Ee, Bt = (e) => {
|
|
1954
|
+
e.isPrefix !== !0 && (e.depth = e.isGlobstar ? 1 / 0 : 1);
|
|
1955
|
+
}, Ms = (e, t) => {
|
|
1956
|
+
const n = t || {}, s = e.length - 1, i = n.parts === !0 || n.scanToEnd === !0, o = [], r = [], a = [];
|
|
1957
|
+
let u = e, f = -1, c = 0, d = 0, g = !1, w = !1, y = !1, O = !1, v = !1, x = !1, b = !1, S = !1, M = !1, R = 0, P, A, L = { value: "", depth: 0, isGlob: !1 };
|
|
1958
|
+
const z = () => f >= s, h = () => u.charCodeAt(f + 1), k = () => (P = A, u.charCodeAt(++f));
|
|
1959
|
+
for (; f < s; ) {
|
|
1960
|
+
A = k();
|
|
1961
|
+
let K;
|
|
1962
|
+
if (A === Ee) {
|
|
1963
|
+
b = L.backslashes = !0, A = k(), A === et && (x = !0);
|
|
1964
|
+
continue;
|
|
1965
|
+
}
|
|
1966
|
+
if (x === !0 || A === et) {
|
|
1967
|
+
for (R++; z() !== !0 && (A = k()); ) {
|
|
1968
|
+
if (A === Ee) {
|
|
1969
|
+
b = L.backslashes = !0, k();
|
|
1970
|
+
continue;
|
|
1971
|
+
}
|
|
1972
|
+
if (A === et) {
|
|
1973
|
+
R++;
|
|
1974
|
+
continue;
|
|
1975
|
+
}
|
|
1976
|
+
if (x !== !0 && A === Ze && (A = k()) === Ze) {
|
|
1977
|
+
if (g = L.isBrace = !0, y = L.isGlob = !0, M = !0, i === !0)
|
|
1978
|
+
continue;
|
|
1979
|
+
break;
|
|
1980
|
+
}
|
|
1981
|
+
if (x !== !0 && A === Rs) {
|
|
1982
|
+
if (g = L.isBrace = !0, y = L.isGlob = !0, M = !0, i === !0)
|
|
1983
|
+
continue;
|
|
1984
|
+
break;
|
|
1985
|
+
}
|
|
1986
|
+
if (A === Os && (R--, R === 0)) {
|
|
1987
|
+
x = !1, g = L.isBrace = !0, M = !0;
|
|
1988
|
+
break;
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
if (i === !0)
|
|
1992
|
+
continue;
|
|
1993
|
+
break;
|
|
1994
|
+
}
|
|
1995
|
+
if (A === fn) {
|
|
1996
|
+
if (o.push(f), r.push(L), L = { value: "", depth: 0, isGlob: !1 }, M === !0)
|
|
1997
|
+
continue;
|
|
1998
|
+
if (P === Ze && f === c + 1) {
|
|
1999
|
+
c += 2;
|
|
2000
|
+
continue;
|
|
2001
|
+
}
|
|
2002
|
+
d = f + 1;
|
|
2003
|
+
continue;
|
|
2004
|
+
}
|
|
2005
|
+
if (n.noext !== !0 && (A === Ss || A === ws || A === Ye || A === Nt || A === kt) === !0 && h() === tt) {
|
|
2006
|
+
if (y = L.isGlob = !0, O = L.isExtglob = !0, M = !0, i === !0) {
|
|
2007
|
+
for (; z() !== !0 && (A = k()); ) {
|
|
2008
|
+
if (A === Ee) {
|
|
2009
|
+
b = L.backslashes = !0, A = k();
|
|
2010
|
+
continue;
|
|
2011
|
+
}
|
|
2012
|
+
if (A === jt) {
|
|
2013
|
+
y = L.isGlob = !0, M = !0;
|
|
2014
|
+
break;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
continue;
|
|
2018
|
+
}
|
|
2019
|
+
break;
|
|
2020
|
+
}
|
|
2021
|
+
if (A === Ye) {
|
|
2022
|
+
if (P === Ye && (v = L.isGlobstar = !0), y = L.isGlob = !0, M = !0, i === !0)
|
|
2023
|
+
continue;
|
|
2024
|
+
break;
|
|
2025
|
+
}
|
|
2026
|
+
if (A === Nt) {
|
|
2027
|
+
if (y = L.isGlob = !0, M = !0, i === !0)
|
|
2028
|
+
continue;
|
|
2029
|
+
break;
|
|
2030
|
+
}
|
|
2031
|
+
if (A === As)
|
|
2032
|
+
for (; z() !== !0 && (K = k()); ) {
|
|
2033
|
+
if (K === Ee) {
|
|
2034
|
+
b = L.backslashes = !0, k();
|
|
2035
|
+
continue;
|
|
2036
|
+
}
|
|
2037
|
+
if (K === Es) {
|
|
2038
|
+
if (w = L.isBracket = !0, y = L.isGlob = !0, M = !0, i === !0)
|
|
2039
|
+
continue;
|
|
2040
|
+
break;
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
if (n.nonegate !== !0 && A === kt && f === c) {
|
|
2044
|
+
S = L.negated = !0, c++;
|
|
2045
|
+
continue;
|
|
2046
|
+
}
|
|
2047
|
+
if (n.noparen !== !0 && A === tt) {
|
|
2048
|
+
if (y = L.isGlob = !0, i === !0) {
|
|
2049
|
+
for (; z() !== !0 && (A = k()); ) {
|
|
2050
|
+
if (A === tt) {
|
|
2051
|
+
b = L.backslashes = !0, A = k();
|
|
2052
|
+
continue;
|
|
2053
|
+
}
|
|
2054
|
+
if (A === jt) {
|
|
2055
|
+
M = !0;
|
|
2056
|
+
break;
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
continue;
|
|
2060
|
+
}
|
|
2061
|
+
break;
|
|
2062
|
+
}
|
|
2063
|
+
if (y === !0) {
|
|
2064
|
+
if (M = !0, i === !0)
|
|
2065
|
+
continue;
|
|
2066
|
+
break;
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
n.noext === !0 && (O = !1, y = !1);
|
|
2070
|
+
let H = u, pe = "", l = "";
|
|
2071
|
+
c > 0 && (pe = u.slice(0, c), u = u.slice(c), d -= c), H && y === !0 && d > 0 ? (H = u.slice(0, d), l = u.slice(d)) : y === !0 ? (H = "", l = u) : H = u, H && H !== "" && H !== "/" && H !== u && Ut(H.charCodeAt(H.length - 1)) && (H = H.slice(0, -1)), n.unescape === !0 && (l && (l = Ht.removeBackslashes(l)), H && b === !0 && (H = Ht.removeBackslashes(H)));
|
|
2072
|
+
const p = {
|
|
2073
|
+
prefix: pe,
|
|
2074
|
+
input: e,
|
|
2075
|
+
start: c,
|
|
2076
|
+
base: H,
|
|
2077
|
+
glob: l,
|
|
2078
|
+
isBrace: g,
|
|
2079
|
+
isBracket: w,
|
|
2080
|
+
isGlob: y,
|
|
2081
|
+
isExtglob: O,
|
|
2082
|
+
isGlobstar: v,
|
|
2083
|
+
negated: S
|
|
2084
|
+
};
|
|
2085
|
+
if (n.tokens === !0 && (p.maxDepth = 0, Ut(A) || r.push(L), p.tokens = r), n.parts === !0 || n.tokens === !0) {
|
|
2086
|
+
let K;
|
|
2087
|
+
for (let D = 0; D < o.length; D++) {
|
|
2088
|
+
const se = K ? K + 1 : c, oe = o[D], X = e.slice(se, oe);
|
|
2089
|
+
n.tokens && (D === 0 && c !== 0 ? (r[D].isPrefix = !0, r[D].value = pe) : r[D].value = X, Bt(r[D]), p.maxDepth += r[D].depth), (D !== 0 || X !== "") && a.push(X), K = oe;
|
|
2090
|
+
}
|
|
2091
|
+
if (K && K + 1 < e.length) {
|
|
2092
|
+
const D = e.slice(K + 1);
|
|
2093
|
+
a.push(D), n.tokens && (r[r.length - 1].value = D, Bt(r[r.length - 1]), p.maxDepth += r[r.length - 1].depth);
|
|
2094
|
+
}
|
|
2095
|
+
p.slashes = o, p.parts = a;
|
|
2096
|
+
}
|
|
2097
|
+
return p;
|
|
2098
|
+
};
|
|
2099
|
+
var Is = Ms;
|
|
2100
|
+
const Fe = Je, Z = Ke, {
|
|
2101
|
+
MAX_LENGTH: ze,
|
|
2102
|
+
POSIX_REGEX_SOURCE: Cs,
|
|
2103
|
+
REGEX_NON_SPECIAL_CHARS: $s,
|
|
2104
|
+
REGEX_SPECIAL_CHARS_BACKREF: xs,
|
|
2105
|
+
REPLACEMENTS: ln
|
|
2106
|
+
} = Fe, Ls = (e, t) => {
|
|
2107
|
+
if (typeof t.expandRange == "function")
|
|
2108
|
+
return t.expandRange(...e, t);
|
|
2109
|
+
e.sort();
|
|
2110
|
+
const n = `[${e.join("-")}]`;
|
|
2111
|
+
try {
|
|
2112
|
+
new RegExp(n);
|
|
2113
|
+
} catch {
|
|
2114
|
+
return e.map((i) => Z.escapeRegex(i)).join("..");
|
|
2115
|
+
}
|
|
2116
|
+
return n;
|
|
2117
|
+
}, ve = (e, t) => `Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`, pn = (e, t) => {
|
|
2118
|
+
if (typeof e != "string")
|
|
2119
|
+
throw new TypeError("Expected a string");
|
|
2120
|
+
e = ln[e] || e;
|
|
2121
|
+
const n = { ...t }, s = typeof n.maxLength == "number" ? Math.min(ze, n.maxLength) : ze;
|
|
2122
|
+
let i = e.length;
|
|
2123
|
+
if (i > s)
|
|
2124
|
+
throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${s}`);
|
|
2125
|
+
const o = { type: "bos", value: "", output: n.prepend || "" }, r = [o], a = n.capture ? "" : "?:", u = Fe.globChars(n.windows), f = Fe.extglobChars(u), {
|
|
2126
|
+
DOT_LITERAL: c,
|
|
2127
|
+
PLUS_LITERAL: d,
|
|
2128
|
+
SLASH_LITERAL: g,
|
|
2129
|
+
ONE_CHAR: w,
|
|
2130
|
+
DOTS_SLASH: y,
|
|
2131
|
+
NO_DOT: O,
|
|
2132
|
+
NO_DOT_SLASH: v,
|
|
2133
|
+
NO_DOTS_SLASH: x,
|
|
2134
|
+
QMARK: b,
|
|
2135
|
+
QMARK_NO_DOT: S,
|
|
2136
|
+
STAR: M,
|
|
2137
|
+
START_ANCHOR: R
|
|
2138
|
+
} = u, P = (_) => `(${a}(?:(?!${R}${_.dot ? y : c}).)*?)`, A = n.dot ? "" : O, L = n.dot ? b : S;
|
|
2139
|
+
let z = n.bash === !0 ? P(n) : M;
|
|
2140
|
+
n.capture && (z = `(${z})`), typeof n.noext == "boolean" && (n.noextglob = n.noext);
|
|
2141
|
+
const h = {
|
|
2142
|
+
input: e,
|
|
2143
|
+
index: -1,
|
|
2144
|
+
start: 0,
|
|
2145
|
+
dot: n.dot === !0,
|
|
2146
|
+
consumed: "",
|
|
2147
|
+
output: "",
|
|
2148
|
+
prefix: "",
|
|
2149
|
+
backtrack: !1,
|
|
2150
|
+
negated: !1,
|
|
2151
|
+
brackets: 0,
|
|
2152
|
+
braces: 0,
|
|
2153
|
+
parens: 0,
|
|
2154
|
+
quotes: 0,
|
|
2155
|
+
globstar: !1,
|
|
2156
|
+
tokens: r
|
|
2157
|
+
};
|
|
2158
|
+
e = Z.removePrefix(e, h), i = e.length;
|
|
2159
|
+
const k = [], H = [], pe = [];
|
|
2160
|
+
let l = o, p;
|
|
2161
|
+
const K = () => h.index === i - 1, D = h.peek = (_ = 1) => e[h.index + _], se = h.advance = () => e[++h.index], oe = () => e.slice(h.index + 1), X = (_ = "", N = 0) => {
|
|
2162
|
+
h.consumed += _, h.index += N;
|
|
2163
|
+
}, Le = (_) => {
|
|
2164
|
+
h.output += _.output != null ? _.output : _.value, X(_.value);
|
|
2165
|
+
}, mn = () => {
|
|
2166
|
+
let _ = 1;
|
|
2167
|
+
for (; D() === "!" && (D(2) !== "(" || D(3) === "?"); )
|
|
2168
|
+
se(), h.start++, _++;
|
|
2169
|
+
return _ % 2 === 0 ? !1 : (h.negated = !0, h.start++, !0);
|
|
2170
|
+
}, Te = (_) => {
|
|
2171
|
+
h[_]++, pe.push(_);
|
|
2172
|
+
}, me = (_) => {
|
|
2173
|
+
h[_]--, pe.pop();
|
|
2174
|
+
}, I = (_) => {
|
|
2175
|
+
if (l.type === "globstar") {
|
|
2176
|
+
const N = h.braces > 0 && (_.type === "comma" || _.type === "brace"), m = _.extglob === !0 || k.length && (_.type === "pipe" || _.type === "paren");
|
|
2177
|
+
_.type !== "slash" && _.type !== "paren" && !N && !m && (h.output = h.output.slice(0, -l.output.length), l.type = "star", l.value = "*", l.output = z, h.output += l.output);
|
|
2178
|
+
}
|
|
2179
|
+
if (k.length && _.type !== "paren" && !f[_.value] && (k[k.length - 1].inner += _.value), (_.value || _.output) && Le(_), l && l.type === "text" && _.type === "text") {
|
|
2180
|
+
l.value += _.value, l.output = (l.output || "") + _.value;
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
2183
|
+
_.prev = l, r.push(_), l = _;
|
|
2184
|
+
}, De = (_, N) => {
|
|
2185
|
+
const m = { ...f[N], conditions: 1, inner: "" };
|
|
2186
|
+
m.prev = l, m.parens = h.parens, m.output = h.output;
|
|
2187
|
+
const T = (n.capture ? "(" : "") + m.open;
|
|
2188
|
+
Te("parens"), I({ type: _, value: N, output: h.output ? "" : w }), I({ type: "paren", extglob: !0, value: se(), output: T }), k.push(m);
|
|
2189
|
+
}, yn = (_) => {
|
|
2190
|
+
let N = _.close + (n.capture ? ")" : "");
|
|
2191
|
+
if (_.type === "negate") {
|
|
2192
|
+
let m = z;
|
|
2193
|
+
_.inner && _.inner.length > 1 && _.inner.includes("/") && (m = P(n)), (m !== z || K() || /^\)+$/.test(oe())) && (N = _.close = `)$))${m}`), _.prev.type === "bos" && K() && (h.negatedExtglob = !0);
|
|
2194
|
+
}
|
|
2195
|
+
I({ type: "paren", extglob: !0, value: p, output: N }), me("parens");
|
|
2196
|
+
};
|
|
2197
|
+
if (n.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(e)) {
|
|
2198
|
+
let _ = !1, N = e.replace(xs, (m, T, j, W, G, Xe) => W === "\\" ? (_ = !0, m) : W === "?" ? T ? T + W + (G ? b.repeat(G.length) : "") : Xe === 0 ? L + (G ? b.repeat(G.length) : "") : b.repeat(j.length) : W === "." ? c.repeat(j.length) : W === "*" ? T ? T + W + (G ? z : "") : z : T ? m : `\\${m}`);
|
|
2199
|
+
return _ === !0 && (n.unescape === !0 ? N = N.replace(/\\/g, "") : N = N.replace(/\\+/g, (m) => m.length % 2 === 0 ? "\\\\" : m ? "\\" : "")), N === e && n.contains === !0 ? (h.output = e, h) : (h.output = Z.wrapOutput(N, h, t), h);
|
|
2200
|
+
}
|
|
2201
|
+
for (; !K(); ) {
|
|
2202
|
+
if (p = se(), p === "\0")
|
|
2203
|
+
continue;
|
|
2204
|
+
if (p === "\\") {
|
|
2205
|
+
const m = D();
|
|
2206
|
+
if (m === "/" && n.bash !== !0 || m === "." || m === ";")
|
|
2207
|
+
continue;
|
|
2208
|
+
if (!m) {
|
|
2209
|
+
p += "\\", I({ type: "text", value: p });
|
|
2210
|
+
continue;
|
|
2211
|
+
}
|
|
2212
|
+
const T = /^\\+/.exec(oe());
|
|
2213
|
+
let j = 0;
|
|
2214
|
+
if (T && T[0].length > 2 && (j = T[0].length, h.index += j, j % 2 !== 0 && (p += "\\")), n.unescape === !0 ? p = se() || "" : p += se() || "", h.brackets === 0) {
|
|
2215
|
+
I({ type: "text", value: p });
|
|
2216
|
+
continue;
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
if (h.brackets > 0 && (p !== "]" || l.value === "[" || l.value === "[^")) {
|
|
2220
|
+
if (n.posix !== !1 && p === ":") {
|
|
2221
|
+
const m = l.value.slice(1);
|
|
2222
|
+
if (m.includes("[") && (l.posix = !0, m.includes(":"))) {
|
|
2223
|
+
const T = l.value.lastIndexOf("["), j = l.value.slice(0, T), W = l.value.slice(T + 2), G = Cs[W];
|
|
2224
|
+
if (G) {
|
|
2225
|
+
l.value = j + G, h.backtrack = !0, se(), !o.output && r.indexOf(l) === 1 && (o.output = w);
|
|
2226
|
+
continue;
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
(p === "[" && D() !== ":" || p === "-" && D() === "]") && (p = `\\${p}`), p === "]" && (l.value === "[" || l.value === "[^") && (p = `\\${p}`), n.posix === !0 && p === "!" && l.value === "[" && (p = "^"), l.value += p, Le({ value: p });
|
|
2231
|
+
continue;
|
|
2232
|
+
}
|
|
2233
|
+
if (h.quotes === 1 && p !== '"') {
|
|
2234
|
+
p = Z.escapeRegex(p), l.value += p, Le({ value: p });
|
|
2235
|
+
continue;
|
|
2236
|
+
}
|
|
2237
|
+
if (p === '"') {
|
|
2238
|
+
h.quotes = h.quotes === 1 ? 0 : 1, n.keepQuotes === !0 && I({ type: "text", value: p });
|
|
2239
|
+
continue;
|
|
2240
|
+
}
|
|
2241
|
+
if (p === "(") {
|
|
2242
|
+
Te("parens"), I({ type: "paren", value: p });
|
|
2243
|
+
continue;
|
|
2244
|
+
}
|
|
2245
|
+
if (p === ")") {
|
|
2246
|
+
if (h.parens === 0 && n.strictBrackets === !0)
|
|
2247
|
+
throw new SyntaxError(ve("opening", "("));
|
|
2248
|
+
const m = k[k.length - 1];
|
|
2249
|
+
if (m && h.parens === m.parens + 1) {
|
|
2250
|
+
yn(k.pop());
|
|
2251
|
+
continue;
|
|
2252
|
+
}
|
|
2253
|
+
I({ type: "paren", value: p, output: h.parens ? ")" : "\\)" }), me("parens");
|
|
2254
|
+
continue;
|
|
2255
|
+
}
|
|
2256
|
+
if (p === "[") {
|
|
2257
|
+
if (n.nobracket === !0 || !oe().includes("]")) {
|
|
2258
|
+
if (n.nobracket !== !0 && n.strictBrackets === !0)
|
|
2259
|
+
throw new SyntaxError(ve("closing", "]"));
|
|
2260
|
+
p = `\\${p}`;
|
|
2261
|
+
} else
|
|
2262
|
+
Te("brackets");
|
|
2263
|
+
I({ type: "bracket", value: p });
|
|
2264
|
+
continue;
|
|
2265
|
+
}
|
|
2266
|
+
if (p === "]") {
|
|
2267
|
+
if (n.nobracket === !0 || l && l.type === "bracket" && l.value.length === 1) {
|
|
2268
|
+
I({ type: "text", value: p, output: `\\${p}` });
|
|
2269
|
+
continue;
|
|
2270
|
+
}
|
|
2271
|
+
if (h.brackets === 0) {
|
|
2272
|
+
if (n.strictBrackets === !0)
|
|
2273
|
+
throw new SyntaxError(ve("opening", "["));
|
|
2274
|
+
I({ type: "text", value: p, output: `\\${p}` });
|
|
2275
|
+
continue;
|
|
2276
|
+
}
|
|
2277
|
+
me("brackets");
|
|
2278
|
+
const m = l.value.slice(1);
|
|
2279
|
+
if (l.posix !== !0 && m[0] === "^" && !m.includes("/") && (p = `/${p}`), l.value += p, Le({ value: p }), n.literalBrackets === !1 || Z.hasRegexChars(m))
|
|
2280
|
+
continue;
|
|
2281
|
+
const T = Z.escapeRegex(l.value);
|
|
2282
|
+
if (h.output = h.output.slice(0, -l.value.length), n.literalBrackets === !0) {
|
|
2283
|
+
h.output += T, l.value = T;
|
|
2284
|
+
continue;
|
|
2285
|
+
}
|
|
2286
|
+
l.value = `(${a}${T}|${l.value})`, h.output += l.value;
|
|
2287
|
+
continue;
|
|
2288
|
+
}
|
|
2289
|
+
if (p === "{" && n.nobrace !== !0) {
|
|
2290
|
+
Te("braces");
|
|
2291
|
+
const m = {
|
|
2292
|
+
type: "brace",
|
|
2293
|
+
value: p,
|
|
2294
|
+
output: "(",
|
|
2295
|
+
outputIndex: h.output.length,
|
|
2296
|
+
tokensIndex: h.tokens.length
|
|
2297
|
+
};
|
|
2298
|
+
H.push(m), I(m);
|
|
2299
|
+
continue;
|
|
2300
|
+
}
|
|
2301
|
+
if (p === "}") {
|
|
2302
|
+
const m = H[H.length - 1];
|
|
2303
|
+
if (n.nobrace === !0 || !m) {
|
|
2304
|
+
I({ type: "text", value: p, output: p });
|
|
2305
|
+
continue;
|
|
2306
|
+
}
|
|
2307
|
+
let T = ")";
|
|
2308
|
+
if (m.dots === !0) {
|
|
2309
|
+
const j = r.slice(), W = [];
|
|
2310
|
+
for (let G = j.length - 1; G >= 0 && (r.pop(), j[G].type !== "brace"); G--)
|
|
2311
|
+
j[G].type !== "dots" && W.unshift(j[G].value);
|
|
2312
|
+
T = Ls(W, n), h.backtrack = !0;
|
|
2313
|
+
}
|
|
2314
|
+
if (m.comma !== !0 && m.dots !== !0) {
|
|
2315
|
+
const j = h.output.slice(0, m.outputIndex), W = h.tokens.slice(m.tokensIndex);
|
|
2316
|
+
m.value = m.output = "\\{", p = T = "\\}", h.output = j;
|
|
2317
|
+
for (const G of W)
|
|
2318
|
+
h.output += G.output || G.value;
|
|
2319
|
+
}
|
|
2320
|
+
I({ type: "brace", value: p, output: T }), me("braces"), H.pop();
|
|
2321
|
+
continue;
|
|
2322
|
+
}
|
|
2323
|
+
if (p === "|") {
|
|
2324
|
+
k.length > 0 && k[k.length - 1].conditions++, I({ type: "text", value: p });
|
|
2325
|
+
continue;
|
|
2326
|
+
}
|
|
2327
|
+
if (p === ",") {
|
|
2328
|
+
let m = p;
|
|
2329
|
+
const T = H[H.length - 1];
|
|
2330
|
+
T && pe[pe.length - 1] === "braces" && (T.comma = !0, m = "|"), I({ type: "comma", value: p, output: m });
|
|
2331
|
+
continue;
|
|
2332
|
+
}
|
|
2333
|
+
if (p === "/") {
|
|
2334
|
+
if (l.type === "dot" && h.index === h.start + 1) {
|
|
2335
|
+
h.start = h.index + 1, h.consumed = "", h.output = "", r.pop(), l = o;
|
|
2336
|
+
continue;
|
|
2337
|
+
}
|
|
2338
|
+
I({ type: "slash", value: p, output: g });
|
|
2339
|
+
continue;
|
|
2340
|
+
}
|
|
2341
|
+
if (p === ".") {
|
|
2342
|
+
if (h.braces > 0 && l.type === "dot") {
|
|
2343
|
+
l.value === "." && (l.output = c);
|
|
2344
|
+
const m = H[H.length - 1];
|
|
2345
|
+
l.type = "dots", l.output += p, l.value += p, m.dots = !0;
|
|
2346
|
+
continue;
|
|
2347
|
+
}
|
|
2348
|
+
if (h.braces + h.parens === 0 && l.type !== "bos" && l.type !== "slash") {
|
|
2349
|
+
I({ type: "text", value: p, output: c });
|
|
2350
|
+
continue;
|
|
2351
|
+
}
|
|
2352
|
+
I({ type: "dot", value: p, output: c });
|
|
2353
|
+
continue;
|
|
2354
|
+
}
|
|
2355
|
+
if (p === "?") {
|
|
2356
|
+
if (!(l && l.value === "(") && n.noextglob !== !0 && D() === "(" && D(2) !== "?") {
|
|
2357
|
+
De("qmark", p);
|
|
2358
|
+
continue;
|
|
2359
|
+
}
|
|
2360
|
+
if (l && l.type === "paren") {
|
|
2361
|
+
const T = D();
|
|
2362
|
+
let j = p;
|
|
2363
|
+
if (T === "<" && !Z.supportsLookbehinds())
|
|
2364
|
+
throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
|
2365
|
+
(l.value === "(" && !/[!=<:]/.test(T) || T === "<" && !/<([!=]|\w+>)/.test(oe())) && (j = `\\${p}`), I({ type: "text", value: p, output: j });
|
|
2366
|
+
continue;
|
|
2367
|
+
}
|
|
2368
|
+
if (n.dot !== !0 && (l.type === "slash" || l.type === "bos")) {
|
|
2369
|
+
I({ type: "qmark", value: p, output: S });
|
|
2370
|
+
continue;
|
|
2371
|
+
}
|
|
2372
|
+
I({ type: "qmark", value: p, output: b });
|
|
2373
|
+
continue;
|
|
2374
|
+
}
|
|
2375
|
+
if (p === "!") {
|
|
2376
|
+
if (n.noextglob !== !0 && D() === "(" && (D(2) !== "?" || !/[!=<:]/.test(D(3)))) {
|
|
2377
|
+
De("negate", p);
|
|
2378
|
+
continue;
|
|
2379
|
+
}
|
|
2380
|
+
if (n.nonegate !== !0 && h.index === 0) {
|
|
2381
|
+
mn();
|
|
2382
|
+
continue;
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
if (p === "+") {
|
|
2386
|
+
if (n.noextglob !== !0 && D() === "(" && D(2) !== "?") {
|
|
2387
|
+
De("plus", p);
|
|
2388
|
+
continue;
|
|
2389
|
+
}
|
|
2390
|
+
if (l && l.value === "(" || n.regex === !1) {
|
|
2391
|
+
I({ type: "plus", value: p, output: d });
|
|
2392
|
+
continue;
|
|
2393
|
+
}
|
|
2394
|
+
if (l && (l.type === "bracket" || l.type === "paren" || l.type === "brace") || h.parens > 0) {
|
|
2395
|
+
I({ type: "plus", value: p });
|
|
2396
|
+
continue;
|
|
2397
|
+
}
|
|
2398
|
+
I({ type: "plus", value: d });
|
|
2399
|
+
continue;
|
|
2400
|
+
}
|
|
2401
|
+
if (p === "@") {
|
|
2402
|
+
if (n.noextglob !== !0 && D() === "(" && D(2) !== "?") {
|
|
2403
|
+
I({ type: "at", extglob: !0, value: p, output: "" });
|
|
2404
|
+
continue;
|
|
2405
|
+
}
|
|
2406
|
+
I({ type: "text", value: p });
|
|
2407
|
+
continue;
|
|
2408
|
+
}
|
|
2409
|
+
if (p !== "*") {
|
|
2410
|
+
(p === "$" || p === "^") && (p = `\\${p}`);
|
|
2411
|
+
const m = $s.exec(oe());
|
|
2412
|
+
m && (p += m[0], h.index += m[0].length), I({ type: "text", value: p });
|
|
2413
|
+
continue;
|
|
2414
|
+
}
|
|
2415
|
+
if (l && (l.type === "globstar" || l.star === !0)) {
|
|
2416
|
+
l.type = "star", l.star = !0, l.value += p, l.output = z, h.backtrack = !0, h.globstar = !0, X(p);
|
|
2417
|
+
continue;
|
|
2418
|
+
}
|
|
2419
|
+
let _ = oe();
|
|
2420
|
+
if (n.noextglob !== !0 && /^\([^?]/.test(_)) {
|
|
2421
|
+
De("star", p);
|
|
2422
|
+
continue;
|
|
2423
|
+
}
|
|
2424
|
+
if (l.type === "star") {
|
|
2425
|
+
if (n.noglobstar === !0) {
|
|
2426
|
+
X(p);
|
|
2427
|
+
continue;
|
|
2428
|
+
}
|
|
2429
|
+
const m = l.prev, T = m.prev, j = m.type === "slash" || m.type === "bos", W = T && (T.type === "star" || T.type === "globstar");
|
|
2430
|
+
if (n.bash === !0 && (!j || _[0] && _[0] !== "/")) {
|
|
2431
|
+
I({ type: "star", value: p, output: "" });
|
|
2432
|
+
continue;
|
|
2433
|
+
}
|
|
2434
|
+
const G = h.braces > 0 && (m.type === "comma" || m.type === "brace"), Xe = k.length && (m.type === "pipe" || m.type === "paren");
|
|
2435
|
+
if (!j && m.type !== "paren" && !G && !Xe) {
|
|
2436
|
+
I({ type: "star", value: p, output: "" });
|
|
2437
|
+
continue;
|
|
2438
|
+
}
|
|
2439
|
+
for (; _.slice(0, 3) === "/**"; ) {
|
|
2440
|
+
const Pe = e[h.index + 4];
|
|
2441
|
+
if (Pe && Pe !== "/")
|
|
2442
|
+
break;
|
|
2443
|
+
_ = _.slice(3), X("/**", 3);
|
|
2444
|
+
}
|
|
2445
|
+
if (m.type === "bos" && K()) {
|
|
2446
|
+
l.type = "globstar", l.value += p, l.output = P(n), h.output = l.output, h.globstar = !0, X(p);
|
|
2447
|
+
continue;
|
|
2448
|
+
}
|
|
2449
|
+
if (m.type === "slash" && m.prev.type !== "bos" && !W && K()) {
|
|
2450
|
+
h.output = h.output.slice(0, -(m.output + l.output).length), m.output = `(?:${m.output}`, l.type = "globstar", l.output = P(n) + (n.strictSlashes ? ")" : "|$)"), l.value += p, h.globstar = !0, h.output += m.output + l.output, X(p);
|
|
2451
|
+
continue;
|
|
2452
|
+
}
|
|
2453
|
+
if (m.type === "slash" && m.prev.type !== "bos" && _[0] === "/") {
|
|
2454
|
+
const Pe = _[1] !== void 0 ? "|$" : "";
|
|
2455
|
+
h.output = h.output.slice(0, -(m.output + l.output).length), m.output = `(?:${m.output}`, l.type = "globstar", l.output = `${P(n)}${g}|${g}${Pe})`, l.value += p, h.output += m.output + l.output, h.globstar = !0, X(p + se()), I({ type: "slash", value: "/", output: "" });
|
|
2456
|
+
continue;
|
|
2457
|
+
}
|
|
2458
|
+
if (m.type === "bos" && _[0] === "/") {
|
|
2459
|
+
l.type = "globstar", l.value += p, l.output = `(?:^|${g}|${P(n)}${g})`, h.output = l.output, h.globstar = !0, X(p + se()), I({ type: "slash", value: "/", output: "" });
|
|
2460
|
+
continue;
|
|
2461
|
+
}
|
|
2462
|
+
h.output = h.output.slice(0, -l.output.length), l.type = "globstar", l.output = P(n), l.value += p, h.output += l.output, h.globstar = !0, X(p);
|
|
2463
|
+
continue;
|
|
2464
|
+
}
|
|
2465
|
+
const N = { type: "star", value: p, output: z };
|
|
2466
|
+
if (n.bash === !0) {
|
|
2467
|
+
N.output = ".*?", (l.type === "bos" || l.type === "slash") && (N.output = A + N.output), I(N);
|
|
2468
|
+
continue;
|
|
2469
|
+
}
|
|
2470
|
+
if (l && (l.type === "bracket" || l.type === "paren") && n.regex === !0) {
|
|
2471
|
+
N.output = p, I(N);
|
|
2472
|
+
continue;
|
|
2473
|
+
}
|
|
2474
|
+
(h.index === h.start || l.type === "slash" || l.type === "dot") && (l.type === "dot" ? (h.output += v, l.output += v) : n.dot === !0 ? (h.output += x, l.output += x) : (h.output += A, l.output += A), D() !== "*" && (h.output += w, l.output += w)), I(N);
|
|
2475
|
+
}
|
|
2476
|
+
for (; h.brackets > 0; ) {
|
|
2477
|
+
if (n.strictBrackets === !0)
|
|
2478
|
+
throw new SyntaxError(ve("closing", "]"));
|
|
2479
|
+
h.output = Z.escapeLast(h.output, "["), me("brackets");
|
|
2480
|
+
}
|
|
2481
|
+
for (; h.parens > 0; ) {
|
|
2482
|
+
if (n.strictBrackets === !0)
|
|
2483
|
+
throw new SyntaxError(ve("closing", ")"));
|
|
2484
|
+
h.output = Z.escapeLast(h.output, "("), me("parens");
|
|
2485
|
+
}
|
|
2486
|
+
for (; h.braces > 0; ) {
|
|
2487
|
+
if (n.strictBrackets === !0)
|
|
2488
|
+
throw new SyntaxError(ve("closing", "}"));
|
|
2489
|
+
h.output = Z.escapeLast(h.output, "{"), me("braces");
|
|
2490
|
+
}
|
|
2491
|
+
if (n.strictSlashes !== !0 && (l.type === "star" || l.type === "bracket") && I({ type: "maybe_slash", value: "", output: `${g}?` }), h.backtrack === !0) {
|
|
2492
|
+
h.output = "";
|
|
2493
|
+
for (const _ of h.tokens)
|
|
2494
|
+
h.output += _.output != null ? _.output : _.value, _.suffix && (h.output += _.suffix);
|
|
2495
|
+
}
|
|
2496
|
+
return h;
|
|
2497
|
+
};
|
|
2498
|
+
pn.fastpaths = (e, t) => {
|
|
2499
|
+
const n = { ...t }, s = typeof n.maxLength == "number" ? Math.min(ze, n.maxLength) : ze, i = e.length;
|
|
2500
|
+
if (i > s)
|
|
2501
|
+
throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${s}`);
|
|
2502
|
+
e = ln[e] || e;
|
|
2503
|
+
const {
|
|
2504
|
+
DOT_LITERAL: o,
|
|
2505
|
+
SLASH_LITERAL: r,
|
|
2506
|
+
ONE_CHAR: a,
|
|
2507
|
+
DOTS_SLASH: u,
|
|
2508
|
+
NO_DOT: f,
|
|
2509
|
+
NO_DOTS: c,
|
|
2510
|
+
NO_DOTS_SLASH: d,
|
|
2511
|
+
STAR: g,
|
|
2512
|
+
START_ANCHOR: w
|
|
2513
|
+
} = Fe.globChars(n.windows), y = n.dot ? c : f, O = n.dot ? d : f, v = n.capture ? "" : "?:", x = { negated: !1, prefix: "" };
|
|
2514
|
+
let b = n.bash === !0 ? ".*?" : g;
|
|
2515
|
+
n.capture && (b = `(${b})`);
|
|
2516
|
+
const S = (A) => A.noglobstar === !0 ? b : `(${v}(?:(?!${w}${A.dot ? u : o}).)*?)`, M = (A) => {
|
|
2517
|
+
switch (A) {
|
|
2518
|
+
case "*":
|
|
2519
|
+
return `${y}${a}${b}`;
|
|
2520
|
+
case ".*":
|
|
2521
|
+
return `${o}${a}${b}`;
|
|
2522
|
+
case "*.*":
|
|
2523
|
+
return `${y}${b}${o}${a}${b}`;
|
|
2524
|
+
case "*/*":
|
|
2525
|
+
return `${y}${b}${r}${a}${O}${b}`;
|
|
2526
|
+
case "**":
|
|
2527
|
+
return y + S(n);
|
|
2528
|
+
case "**/*":
|
|
2529
|
+
return `(?:${y}${S(n)}${r})?${O}${a}${b}`;
|
|
2530
|
+
case "**/*.*":
|
|
2531
|
+
return `(?:${y}${S(n)}${r})?${O}${b}${o}${a}${b}`;
|
|
2532
|
+
case "**/.*":
|
|
2533
|
+
return `(?:${y}${S(n)}${r})?${o}${a}${b}`;
|
|
2534
|
+
default: {
|
|
2535
|
+
const L = /^(.*?)\.(\w+)$/.exec(A);
|
|
2536
|
+
if (!L)
|
|
2537
|
+
return;
|
|
2538
|
+
const z = M(L[1]);
|
|
2539
|
+
return z ? z + o + L[2] : void 0;
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
}, R = Z.removePrefix(e, x);
|
|
2543
|
+
let P = M(R);
|
|
2544
|
+
return P && n.strictSlashes !== !0 && (P += `${r}?`), P;
|
|
2545
|
+
};
|
|
2546
|
+
var Ts = pn;
|
|
2547
|
+
const Ds = Is, ct = Ts, hn = Ke, Ps = Je, Hs = (e) => e && typeof e == "object" && !Array.isArray(e), B = (e, t, n = !1) => {
|
|
2548
|
+
if (Array.isArray(e)) {
|
|
2549
|
+
const c = e.map((g) => B(g, t, n));
|
|
2550
|
+
return (g) => {
|
|
2551
|
+
for (const w of c) {
|
|
2552
|
+
const y = w(g);
|
|
2553
|
+
if (y)
|
|
2554
|
+
return y;
|
|
2555
|
+
}
|
|
2556
|
+
return !1;
|
|
2557
|
+
};
|
|
2558
|
+
}
|
|
2559
|
+
const s = Hs(e) && e.tokens && e.input;
|
|
2560
|
+
if (e === "" || typeof e != "string" && !s)
|
|
2561
|
+
throw new TypeError("Expected pattern to be a non-empty string");
|
|
2562
|
+
const i = t || {}, o = i.windows, r = s ? B.compileRe(e, t) : B.makeRe(e, t, !1, !0), a = r.state;
|
|
2563
|
+
delete r.state;
|
|
2564
|
+
let u = () => !1;
|
|
2565
|
+
if (i.ignore) {
|
|
2566
|
+
const c = { ...t, ignore: null, onMatch: null, onResult: null };
|
|
2567
|
+
u = B(i.ignore, c, n);
|
|
2568
|
+
}
|
|
2569
|
+
const f = (c, d = !1) => {
|
|
2570
|
+
const { isMatch: g, match: w, output: y } = B.test(c, r, t, { glob: e, posix: o }), O = { glob: e, state: a, regex: r, posix: o, input: c, output: y, match: w, isMatch: g };
|
|
2571
|
+
return typeof i.onResult == "function" && i.onResult(O), g === !1 ? (O.isMatch = !1, d ? O : !1) : u(c) ? (typeof i.onIgnore == "function" && i.onIgnore(O), O.isMatch = !1, d ? O : !1) : (typeof i.onMatch == "function" && i.onMatch(O), d ? O : !0);
|
|
2572
|
+
};
|
|
2573
|
+
return n && (f.state = a), f;
|
|
2574
|
+
};
|
|
2575
|
+
B.test = (e, t, n, { glob: s, posix: i } = {}) => {
|
|
2576
|
+
if (typeof e != "string")
|
|
2577
|
+
throw new TypeError("Expected input to be a string");
|
|
2578
|
+
if (e === "")
|
|
2579
|
+
return { isMatch: !1, output: "" };
|
|
2580
|
+
const o = n || {}, r = o.format || (i ? hn.toPosixSlashes : null);
|
|
2581
|
+
let a = e === s, u = a && r ? r(e) : e;
|
|
2582
|
+
return a === !1 && (u = r ? r(e) : e, a = u === s), (a === !1 || o.capture === !0) && (o.matchBase === !0 || o.basename === !0 ? a = B.matchBase(e, t, n, i) : a = t.exec(u)), { isMatch: !!a, match: a, output: u };
|
|
2583
|
+
};
|
|
2584
|
+
B.matchBase = (e, t, n) => (t instanceof RegExp ? t : B.makeRe(t, n)).test(hn.basename(e));
|
|
2585
|
+
B.isMatch = (e, t, n) => B(t, n)(e);
|
|
2586
|
+
B.parse = (e, t) => Array.isArray(e) ? e.map((n) => B.parse(n, t)) : ct(e, { ...t, fastpaths: !1 });
|
|
2587
|
+
B.scan = (e, t) => Ds(e, t);
|
|
2588
|
+
B.compileRe = (e, t, n = !1, s = !1) => {
|
|
2589
|
+
if (n === !0)
|
|
2590
|
+
return e.output;
|
|
2591
|
+
const i = t || {}, o = i.contains ? "" : "^", r = i.contains ? "" : "$";
|
|
2592
|
+
let a = `${o}(?:${e.output})${r}`;
|
|
2593
|
+
e && e.negated === !0 && (a = `^(?!${a}).*$`);
|
|
2594
|
+
const u = B.toRegex(a, t);
|
|
2595
|
+
return s === !0 && (u.state = e), u;
|
|
2596
|
+
};
|
|
2597
|
+
B.makeRe = (e, t, n = !1, s = !1) => {
|
|
2598
|
+
if (!e || typeof e != "string")
|
|
2599
|
+
throw new TypeError("Expected a non-empty string");
|
|
2600
|
+
const i = t || {};
|
|
2601
|
+
let o = { negated: !1, fastpaths: !0 }, r = "", a;
|
|
2602
|
+
return e.startsWith("./") && (e = e.slice(2), r = o.prefix = "./"), i.fastpaths !== !1 && (e[0] === "." || e[0] === "*") && (a = ct.fastpaths(e, t)), a === void 0 ? (o = ct(e, t), o.prefix = r + (o.prefix || "")) : o.output = a, B.compileRe(o, t, n, s);
|
|
2603
|
+
};
|
|
2604
|
+
B.toRegex = (e, t) => {
|
|
2605
|
+
try {
|
|
2606
|
+
const n = t || {};
|
|
2607
|
+
return new RegExp(e, n.flags || (n.nocase ? "i" : ""));
|
|
2608
|
+
} catch (n) {
|
|
2609
|
+
if (t && t.debug === !0)
|
|
2610
|
+
throw n;
|
|
2611
|
+
return /$^/;
|
|
2612
|
+
}
|
|
2613
|
+
};
|
|
2614
|
+
B.constants = Ps;
|
|
2615
|
+
var ks = B, Ns = ks;
|
|
2616
|
+
const Ft = /* @__PURE__ */ lt(Ns);
|
|
2617
|
+
class js extends gt.EventEmitter {
|
|
2618
|
+
constructor(t, n, s, i, o, r = !1) {
|
|
1730
2619
|
if (super(), this.inputs = {}, this.outputs = {}, this._disposables = [], this._rpcListeners = [], this._loaded = !1, this._onLoaded = [], this._sendInputsAfterRegistration = !1, this._cachedEventInputsUpdate = {
|
|
1731
2620
|
iframeId: void 0,
|
|
1732
2621
|
inputs: void 0
|
|
@@ -1738,192 +2627,192 @@ class nn extends De.EventEmitter {
|
|
|
1738
2627
|
n = n.substring(1);
|
|
1739
2628
|
n = window.location.protocol + "//" + window.location.hostname + (window.location.port && window.location.port != "" ? ":" + window.location.port : "") + "/" + n;
|
|
1740
2629
|
}
|
|
1741
|
-
if (this.url = n, this._metapage =
|
|
1742
|
-
var
|
|
1743
|
-
|
|
1744
|
-
}
|
|
1745
|
-
this.id = s, this._parentId = i, this._color =
|
|
1746
|
-
const
|
|
1747
|
-
this.iframe = new Promise((
|
|
1748
|
-
|
|
1749
|
-
var c,
|
|
1750
|
-
if (
|
|
1751
|
-
if ((
|
|
1752
|
-
|
|
2630
|
+
if (this.url = n, this._metapage = t, this._debug = r, r) {
|
|
2631
|
+
var a = new URL(this.url);
|
|
2632
|
+
a.searchParams.set($e.mp_debug, "true"), this.url = a.href;
|
|
2633
|
+
}
|
|
2634
|
+
this.id = s, this._parentId = i, this._color = rn(this.id), this._consoleBackgroundColor = o, this._iframe = document.createElement("iframe"), this._iframe.name = this.id;
|
|
2635
|
+
const u = this;
|
|
2636
|
+
this.iframe = new Promise((f) => {
|
|
2637
|
+
wt().then(async () => {
|
|
2638
|
+
var c, d, g, w;
|
|
2639
|
+
if (u._iframe) {
|
|
2640
|
+
if ((w = (g = (d = (c = this._metapage) == null ? void 0 : c._definition) == null ? void 0 : d.metaframes) == null ? void 0 : g[this.id]) != null && w.allow)
|
|
2641
|
+
u._iframe.allow = this._metapage._definition.metaframes[this.id].allow;
|
|
1753
2642
|
else {
|
|
1754
|
-
const
|
|
1755
|
-
if (!
|
|
2643
|
+
const y = await u.getDefinition();
|
|
2644
|
+
if (!u._iframe)
|
|
1756
2645
|
return;
|
|
1757
|
-
|
|
2646
|
+
y && y.allow && (u._iframe.allow = y.allow);
|
|
1758
2647
|
}
|
|
1759
|
-
|
|
2648
|
+
u._iframe.src = this.url, f(u._iframe);
|
|
1760
2649
|
}
|
|
1761
2650
|
});
|
|
1762
2651
|
}), this.ack = this.ack.bind(this), this.dispose = this.dispose.bind(this), this.getDefinition = this.getDefinition.bind(this), this.getDefinitionUrl = this.getDefinitionUrl.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.onOutput = this.onOutput.bind(this), this.onOutputs = this.onOutputs.bind(this), this.register = this.register.bind(this), this.registered = this.registered.bind(this), this.sendInputs = this.sendInputs.bind(this), this.sendOrBufferPostMessage = this.sendOrBufferPostMessage.bind(this), this.sendRpc = this.sendRpc.bind(this), this.sendRpcInternal = this.sendRpcInternal.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setMetapage = this.setMetapage.bind(this), this.setOutput = this.setOutput.bind(this), this.setOutputs = this.setOutputs.bind(this), this.addListenerReturnDisposer = this.addListenerReturnDisposer.bind(this), this.isDisposed = this.isDisposed.bind(this);
|
|
1763
2652
|
}
|
|
1764
|
-
addListenerReturnDisposer(
|
|
1765
|
-
return super.addListener(
|
|
1766
|
-
super.removeListener(
|
|
2653
|
+
addListenerReturnDisposer(t, n) {
|
|
2654
|
+
return super.addListener(t, n), () => {
|
|
2655
|
+
super.removeListener(t, n);
|
|
1767
2656
|
};
|
|
1768
2657
|
}
|
|
1769
|
-
setMetapage(
|
|
1770
|
-
return this._metapage =
|
|
2658
|
+
setMetapage(t) {
|
|
2659
|
+
return this._metapage = t, this;
|
|
1771
2660
|
}
|
|
1772
2661
|
getDefinitionUrl() {
|
|
1773
|
-
var
|
|
1774
|
-
return
|
|
2662
|
+
var t = new URL(this.url);
|
|
2663
|
+
return t.pathname = t.pathname + (t.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json"), t.href;
|
|
1775
2664
|
}
|
|
1776
2665
|
async getDefinition() {
|
|
1777
2666
|
if (this._definition)
|
|
1778
2667
|
return this._definition;
|
|
1779
|
-
var
|
|
2668
|
+
var t = this.getDefinitionUrl();
|
|
1780
2669
|
try {
|
|
1781
|
-
const n = await window.fetch(
|
|
2670
|
+
const n = await window.fetch(t, {
|
|
1782
2671
|
signal: AbortSignal.timeout(6e3)
|
|
1783
2672
|
});
|
|
1784
2673
|
if (n.ok) {
|
|
1785
|
-
const s = await n.json(), i = await
|
|
2674
|
+
const s = await n.json(), i = await Wn(s);
|
|
1786
2675
|
return this._definition = i, this._definition;
|
|
1787
2676
|
} else
|
|
1788
|
-
this.emit(
|
|
2677
|
+
this.emit(E.Error, `Failed to fetch: ${t}
|
|
1789
2678
|
Status: ${n.status}
|
|
1790
2679
|
Status text: ${n.statusText}`);
|
|
1791
2680
|
} catch (n) {
|
|
1792
|
-
this.emit(
|
|
2681
|
+
this.emit(E.Error, `Failed to fetch or convert: ${t}
|
|
1793
2682
|
Error: ${n}`);
|
|
1794
2683
|
}
|
|
1795
2684
|
}
|
|
1796
|
-
setInput(
|
|
1797
|
-
console.assert(!!
|
|
2685
|
+
setInput(t, n) {
|
|
2686
|
+
console.assert(!!t);
|
|
1798
2687
|
var s = {};
|
|
1799
|
-
s[
|
|
2688
|
+
s[t] = n, this.setInputs(s);
|
|
1800
2689
|
}
|
|
1801
|
-
setInputs(
|
|
1802
|
-
this.log({ m: "MetapageIFrameRpcClient", inputs:
|
|
1803
|
-
const n =
|
|
1804
|
-
if (this.inputs =
|
|
2690
|
+
setInputs(t) {
|
|
2691
|
+
this.log({ m: "MetapageIFrameRpcClient", inputs: t });
|
|
2692
|
+
const n = t;
|
|
2693
|
+
if (this.inputs = Be(this.inputs, t), this.inputs === n)
|
|
1805
2694
|
return this;
|
|
1806
|
-
if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(
|
|
2695
|
+
if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(t), this.emit(E.Inputs, this.inputs), this._metapage.listenerCount(E.Inputs) > 0) {
|
|
1807
2696
|
var s = {};
|
|
1808
|
-
s[this.id] =
|
|
2697
|
+
s[this.id] = t, this._metapage.emit(E.Inputs, s);
|
|
1809
2698
|
}
|
|
1810
2699
|
return this;
|
|
1811
2700
|
}
|
|
1812
|
-
setOutput(
|
|
1813
|
-
console.assert(!!
|
|
2701
|
+
setOutput(t, n) {
|
|
2702
|
+
console.assert(!!t);
|
|
1814
2703
|
var s = {};
|
|
1815
|
-
s[
|
|
2704
|
+
s[t] = n, this.setOutputs(s);
|
|
1816
2705
|
}
|
|
1817
|
-
setOutputs(
|
|
1818
|
-
const n =
|
|
1819
|
-
if (this.outputs =
|
|
2706
|
+
setOutputs(t) {
|
|
2707
|
+
const n = t;
|
|
2708
|
+
if (this.outputs = Be(this.outputs, t), this.outputs === n)
|
|
1820
2709
|
return this;
|
|
1821
|
-
if (this.emit(
|
|
2710
|
+
if (this.emit(E.Outputs, t), this._metapage.listenerCount(E.Outputs) > 0) {
|
|
1822
2711
|
var s = {};
|
|
1823
|
-
s[this.id] = this.outputs, this._metapage.emit(
|
|
2712
|
+
s[this.id] = this.outputs, this._metapage.emit(E.Outputs, s);
|
|
1824
2713
|
}
|
|
1825
2714
|
}
|
|
1826
|
-
onInputs(
|
|
1827
|
-
return this.addListenerReturnDisposer(
|
|
2715
|
+
onInputs(t) {
|
|
2716
|
+
return this.addListenerReturnDisposer(E.Inputs, t);
|
|
1828
2717
|
}
|
|
1829
|
-
onInput(
|
|
2718
|
+
onInput(t, n) {
|
|
1830
2719
|
var s = function(i) {
|
|
1831
|
-
i.hasOwnProperty(
|
|
2720
|
+
i.hasOwnProperty(t) && n(i[t]);
|
|
1832
2721
|
};
|
|
1833
|
-
return this.addListenerReturnDisposer(
|
|
2722
|
+
return this.addListenerReturnDisposer(E.Inputs, s);
|
|
1834
2723
|
}
|
|
1835
|
-
onOutputs(
|
|
1836
|
-
return this.addListenerReturnDisposer(
|
|
2724
|
+
onOutputs(t) {
|
|
2725
|
+
return this.addListenerReturnDisposer(E.Outputs, t);
|
|
1837
2726
|
}
|
|
1838
|
-
onOutput(
|
|
2727
|
+
onOutput(t, n) {
|
|
1839
2728
|
var s = function(i) {
|
|
1840
|
-
i.hasOwnProperty(
|
|
2729
|
+
i.hasOwnProperty(t) && n(i[t]);
|
|
1841
2730
|
};
|
|
1842
|
-
return this.addListenerReturnDisposer(
|
|
2731
|
+
return this.addListenerReturnDisposer(E.Outputs, s);
|
|
1843
2732
|
}
|
|
1844
2733
|
isDisposed() {
|
|
1845
2734
|
return this.inputs === void 0;
|
|
1846
2735
|
}
|
|
1847
2736
|
dispose() {
|
|
1848
2737
|
for (super.removeAllListeners(); this._disposables && this._disposables.length > 0; ) {
|
|
1849
|
-
const
|
|
1850
|
-
|
|
2738
|
+
const t = this._disposables.pop();
|
|
2739
|
+
t && t();
|
|
1851
2740
|
}
|
|
1852
2741
|
this._rpcListeners = void 0, this.inputs = void 0, this.outputs = void 0, this._iframe && this._iframe.parentNode && this._iframe.parentNode.removeChild(this._iframe), this._iframe = void 0, this._bufferMessages = void 0, this._bufferTimeout && (window.clearInterval(this._bufferTimeout), this._bufferTimeout = void 0), this._metapage = void 0;
|
|
1853
2742
|
}
|
|
1854
2743
|
register() {
|
|
1855
|
-
var
|
|
2744
|
+
var t = {
|
|
1856
2745
|
iframeId: this.id,
|
|
1857
2746
|
parentId: this._parentId,
|
|
1858
2747
|
state: {
|
|
1859
2748
|
inputs: this.inputs
|
|
1860
2749
|
},
|
|
1861
|
-
version:
|
|
2750
|
+
version: zt
|
|
1862
2751
|
};
|
|
1863
|
-
this.sendRpcInternal(
|
|
2752
|
+
this.sendRpcInternal(ce.SetupIframeServerResponse, t);
|
|
1864
2753
|
}
|
|
1865
|
-
registered(
|
|
2754
|
+
registered(t) {
|
|
1866
2755
|
if (this.log({ m: "MetapageIFrameRpcClient.registered", inputs: this.inputs }), !this._loaded) {
|
|
1867
|
-
if (!
|
|
2756
|
+
if (!t)
|
|
1868
2757
|
throw "Cannot register without a version";
|
|
1869
|
-
for (this.version =
|
|
2758
|
+
for (this.version = t, this._loaded = !0; this._onLoaded && this._onLoaded.length > 0; )
|
|
1870
2759
|
this._onLoaded.pop()();
|
|
1871
2760
|
this._sendInputsAfterRegistration && this.sendInputs(this.inputs);
|
|
1872
2761
|
}
|
|
1873
2762
|
}
|
|
1874
|
-
async sendInputs(
|
|
1875
|
-
|
|
1876
|
-
inputs:
|
|
2763
|
+
async sendInputs(t) {
|
|
2764
|
+
t && (t = await Ve(t), !this.isDisposed() && this.sendRpc(ce.InputsUpdate, {
|
|
2765
|
+
inputs: t,
|
|
1877
2766
|
parentId: this._parentId
|
|
1878
2767
|
}));
|
|
1879
2768
|
}
|
|
1880
|
-
sendRpc(
|
|
2769
|
+
sendRpc(t, n) {
|
|
1881
2770
|
var s, i;
|
|
1882
2771
|
if ((s = this == null ? void 0 : this._iframe) != null && s.parentNode && this._loaded)
|
|
1883
|
-
this.sendRpcInternal(
|
|
2772
|
+
this.sendRpcInternal(t, n);
|
|
1884
2773
|
else {
|
|
1885
2774
|
(i = this == null ? void 0 : this._metapage) == null || i.error("sending rpc later");
|
|
1886
|
-
const
|
|
2775
|
+
const o = this;
|
|
1887
2776
|
this == null || this._onLoaded.push(() => {
|
|
1888
|
-
|
|
2777
|
+
o.sendRpcInternal(t, n);
|
|
1889
2778
|
});
|
|
1890
2779
|
}
|
|
1891
2780
|
}
|
|
1892
|
-
ack(
|
|
2781
|
+
ack(t) {
|
|
1893
2782
|
if (this.log("⚒ ⚒ ⚒ calling ack"), this._debug) {
|
|
1894
2783
|
this.log("⚒ ⚒ ⚒ sending ack from client to frame");
|
|
1895
2784
|
var n = {
|
|
1896
|
-
message:
|
|
2785
|
+
message: t
|
|
1897
2786
|
};
|
|
1898
|
-
this.sendRpc(
|
|
2787
|
+
this.sendRpc(ce.MessageAck, n);
|
|
1899
2788
|
} else
|
|
1900
2789
|
this.log("⚒ ⚒ ⚒ NOT sending ack from client to frame since not debug mode");
|
|
1901
2790
|
}
|
|
1902
|
-
log(
|
|
1903
|
-
this._debug && this.logInternal(
|
|
2791
|
+
log(t) {
|
|
2792
|
+
this._debug && this.logInternal(t);
|
|
1904
2793
|
}
|
|
1905
|
-
logInternal(
|
|
2794
|
+
logInternal(t) {
|
|
1906
2795
|
let n;
|
|
1907
|
-
typeof
|
|
2796
|
+
typeof t == "string" ? n = t : typeof t == "string" ? n = t + "" : n = JSON.stringify(t), vt(`Metapage[${this._parentId}] Metaframe[${this.id}] ${n}`, this._color, this._consoleBackgroundColor);
|
|
1908
2797
|
}
|
|
1909
|
-
sendRpcInternal(
|
|
2798
|
+
sendRpcInternal(t, n) {
|
|
1910
2799
|
const s = {
|
|
1911
2800
|
id: "_",
|
|
1912
2801
|
iframeId: this.id,
|
|
1913
2802
|
jsonrpc: "2.0",
|
|
1914
|
-
method:
|
|
2803
|
+
method: t,
|
|
1915
2804
|
params: n,
|
|
1916
2805
|
parentId: this._parentId
|
|
1917
2806
|
};
|
|
1918
2807
|
this._iframe ? this.sendOrBufferPostMessage(s) : this._metapage ? this._metapage.error(`Cannot send to child iframe messageJSON=${JSON.stringify(s).substring(0, 200)}`) : console.error(`Cannot send to child iframe messageJSON=${JSON.stringify(s).substring(0, 200)}`);
|
|
1919
2808
|
}
|
|
1920
|
-
sendOrBufferPostMessage(
|
|
2809
|
+
sendOrBufferPostMessage(t) {
|
|
1921
2810
|
if (this._iframe && this._iframe.contentWindow)
|
|
1922
|
-
this._iframe.contentWindow.postMessage(
|
|
2811
|
+
this._iframe.contentWindow.postMessage(t, this.url);
|
|
1923
2812
|
else if (this._bufferMessages)
|
|
1924
|
-
this._bufferMessages.push(
|
|
2813
|
+
this._bufferMessages.push(t);
|
|
1925
2814
|
else {
|
|
1926
|
-
this._bufferMessages = [
|
|
2815
|
+
this._bufferMessages = [t];
|
|
1927
2816
|
const n = this;
|
|
1928
2817
|
this._bufferTimeout = window.setInterval(function() {
|
|
1929
2818
|
n._iframe && n._iframe.contentWindow && (n._bufferMessages.forEach((s) => n._iframe.contentWindow.postMessage(s, n.url)), window.clearInterval(n._bufferTimeout), n._bufferTimeout = void 0, n._bufferMessages = void 0);
|
|
@@ -1931,49 +2820,49 @@ Error: ${n}`);
|
|
|
1931
2820
|
}
|
|
1932
2821
|
}
|
|
1933
2822
|
}
|
|
1934
|
-
const
|
|
2823
|
+
const ye = C({
|
|
1935
2824
|
metaframes: {
|
|
1936
2825
|
inputs: {},
|
|
1937
2826
|
outputs: {}
|
|
1938
2827
|
}
|
|
1939
|
-
}, (
|
|
1940
|
-
class
|
|
1941
|
-
static async from(
|
|
1942
|
-
if (
|
|
2828
|
+
}, (e) => e), ri = (e) => Re(e), Us = (e, t, n) => (!t || t === "*") && (!n || n === "*") || e === t ? !0 : Ft.isMatch(e, t) ? !!(!n || n === "*" || n.endsWith("/") || Ft.isMatch(e, n)) : !1, Bs = "bcbcbc";
|
|
2829
|
+
class ne extends rs {
|
|
2830
|
+
static async from(t, n) {
|
|
2831
|
+
if (t == null)
|
|
1943
2832
|
throw "Metapage definition cannot be null";
|
|
1944
|
-
if (typeof
|
|
2833
|
+
if (typeof t == "string")
|
|
1945
2834
|
try {
|
|
1946
|
-
|
|
2835
|
+
t = JSON.parse(t);
|
|
1947
2836
|
} catch {
|
|
1948
2837
|
throw "Cannot parse into JSON:\n${metaPageDef}";
|
|
1949
2838
|
}
|
|
1950
|
-
var s = new
|
|
1951
|
-
return s.setDefinition(
|
|
2839
|
+
var s = new ne();
|
|
2840
|
+
return s.setDefinition(t);
|
|
1952
2841
|
}
|
|
1953
|
-
constructor(
|
|
1954
|
-
super(), this._state =
|
|
2842
|
+
constructor(t) {
|
|
2843
|
+
super(), this._state = ye, this._metaframes = C({}, (n) => n), this.debug = ut(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = C({}, (n) => n), this._inputMap = {}, this._id = t && t.id ? t.id : os(), this._consoleBackgroundColor = t && t.color ? t.color : Bs, 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), wt().then(() => {
|
|
1955
2844
|
this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
|
|
1956
2845
|
});
|
|
1957
2846
|
}
|
|
1958
2847
|
isDisposed() {
|
|
1959
2848
|
return this._metaframes === void 0;
|
|
1960
2849
|
}
|
|
1961
|
-
addListenerReturnDisposer(
|
|
1962
|
-
return super.addListener(
|
|
1963
|
-
super.removeListener(
|
|
2850
|
+
addListenerReturnDisposer(t, n) {
|
|
2851
|
+
return super.addListener(t, n), () => {
|
|
2852
|
+
super.removeListener(t, n);
|
|
1964
2853
|
};
|
|
1965
2854
|
}
|
|
1966
2855
|
setDebugFromUrlParams() {
|
|
1967
|
-
const
|
|
1968
|
-
return this.debug = ["debug", "mp_debug"].reduce((n, s) => n ||
|
|
2856
|
+
const t = new URL(window.location.href);
|
|
2857
|
+
return this.debug = ["debug", "mp_debug"].reduce((n, s) => n || t.searchParams.get(s) === "true" || t.searchParams.get(s) === "1", !1), this;
|
|
1969
2858
|
}
|
|
1970
2859
|
getState() {
|
|
1971
2860
|
return this._state;
|
|
1972
2861
|
}
|
|
1973
|
-
setState(
|
|
1974
|
-
this._state =
|
|
2862
|
+
setState(t) {
|
|
2863
|
+
this._state = C(t, (n) => n), this.getMetaframeIds().forEach((n) => {
|
|
1975
2864
|
this.getMetaframe(n).setInputs(this._state.metaframes.inputs[n]), this.getMetaframe(n).setOutputs(this._state.metaframes.outputs[n]);
|
|
1976
|
-
}), this.listenerCount(
|
|
2865
|
+
}), this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state);
|
|
1977
2866
|
}
|
|
1978
2867
|
getStateMetaframes() {
|
|
1979
2868
|
return this._state.metaframes;
|
|
@@ -1981,61 +2870,61 @@ class U extends Qt {
|
|
|
1981
2870
|
getDefinition() {
|
|
1982
2871
|
return this._definition;
|
|
1983
2872
|
}
|
|
1984
|
-
async setDefinition(
|
|
1985
|
-
if (!
|
|
2873
|
+
async setDefinition(t, n) {
|
|
2874
|
+
if (!t.version)
|
|
1986
2875
|
throw "Metapage definition must have a version";
|
|
1987
|
-
const s = await
|
|
2876
|
+
const s = await Nn(t);
|
|
1988
2877
|
if (this.isDisposed())
|
|
1989
2878
|
return this;
|
|
1990
|
-
s.metaframes && Object.keys(s.metaframes).forEach((
|
|
1991
|
-
var r = s.metaframes[
|
|
2879
|
+
s.metaframes && Object.keys(s.metaframes).forEach((o) => {
|
|
2880
|
+
var r = s.metaframes[o];
|
|
1992
2881
|
if (typeof r != "object")
|
|
1993
|
-
throw this.emitErrorMessage(`Metaframe "${
|
|
2882
|
+
throw this.emitErrorMessage(`Metaframe "${o}" is not an object`), `Metaframe "${o}" is not an object`;
|
|
1994
2883
|
if (!r.url)
|
|
1995
|
-
throw this.emitErrorMessage(`Metaframe "${
|
|
2884
|
+
throw this.emitErrorMessage(`Metaframe "${o}" missing field: url`), `Metaframe "${o}" missing field: url`;
|
|
1996
2885
|
});
|
|
1997
2886
|
const i = this._definition;
|
|
1998
|
-
return this._definition = s, Object.keys(this._metaframes).forEach((
|
|
1999
|
-
(!s.metaframes || !s.metaframes[
|
|
2000
|
-
}), n && (this._state =
|
|
2001
|
-
if (!this._metaframes.hasOwnProperty(
|
|
2002
|
-
const r = s.metaframes[
|
|
2003
|
-
this.addMetaframe(
|
|
2887
|
+
return this._definition = s, Object.keys(this._metaframes).forEach((o) => {
|
|
2888
|
+
(!s.metaframes || !s.metaframes[o]) && this.removeMetaframe(o);
|
|
2889
|
+
}), n && (this._state = C(n, (o) => o)), s.metaframes && Object.keys(s.metaframes).forEach((o) => {
|
|
2890
|
+
if (!this._metaframes.hasOwnProperty(o)) {
|
|
2891
|
+
const r = s.metaframes[o];
|
|
2892
|
+
this.addMetaframe(o, r);
|
|
2004
2893
|
}
|
|
2005
|
-
}), i !==
|
|
2006
|
-
!this.isDisposed() && s === this._definition && (this._emitDefinitionEvent(), n && this.listenerCount(
|
|
2894
|
+
}), i !== sn && window.setTimeout(() => {
|
|
2895
|
+
!this.isDisposed() && s === this._definition && (this._emitDefinitionEvent(), n && this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state));
|
|
2007
2896
|
}, 0), this;
|
|
2008
2897
|
}
|
|
2009
2898
|
_emitDefinitionEvent() {
|
|
2010
|
-
if (this.listenerCount(
|
|
2011
|
-
const
|
|
2899
|
+
if (this.listenerCount(E.Definition) > 0) {
|
|
2900
|
+
const t = {
|
|
2012
2901
|
definition: this._definition,
|
|
2013
2902
|
metaframes: this._metaframes
|
|
2014
2903
|
};
|
|
2015
|
-
this.emit(
|
|
2904
|
+
this.emit(E.Definition, t);
|
|
2016
2905
|
}
|
|
2017
2906
|
}
|
|
2018
|
-
addPipe(
|
|
2019
|
-
this._inputMap =
|
|
2020
|
-
s[
|
|
2907
|
+
addPipe(t, n) {
|
|
2908
|
+
this._inputMap = C(this._inputMap, (s) => {
|
|
2909
|
+
s[t] || (s[t] = []), s[t].push(n);
|
|
2021
2910
|
});
|
|
2022
2911
|
}
|
|
2023
|
-
removeMetaframe(
|
|
2024
|
-
this._metaframes[
|
|
2025
|
-
delete n[
|
|
2026
|
-
}), this._state =
|
|
2027
|
-
delete n.metaframes.inputs[
|
|
2028
|
-
}), this._inputMap =
|
|
2029
|
-
delete n[
|
|
2912
|
+
removeMetaframe(t) {
|
|
2913
|
+
this._metaframes[t] && (this._metaframes[t].dispose(), this._metaframes = C(this._metaframes, (n) => {
|
|
2914
|
+
delete n[t];
|
|
2915
|
+
}), this._state = C(this._state, (n) => {
|
|
2916
|
+
delete n.metaframes.inputs[t], delete n.metaframes.outputs[t];
|
|
2917
|
+
}), this._inputMap = C(this._inputMap, (n) => {
|
|
2918
|
+
delete n[t], Object.keys(n).forEach((s) => {
|
|
2030
2919
|
const i = n[s];
|
|
2031
|
-
let
|
|
2032
|
-
for (;
|
|
2033
|
-
i[
|
|
2920
|
+
let o = 0;
|
|
2921
|
+
for (; o <= i.length; )
|
|
2922
|
+
i[o] && i[o].metaframe === t ? i.splice(o, 1) : o++;
|
|
2034
2923
|
});
|
|
2035
|
-
}), this._cachedInputLookupMap =
|
|
2924
|
+
}), this._cachedInputLookupMap = C({}, (n) => n));
|
|
2036
2925
|
}
|
|
2037
2926
|
removeAll() {
|
|
2038
|
-
Object.keys(this._metaframes).forEach((
|
|
2927
|
+
Object.keys(this._metaframes).forEach((t) => this._metaframes[t].dispose()), this._metaframes = C({}, (t) => t), this._state = ye, this._inputMap = C({}, (t) => t), this._cachedInputLookupMap = C({}, (t) => t);
|
|
2039
2928
|
}
|
|
2040
2929
|
metaframes() {
|
|
2041
2930
|
return this.getMetaframes();
|
|
@@ -2049,86 +2938,86 @@ class U extends Qt {
|
|
|
2049
2938
|
getMetaframes() {
|
|
2050
2939
|
return this._metaframes;
|
|
2051
2940
|
}
|
|
2052
|
-
getMetaframe(
|
|
2053
|
-
return this == null ? void 0 : this._metaframes[
|
|
2941
|
+
getMetaframe(t) {
|
|
2942
|
+
return this == null ? void 0 : this._metaframes[t];
|
|
2054
2943
|
}
|
|
2055
|
-
addMetaframe(
|
|
2056
|
-
if (!
|
|
2944
|
+
addMetaframe(t, n) {
|
|
2945
|
+
if (!t)
|
|
2057
2946
|
throw "addMetaframe missing metaframeId";
|
|
2058
2947
|
if (!n)
|
|
2059
2948
|
throw "addMetaframe missing definition";
|
|
2060
|
-
if (this._metaframes[
|
|
2061
|
-
throw this.emitErrorMessage(`Existing metaframe for id=${
|
|
2949
|
+
if (this._metaframes[t])
|
|
2950
|
+
throw this.emitErrorMessage(`Existing metaframe for id=${t}`), `Existing metaframe for id=${t}`;
|
|
2062
2951
|
if (!n.url)
|
|
2063
|
-
throw this.emitErrorMessage(`Metaframe definition missing url id=${
|
|
2064
|
-
var s = new
|
|
2065
|
-
return this._metaframes =
|
|
2066
|
-
i[
|
|
2067
|
-
}), s.addListener(
|
|
2068
|
-
this.emit(
|
|
2952
|
+
throw this.emitErrorMessage(`Metaframe definition missing url id=${t}`), `Metaframe definition missing url id=${t}`;
|
|
2953
|
+
var s = new js(this, n.url, t, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
|
|
2954
|
+
return this._metaframes = C(this._metaframes, (i) => {
|
|
2955
|
+
i[t] = s;
|
|
2956
|
+
}), s.addListener(E.Error, (i) => {
|
|
2957
|
+
this.emit(E.Error, {
|
|
2069
2958
|
metaframeId: s.id,
|
|
2070
2959
|
metaframeUrl: s.url,
|
|
2071
2960
|
error: i
|
|
2072
2961
|
});
|
|
2073
|
-
}), n.inputs && n.inputs.forEach((i) => this.addPipe(
|
|
2962
|
+
}), n.inputs && n.inputs.forEach((i) => this.addPipe(t, i)), s.setInputs(this._state.metaframes.inputs[t]), s;
|
|
2074
2963
|
}
|
|
2075
2964
|
dispose() {
|
|
2076
|
-
this.log("disposing"), super.removeAllListeners(), window.removeEventListener("message", this.onMessage), this._metaframes && Object.keys(this._metaframes).forEach((
|
|
2965
|
+
this.log("disposing"), super.removeAllListeners(), window.removeEventListener("message", this.onMessage), this._metaframes && Object.keys(this._metaframes).forEach((t) => this._metaframes[t].dispose()), this._id = void 0, this._metaframes = void 0, this._state = void 0, this._cachedInputLookupMap = void 0, this._inputMap = void 0;
|
|
2077
2966
|
}
|
|
2078
|
-
log(
|
|
2079
|
-
this.debug && this.logInternal(
|
|
2967
|
+
log(t, n, s) {
|
|
2968
|
+
this.debug && this.logInternal(t, n, s);
|
|
2080
2969
|
}
|
|
2081
|
-
error(
|
|
2082
|
-
this.logInternal(
|
|
2970
|
+
error(t) {
|
|
2971
|
+
this.logInternal(t, "f00", this._consoleBackgroundColor), this.emitErrorMessage(`${t}`);
|
|
2083
2972
|
}
|
|
2084
|
-
emitErrorMessage(
|
|
2085
|
-
this.emit(
|
|
2973
|
+
emitErrorMessage(t) {
|
|
2974
|
+
this.emit(E.Error, t);
|
|
2086
2975
|
}
|
|
2087
|
-
getInputsFromOutput(
|
|
2088
|
-
return this._cachedInputLookupMap[
|
|
2089
|
-
s[
|
|
2090
|
-
})), this._cachedInputLookupMap[
|
|
2976
|
+
getInputsFromOutput(t, n) {
|
|
2977
|
+
return this._cachedInputLookupMap[t] || (this._cachedInputLookupMap = C(this._cachedInputLookupMap, (s) => {
|
|
2978
|
+
s[t] = C({}, (i) => i);
|
|
2979
|
+
})), this._cachedInputLookupMap[t][n] || (this._cachedInputLookupMap = C(this._cachedInputLookupMap, (s) => {
|
|
2091
2980
|
var i = [];
|
|
2092
|
-
s[
|
|
2093
|
-
|
|
2094
|
-
if (r.metaframe ===
|
|
2095
|
-
var
|
|
2096
|
-
|
|
2981
|
+
s[t][n] = i, Object.keys(this._inputMap).forEach((o) => {
|
|
2982
|
+
o !== t && this._inputMap[o].forEach((r) => {
|
|
2983
|
+
if (r.metaframe === t && Us(n, r.source || "*", r.target || "*")) {
|
|
2984
|
+
var a = r.target;
|
|
2985
|
+
!r.target || r.target.startsWith("*") || r.target === "" ? a = n : a.endsWith("/") && (a = a + n), i.push({ metaframe: o, pipe: a });
|
|
2097
2986
|
}
|
|
2098
2987
|
});
|
|
2099
2988
|
});
|
|
2100
|
-
})), this._cachedInputLookupMap[
|
|
2989
|
+
})), this._cachedInputLookupMap[t][n];
|
|
2101
2990
|
}
|
|
2102
|
-
isValidJSONRpcMessage(
|
|
2103
|
-
if (
|
|
2991
|
+
isValidJSONRpcMessage(t) {
|
|
2992
|
+
if (t.jsonrpc !== "2.0")
|
|
2104
2993
|
return !1;
|
|
2105
|
-
switch (
|
|
2106
|
-
case
|
|
2994
|
+
switch (t.method) {
|
|
2995
|
+
case Q.SetupIframeClientRequest:
|
|
2107
2996
|
return !0;
|
|
2108
2997
|
default:
|
|
2109
|
-
var s =
|
|
2110
|
-
return !(s && !(
|
|
2998
|
+
var s = t.iframeId;
|
|
2999
|
+
return !(s && !(t.parentId === this._id && this._metaframes[s]));
|
|
2111
3000
|
}
|
|
2112
3001
|
}
|
|
2113
|
-
setInput(
|
|
2114
|
-
var i,
|
|
2115
|
-
typeof
|
|
3002
|
+
setInput(t, n, s) {
|
|
3003
|
+
var i, o;
|
|
3004
|
+
typeof t == "object" ? this.setInputStateOnlyMetapageInstanceInputs(t) : typeof n == "string" ? this.setInputStateOnlyMetaframeInputValue(t, n, s) : this.setInputStateOnlyMetaframeInputMap(t, n || {}), this.setMetaframeClientInputAndSentClientEvent(t, n, s), (this.listenerCount(E.State) > 0 || this.listenerCount(E.Inputs) > 0) && ye !== this._state && (this.emit(E.State, this._state), this.emit(E.Inputs, (o = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : o.inputs));
|
|
2116
3005
|
}
|
|
2117
|
-
setMetaframeClientInputAndSentClientEvent(
|
|
2118
|
-
if (typeof
|
|
3006
|
+
setMetaframeClientInputAndSentClientEvent(t, n, s) {
|
|
3007
|
+
if (typeof t == "object") {
|
|
2119
3008
|
if (n || s)
|
|
2120
3009
|
throw "bad arguments, see API docs";
|
|
2121
|
-
const i =
|
|
2122
|
-
Object.keys(i).forEach((
|
|
2123
|
-
var r =
|
|
2124
|
-
if (typeof
|
|
3010
|
+
const i = t;
|
|
3011
|
+
Object.keys(i).forEach((o) => {
|
|
3012
|
+
var r = o, a = i[r];
|
|
3013
|
+
if (typeof a != "object")
|
|
2125
3014
|
throw "bad arguments, see API docs";
|
|
2126
|
-
var
|
|
2127
|
-
|
|
3015
|
+
var u = this._metaframes[r];
|
|
3016
|
+
u ? u.setInputs(a) : this.error("No iframe id=$metaframeId");
|
|
2128
3017
|
});
|
|
2129
|
-
} else if (typeof
|
|
2130
|
-
const i = this._metaframes[
|
|
2131
|
-
if (i == null && this.error(`No iframe id=${
|
|
3018
|
+
} else if (typeof t == "string") {
|
|
3019
|
+
const i = this._metaframes[t];
|
|
3020
|
+
if (i == null && this.error(`No iframe id=${t}`), typeof n == "string")
|
|
2132
3021
|
i.setInput(n, s);
|
|
2133
3022
|
else if (typeof n == "object")
|
|
2134
3023
|
i.setInputs(n);
|
|
@@ -2137,218 +3026,218 @@ class U extends Qt {
|
|
|
2137
3026
|
} else
|
|
2138
3027
|
throw "bad arguments, see API docs";
|
|
2139
3028
|
}
|
|
2140
|
-
setInputs(
|
|
2141
|
-
this.setInput(
|
|
3029
|
+
setInputs(t, n, s) {
|
|
3030
|
+
this.setInput(t, n, s);
|
|
2142
3031
|
}
|
|
2143
|
-
setOutputStateOnlyMetapageInstanceInputs(
|
|
2144
|
-
this._setStateOnlyMetaframes(!1,
|
|
3032
|
+
setOutputStateOnlyMetapageInstanceInputs(t) {
|
|
3033
|
+
this._setStateOnlyMetaframes(!1, t);
|
|
2145
3034
|
}
|
|
2146
|
-
setOutputStateOnlyMetaframeInputValue(
|
|
2147
|
-
this._setStateOnlyMetaframeInputValue(!1,
|
|
3035
|
+
setOutputStateOnlyMetaframeInputValue(t, n, s) {
|
|
3036
|
+
this._setStateOnlyMetaframeInputValue(!1, t, n, s);
|
|
2148
3037
|
}
|
|
2149
|
-
setOutputStateOnlyMetaframeInputMap(
|
|
2150
|
-
this._setStateOnlyMetaframeInputMap(!1,
|
|
3038
|
+
setOutputStateOnlyMetaframeInputMap(t, n) {
|
|
3039
|
+
this._setStateOnlyMetaframeInputMap(!1, t, n);
|
|
2151
3040
|
}
|
|
2152
|
-
setInputStateOnlyMetapageInstanceInputs(
|
|
2153
|
-
this._setStateOnlyMetaframes(!0,
|
|
3041
|
+
setInputStateOnlyMetapageInstanceInputs(t) {
|
|
3042
|
+
this._setStateOnlyMetaframes(!0, t);
|
|
2154
3043
|
}
|
|
2155
|
-
setInputStateOnlyMetaframeInputValue(
|
|
2156
|
-
this._setStateOnlyMetaframeInputValue(!0,
|
|
3044
|
+
setInputStateOnlyMetaframeInputValue(t, n, s) {
|
|
3045
|
+
this._setStateOnlyMetaframeInputValue(!0, t, n, s);
|
|
2157
3046
|
}
|
|
2158
|
-
setInputStateOnlyMetaframeInputMap(
|
|
2159
|
-
this._setStateOnlyMetaframeInputMap(!0,
|
|
3047
|
+
setInputStateOnlyMetaframeInputMap(t, n) {
|
|
3048
|
+
this._setStateOnlyMetaframeInputMap(!0, t, n);
|
|
2160
3049
|
}
|
|
2161
|
-
_setStateOnlyMetaframeInputValue(
|
|
2162
|
-
this._state =
|
|
3050
|
+
_setStateOnlyMetaframeInputValue(t, n, s, i) {
|
|
3051
|
+
this._state = C(this._state, (o) => {
|
|
2163
3052
|
if (!this._metaframes.hasOwnProperty(n))
|
|
2164
3053
|
throw `No metaframe: ${n}`;
|
|
2165
|
-
|
|
2166
|
-
let
|
|
2167
|
-
|
|
3054
|
+
o.metaframes || (o.metaframes = { inputs: {}, outputs: {} }), t ? o.metaframes.inputs || (o.metaframes.inputs = {}) : o.metaframes.outputs || (o.metaframes.outputs = {});
|
|
3055
|
+
let a = t ? o.metaframes.inputs : o.metaframes.outputs;
|
|
3056
|
+
a = a || {}, a[n] = a[n] ? a[n] : {}, i === void 0 ? delete a[n][s] : a[n][s] = i;
|
|
2168
3057
|
});
|
|
2169
3058
|
}
|
|
2170
|
-
_setStateOnlyMetaframeInputMap(
|
|
2171
|
-
!s || Object.keys(s).length === 0 || (this._state =
|
|
3059
|
+
_setStateOnlyMetaframeInputMap(t, n, s) {
|
|
3060
|
+
!s || Object.keys(s).length === 0 || (this._state = C(this._state, (i) => {
|
|
2172
3061
|
if (!this._metaframes.hasOwnProperty(n))
|
|
2173
3062
|
throw `No metaframe: ${n}`;
|
|
2174
|
-
let r =
|
|
2175
|
-
r[n] = r[n] ? r[n] : {}, Object.keys(s).forEach((
|
|
2176
|
-
s[
|
|
3063
|
+
let r = t ? i.metaframes.inputs : i.metaframes.outputs;
|
|
3064
|
+
r[n] = r[n] ? r[n] : {}, Object.keys(s).forEach((a) => {
|
|
3065
|
+
s[a] === void 0 ? delete r[n][a] : r[n][a] = s[a];
|
|
2177
3066
|
});
|
|
2178
3067
|
}));
|
|
2179
3068
|
}
|
|
2180
|
-
_setStateOnlyMetaframes(
|
|
2181
|
-
!n || Object.keys(n).length === 0 || (this._state =
|
|
3069
|
+
_setStateOnlyMetaframes(t, n) {
|
|
3070
|
+
!n || Object.keys(n).length === 0 || (this._state = C(this._state, (s) => {
|
|
2182
3071
|
Object.keys(n).forEach((i) => {
|
|
2183
|
-
var
|
|
2184
|
-
if (typeof
|
|
3072
|
+
var o = n[i];
|
|
3073
|
+
if (typeof o != "object")
|
|
2185
3074
|
throw "Object values must be objects";
|
|
2186
3075
|
if (!this._metaframes.hasOwnProperty(i))
|
|
2187
3076
|
throw "No metaframe: ${metaframeId}";
|
|
2188
|
-
const
|
|
2189
|
-
|
|
2190
|
-
|
|
3077
|
+
const a = t ? s.metaframes.inputs : s.metaframes.outputs;
|
|
3078
|
+
a[i] = a[i] ? a[i] : {}, Object.keys(o).forEach((u) => {
|
|
3079
|
+
o[u] === void 0 ? delete a[i][u] : a[i][u] = o[u];
|
|
2191
3080
|
});
|
|
2192
3081
|
});
|
|
2193
3082
|
}));
|
|
2194
3083
|
}
|
|
2195
|
-
onMessage(
|
|
2196
|
-
if (typeof
|
|
2197
|
-
const r =
|
|
3084
|
+
onMessage(t) {
|
|
3085
|
+
if (typeof t.data == "object") {
|
|
3086
|
+
const r = t.data;
|
|
2198
3087
|
if (!this.isValidJSONRpcMessage(r))
|
|
2199
3088
|
return;
|
|
2200
3089
|
var n = r.method;
|
|
2201
|
-
const
|
|
2202
|
-
if (!
|
|
3090
|
+
const a = r.iframeId;
|
|
3091
|
+
if (!a)
|
|
2203
3092
|
return;
|
|
2204
|
-
const
|
|
2205
|
-
if (!
|
|
2206
|
-
this.error(`💥 onMessage no metaframe id=${
|
|
3093
|
+
const u = this.getMetaframe(a);
|
|
3094
|
+
if (!u) {
|
|
3095
|
+
this.error(`💥 onMessage no metaframe id=${a}`);
|
|
2207
3096
|
return;
|
|
2208
3097
|
}
|
|
2209
3098
|
switch (r._messageCount = ++this._internalReceivedMessageCounter, this.debug && this.log(`processing ${JSON.stringify(r, null, " ").substring(0, 500)}`), n) {
|
|
2210
|
-
case
|
|
2211
|
-
|
|
3099
|
+
case Q.SetupIframeClientRequest:
|
|
3100
|
+
u && u.register();
|
|
2212
3101
|
break;
|
|
2213
|
-
case
|
|
2214
|
-
if (
|
|
3102
|
+
case Q.SetupIframeServerResponseAck:
|
|
3103
|
+
if (u) {
|
|
2215
3104
|
const c = r.params;
|
|
2216
|
-
|
|
3105
|
+
u.registered(c.version);
|
|
2217
3106
|
}
|
|
2218
3107
|
break;
|
|
2219
|
-
case
|
|
2220
|
-
const
|
|
2221
|
-
if (this._metaframes[
|
|
2222
|
-
var s = this._metaframes[
|
|
2223
|
-
this.setOutputStateOnlyMetaframeInputMap(
|
|
3108
|
+
case Q.OutputsUpdate:
|
|
3109
|
+
const f = r.params;
|
|
3110
|
+
if (this._metaframes[a]) {
|
|
3111
|
+
var s = this._metaframes[a];
|
|
3112
|
+
this.setOutputStateOnlyMetaframeInputMap(a, f), s.setOutputs(f);
|
|
2224
3113
|
var i = !1;
|
|
2225
|
-
const c = Object.keys(
|
|
2226
|
-
c.forEach((
|
|
2227
|
-
const
|
|
2228
|
-
|
|
2229
|
-
|
|
3114
|
+
const c = Object.keys(f), d = {};
|
|
3115
|
+
c.forEach((g, w) => {
|
|
3116
|
+
const y = this.getInputsFromOutput(a, g);
|
|
3117
|
+
y.length > 0 && y.forEach((O) => {
|
|
3118
|
+
d[O.metaframe] || (d[O.metaframe] = {}), d[O.metaframe][O.pipe] = f[g], i = !0;
|
|
2230
3119
|
});
|
|
2231
|
-
}), i && (this.setInputStateOnlyMetapageInstanceInputs(
|
|
2232
|
-
this._metaframes[
|
|
2233
|
-
})), this.listenerCount(
|
|
3120
|
+
}), i && (this.setInputStateOnlyMetapageInstanceInputs(d), Object.keys(d).forEach((g) => {
|
|
3121
|
+
this._metaframes[g].setInputs(d[g]);
|
|
3122
|
+
})), this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state), this.debug && s.ack({ jsonrpc: r, state: this._state });
|
|
2234
3123
|
} else
|
|
2235
|
-
this.error(`missing metaframe=${
|
|
3124
|
+
this.error(`missing metaframe=${a}`);
|
|
2236
3125
|
break;
|
|
2237
|
-
case
|
|
2238
|
-
var
|
|
2239
|
-
this.debug && this.log(`inputs ${JSON.stringify(
|
|
3126
|
+
case Q.InputsUpdate:
|
|
3127
|
+
var o = r.params;
|
|
3128
|
+
this.debug && this.log(`inputs ${JSON.stringify(o)} from ${a}`), this._metaframes[a] ? (this.setInputStateOnlyMetaframeInputMap(a, o), this._metaframes[a].setInputs(o), this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state), this.debug && this._metaframes[a].ack({
|
|
2240
3129
|
jsonrpc: r,
|
|
2241
3130
|
state: this._state
|
|
2242
|
-
})) : (console.error(`InputsUpdate failed no metaframe id: "${
|
|
3131
|
+
})) : (console.error(`InputsUpdate failed no metaframe id: "${a}"`), this.error(`InputsUpdate failed no metaframe id: "${a}"`));
|
|
2243
3132
|
break;
|
|
2244
|
-
case
|
|
2245
|
-
if (
|
|
2246
|
-
const c = r.params,
|
|
2247
|
-
|
|
2248
|
-
|
|
3133
|
+
case Q.HashParamsUpdate:
|
|
3134
|
+
if (u) {
|
|
3135
|
+
const c = r.params, d = new URL(u.url);
|
|
3136
|
+
d.hash = c.hash, u.url = d.href, this._definition = C(this._definition, (g) => {
|
|
3137
|
+
g.metaframes[c.metaframe].url = d.href;
|
|
2249
3138
|
}), this._emitDefinitionEvent();
|
|
2250
3139
|
}
|
|
2251
3140
|
break;
|
|
2252
3141
|
default:
|
|
2253
3142
|
this.debug && this.log(`Unknown RPC method: "${n}"`);
|
|
2254
3143
|
}
|
|
2255
|
-
this.listenerCount(
|
|
3144
|
+
this.listenerCount(E.Message) > 0 && this.emit(E.Message, r);
|
|
2256
3145
|
}
|
|
2257
3146
|
}
|
|
2258
|
-
logInternal(
|
|
3147
|
+
logInternal(t, n, s) {
|
|
2259
3148
|
s = s || this._consoleBackgroundColor;
|
|
2260
3149
|
let i;
|
|
2261
|
-
typeof
|
|
3150
|
+
typeof t == "string" ? i = t : typeof t == "number" ? i = t + "" : i = JSON.stringify(t), i = this._id ? `Metapage[${this._id}] ${i}` : i, vt(i, n, s);
|
|
2262
3151
|
}
|
|
2263
3152
|
}
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
const
|
|
2274
|
-
const n = new URL(
|
|
3153
|
+
ne.version = zt;
|
|
3154
|
+
ne.DEFINITION = E.Definition;
|
|
3155
|
+
ne.ERROR = E.Error;
|
|
3156
|
+
ne.INPUTS = E.Inputs;
|
|
3157
|
+
ne.MESSAGE = E.Message;
|
|
3158
|
+
ne.OUTPUTS = E.Outputs;
|
|
3159
|
+
ne.STATE = E.State;
|
|
3160
|
+
ne.deserializeInputs = Ie;
|
|
3161
|
+
ne.serializeInputs = Ve;
|
|
3162
|
+
const dn = pt(fetch), oi = async (e, t) => {
|
|
3163
|
+
const n = new URL(e);
|
|
2275
3164
|
n.pathname = n.pathname + (n.pathname.endsWith("/") ? "metapage.json" : "/metapage.json");
|
|
2276
|
-
const i = await (await
|
|
3165
|
+
const i = await (await dn(n.href, {
|
|
2277
3166
|
redirect: "follow",
|
|
2278
3167
|
retries: 3,
|
|
2279
3168
|
retryDelay: 1e3
|
|
2280
3169
|
})).json();
|
|
2281
|
-
return await
|
|
2282
|
-
},
|
|
2283
|
-
const n = new URL(
|
|
3170
|
+
return await Yt(i, t || "1");
|
|
3171
|
+
}, ai = async (e, t) => {
|
|
3172
|
+
const n = new URL(e);
|
|
2284
3173
|
n.pathname = n.pathname + (n.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json");
|
|
2285
|
-
const i = await (await
|
|
3174
|
+
const i = await (await dn(n.href, {
|
|
2286
3175
|
redirect: "follow",
|
|
2287
3176
|
retries: 3,
|
|
2288
3177
|
retryDelay: 1e3
|
|
2289
3178
|
})).json();
|
|
2290
|
-
return await
|
|
3179
|
+
return await Zt(i, t || "1");
|
|
2291
3180
|
};
|
|
2292
3181
|
export {
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
3182
|
+
sn as INITIAL_NULL_METAPAGE_DEFINITION,
|
|
3183
|
+
Qs as INTERNAL_ERROR,
|
|
3184
|
+
qs as INVALID_PARAMS,
|
|
3185
|
+
Js as INVALID_REQUEST,
|
|
3186
|
+
Q as JsonRpcMethodsFromChild,
|
|
3187
|
+
ce as JsonRpcMethodsFromParent,
|
|
3188
|
+
Fs as METAFRAME_JSON_FILE,
|
|
3189
|
+
zs as METAPAGE_KEY_DEFINITION,
|
|
3190
|
+
Gs as METAPAGE_KEY_STATE,
|
|
3191
|
+
Xs as METHOD_NOT_FOUND,
|
|
3192
|
+
te as Metaframe,
|
|
3193
|
+
F as MetaframeEvents,
|
|
3194
|
+
he as MetaframeLoadingState,
|
|
3195
|
+
ft as MetaframeVersionCurrent,
|
|
3196
|
+
St as MetaframeVersionsAll,
|
|
3197
|
+
ne as Metapage,
|
|
3198
|
+
E as MetapageEvents,
|
|
3199
|
+
$e as MetapageHashParams,
|
|
3200
|
+
js as MetapageIFrameRpcClient,
|
|
3201
|
+
rs as MetapageShared,
|
|
3202
|
+
Ge as MetapageVersionCurrent,
|
|
3203
|
+
Ot as MetapageVersionsAll,
|
|
3204
|
+
Ws as PARSE_ERROR,
|
|
3205
|
+
_n as VERSION_METAFRAME,
|
|
3206
|
+
zt as VERSION_METAPAGE,
|
|
3207
|
+
Vn as convertMetaframeDefinitionToCurrentVersion,
|
|
3208
|
+
Zt as convertMetaframeDefinitionToVersion,
|
|
3209
|
+
Wn as convertMetaframeJsonToCurrentVersion,
|
|
3210
|
+
Nn as convertMetapageDefinitionToCurrentVersion,
|
|
3211
|
+
Yt as convertMetapageDefinitionToVersion,
|
|
3212
|
+
Ie as deserializeInputs,
|
|
3213
|
+
bt as generateId,
|
|
3214
|
+
ti as generateMetaframeId,
|
|
3215
|
+
os as generateMetapageId,
|
|
3216
|
+
ni as generateNonce,
|
|
3217
|
+
ri as getLibraryVersionMatching,
|
|
3218
|
+
ae as getMatchingMetaframeVersion,
|
|
3219
|
+
Re as getMatchingMetapageVersion,
|
|
3220
|
+
ai as getMetaframeDefinitionFromUrl,
|
|
3221
|
+
oi as getMetapageDefinitionFromUrl,
|
|
3222
|
+
Zs as getUrlParam,
|
|
3223
|
+
ei as getUrlParamDebug,
|
|
3224
|
+
as as hashCode,
|
|
3225
|
+
us as intToRGB,
|
|
3226
|
+
ut as isDebugFromUrlsParams,
|
|
3227
|
+
is as isIframe,
|
|
3228
|
+
Ys as isJsonRpcId,
|
|
3229
|
+
Qe as isPageLoaded,
|
|
3230
|
+
vt as log,
|
|
3231
|
+
Us as matchPipe,
|
|
3232
|
+
Be as merge,
|
|
3233
|
+
si as metapageAllSha256Hash,
|
|
3234
|
+
ii as metapageOnlyEssentailSha256Hash,
|
|
3235
|
+
wt as pageLoaded,
|
|
3236
|
+
Ks as possiblyDeserializeDatarefToFile,
|
|
3237
|
+
en as possiblyDeserializeDatarefToValue,
|
|
3238
|
+
ns as possiblySerializeValueToDataref,
|
|
3239
|
+
Ve as serializeInputs,
|
|
3240
|
+
rn as stringToRgb,
|
|
3241
|
+
Vs as valueToFile
|
|
2353
3242
|
};
|
|
2354
3243
|
//# sourceMappingURL=index.js.map
|