@metapages/metapage 1.0.21 → 1.1.3

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