@metapages/metapage 1.8.18 → 1.8.21

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,46 +1,46 @@
1
- const It = ["0.3", "0.4", "0.5", "0.6", "1", "2"], Ct = ["0.2", "0.3", "1", "2"], We = "2", Le = "2", Mi = "metaframe.json", Ii = "metapage/definition", Ci = "metapage/state", Jt = Ct[Ct.length - 1], En = It[It.length - 1], Mn = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, $t = (t) => {
1
+ const It = ["0.3", "0.4", "0.5", "0.6", "1", "2"], Ct = ["0.2", "0.3", "1", "2"], We = "2", Le = "2", Mi = "metaframe.json", Ii = "metapage/definition", Ci = "metapage/state", Vt = Ct[Ct.length - 1], As = It[It.length - 1], Es = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, $t = (t) => {
2
2
  if (typeof t != "string")
3
3
  throw new TypeError("Invalid argument expected string");
4
- const e = t.match(Mn);
4
+ const e = t.match(Es);
5
5
  if (!e)
6
6
  throw new Error(`Invalid argument not valid semver ('${t}' received)`);
7
7
  return e.shift(), e;
8
8
  }, xt = (t) => t === "*" || t === "x" || t === "X", Lt = (t) => {
9
9
  const e = parseInt(t, 10);
10
10
  return isNaN(e) ? t : e;
11
- }, In = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], Cn = (t, e) => {
11
+ }, Ms = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], Is = (t, e) => {
12
12
  if (xt(t) || xt(e))
13
13
  return 0;
14
- const [n, s] = In(Lt(t), Lt(e));
15
- return n > s ? 1 : n < s ? -1 : 0;
14
+ const [s, n] = Ms(Lt(t), Lt(e));
15
+ return s > n ? 1 : s < n ? -1 : 0;
16
16
  }, Tt = (t, e) => {
17
- for (let n = 0; n < Math.max(t.length, e.length); n++) {
18
- const s = Cn(t[n] || "0", e[n] || "0");
19
- if (s !== 0)
20
- return s;
17
+ for (let s = 0; s < Math.max(t.length, e.length); s++) {
18
+ const n = Is(t[s] || "0", e[s] || "0");
19
+ if (n !== 0)
20
+ return n;
21
21
  }
22
22
  return 0;
23
23
  }, j = (t, e) => {
24
- const n = $t(t), s = $t(e), i = n.pop(), o = s.pop(), r = Tt(n, s);
24
+ const s = $t(t), n = $t(e), i = s.pop(), o = n.pop(), r = Tt(s, n);
25
25
  return r !== 0 ? r : i && o ? Tt(i.split("."), o.split(".")) : i || o ? i ? -1 : 1 : 0;
26
26
  };
27
- var $n = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
27
+ var Cs = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
28
28
  function mt(t) {
29
29
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
30
30
  }
31
31
  var Wt = { exports: {} };
32
32
  (function(t, e) {
33
- (function(n, s) {
34
- t.exports = s();
35
- })($n, function() {
36
- var n = function(o, r) {
33
+ (function(s, n) {
34
+ t.exports = n();
35
+ })(Cs, function() {
36
+ var s = function(o, r) {
37
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");
41
- if (r.retries !== void 0 && !s(r.retries))
41
+ if (r.retries !== void 0 && !n(r.retries))
42
42
  throw new i("retries must be a positive integer");
43
- if (r.retryDelay !== void 0 && !s(r.retryDelay) && typeof r.retryDelay != "function")
43
+ if (r.retryDelay !== void 0 && !n(r.retryDelay) && typeof r.retryDelay != "function")
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");
@@ -50,15 +50,15 @@ var Wt = { exports: {} };
50
50
  retryOn: []
51
51
  };
52
52
  return r = Object.assign(a, r), function(l, c) {
53
- var d = r.retries, g = r.retryDelay, v = r.retryOn;
53
+ var d = r.retries, _ = r.retryDelay, v = r.retryOn;
54
54
  if (c && c.retries !== void 0)
55
- if (s(c.retries))
55
+ if (n(c.retries))
56
56
  d = c.retries;
57
57
  else
58
58
  throw new i("retries must be a positive integer");
59
59
  if (c && c.retryDelay !== void 0)
60
- if (s(c.retryDelay) || typeof c.retryDelay == "function")
61
- g = c.retryDelay;
60
+ if (n(c.retryDelay) || typeof c.retryDelay == "function")
61
+ _ = c.retryDelay;
62
62
  else
63
63
  throw new i("retryDelay must be a positive integer or a function returning a positive integer");
64
64
  if (c && c.retryOn)
@@ -66,39 +66,39 @@ var Wt = { exports: {} };
66
66
  v = c.retryOn;
67
67
  else
68
68
  throw new i("retryOn property expects an array or function");
69
- return new Promise(function(y, R) {
69
+ return new Promise(function(m, S) {
70
70
  var w = function(b) {
71
71
  var A = typeof Request < "u" && l instanceof Request ? l.clone() : l;
72
72
  o(A, c).then(function(E) {
73
73
  if (Array.isArray(v) && v.indexOf(E.status) === -1)
74
- y(E);
74
+ m(E);
75
75
  else if (typeof v == "function")
76
76
  try {
77
77
  return Promise.resolve(v(b, null, E)).then(function(O) {
78
- O ? $(b, null, E) : y(E);
79
- }).catch(R);
78
+ O ? $(b, null, E) : m(E);
79
+ }).catch(S);
80
80
  } catch (O) {
81
- R(O);
81
+ S(O);
82
82
  }
83
83
  else
84
- b < d ? $(b, null, E) : y(E);
84
+ b < d ? $(b, null, E) : m(E);
85
85
  }).catch(function(E) {
86
86
  if (typeof v == "function")
87
87
  try {
88
88
  Promise.resolve(v(b, E, null)).then(function(O) {
89
- O ? $(b, E, null) : R(E);
89
+ O ? $(b, E, null) : S(E);
90
90
  }).catch(function(O) {
91
- R(O);
91
+ S(O);
92
92
  });
93
93
  } catch (O) {
94
- R(O);
94
+ S(O);
95
95
  }
96
96
  else
97
- b < d ? $(b, E, null) : R(E);
97
+ b < d ? $(b, E, null) : S(E);
98
98
  });
99
99
  };
100
100
  function $(b, A, E) {
101
- var O = typeof g == "function" ? g(b, A, E) : g;
101
+ var O = typeof _ == "function" ? _(b, A, E) : _;
102
102
  setTimeout(function() {
103
103
  w(++b);
104
104
  }, O);
@@ -107,21 +107,21 @@ var Wt = { exports: {} };
107
107
  });
108
108
  };
109
109
  };
110
- function s(o) {
110
+ function n(o) {
111
111
  return Number.isInteger(o) && o >= 0;
112
112
  }
113
113
  function i(o) {
114
114
  this.name = "ArgumentError", this.message = o;
115
115
  }
116
- return n;
116
+ return s;
117
117
  });
118
118
  })(Wt);
119
- var xn = Wt.exports;
120
- const yt = /* @__PURE__ */ mt(xn), G = {
119
+ var $s = Wt.exports;
120
+ const yt = /* @__PURE__ */ mt($s), J = {
121
121
  Remove: "remove",
122
122
  Replace: "replace",
123
123
  Add: "add"
124
- }, Kt = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), Ln = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Be = Symbol.iterator, Z = {
124
+ }, Kt = Symbol.for("__MUTATIVE_PROXY_DRAFT__"), xs = Symbol("__MUTATIVE_RAW_RETURN_SYMBOL__"), Be = Symbol.iterator, Z = {
125
125
  mutable: "mutable",
126
126
  immutable: "immutable"
127
127
  }, gt = {};
@@ -130,12 +130,12 @@ function Ie(t, e) {
130
130
  }
131
131
  function Pt(t, e) {
132
132
  if (e in t) {
133
- let n = Reflect.getPrototypeOf(t);
134
- for (; n; ) {
135
- const s = Reflect.getOwnPropertyDescriptor(n, e);
136
- if (s)
137
- return s;
138
- n = Reflect.getPrototypeOf(n);
133
+ let s = Reflect.getPrototypeOf(t);
134
+ for (; s; ) {
135
+ const n = Reflect.getOwnPropertyDescriptor(s, e);
136
+ if (n)
137
+ return n;
138
+ s = Reflect.getPrototypeOf(s);
139
139
  }
140
140
  }
141
141
  }
@@ -151,22 +151,22 @@ function P(t) {
151
151
  }
152
152
  function _t(t) {
153
153
  var e;
154
- const n = P(t);
155
- return n ? (e = n.copy) !== null && e !== void 0 ? e : n.original : t;
154
+ const s = P(t);
155
+ return s ? (e = s.copy) !== null && e !== void 0 ? e : s.original : t;
156
156
  }
157
- function se(t, e) {
157
+ function ne(t, e) {
158
158
  if (!t || typeof t != "object")
159
159
  return !1;
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, Z)) === Z.immutable || typeof n == "function");
160
+ let s;
161
+ return Object.getPrototypeOf(t) === Object.prototype || Array.isArray(t) || t instanceof Map || t instanceof Set || !!(e != null && e.mark) && ((s = e.mark(t, Z)) === Z.immutable || typeof s == "function");
162
162
  }
163
163
  function Xt(t, e = []) {
164
164
  if (Object.hasOwnProperty.call(t, "key")) {
165
- const n = t.parent.copy, s = P(pe(n, t.key));
166
- if (s !== null && (s == null ? void 0 : s.original) !== t.original)
165
+ const s = t.parent.copy, n = P(pe(s, t.key));
166
+ if (n !== null && (n == null ? void 0 : n.original) !== t.original)
167
167
  return null;
168
168
  const i = t.parent.type === 3, o = i ? Array.from(t.parent.setMap.keys()).indexOf(t.key) : t.key;
169
- if (!(i && n.size > o || Ie(n, o)))
169
+ if (!(i && s.size > o || Ie(s, o)))
170
170
  return null;
171
171
  e.push(o);
172
172
  }
@@ -174,7 +174,7 @@ function Xt(t, e = []) {
174
174
  return Xt(t.parent, e);
175
175
  e.reverse();
176
176
  try {
177
- Tn(t.copy, e);
177
+ Ls(t.copy, e);
178
178
  } catch {
179
179
  return null;
180
180
  }
@@ -186,12 +186,12 @@ function we(t) {
186
186
  function pe(t, e) {
187
187
  return we(t) === 2 ? t.get(e) : t[e];
188
188
  }
189
- function Te(t, e, n) {
190
- we(t) === 2 ? t.set(e, n) : t[e] = n;
189
+ function Te(t, e, s) {
190
+ we(t) === 2 ? t.set(e, s) : t[e] = s;
191
191
  }
192
192
  function et(t, e) {
193
- const n = P(t);
194
- return (n ? Y(n) : t)[e];
193
+ const s = P(t);
194
+ return (s ? Y(s) : t)[e];
195
195
  }
196
196
  function fe(t, e) {
197
197
  return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
@@ -202,78 +202,78 @@ function ot(t) {
202
202
  t.finalities.revoke.pop()();
203
203
  }
204
204
  function _e(t, e) {
205
- return e ? t : [""].concat(t).map((n) => {
206
- const s = `${n}`;
207
- return s.indexOf("/") === -1 && s.indexOf("~") === -1 ? s : s.replace(/~/g, "~0").replace(/\//g, "~1");
205
+ return e ? t : [""].concat(t).map((s) => {
206
+ const n = `${s}`;
207
+ return n.indexOf("/") === -1 && n.indexOf("~") === -1 ? n : n.replace(/~/g, "~0").replace(/\//g, "~1");
208
208
  }).join("/");
209
209
  }
210
- function Tn(t, e) {
211
- for (let n = 0; n < e.length - 1; n += 1) {
212
- const s = e[n];
213
- if (t = pe(we(t) === 3 ? Array.from(t) : t, s), typeof t != "object")
210
+ function Ls(t, e) {
211
+ for (let s = 0; s < e.length - 1; s += 1) {
212
+ const n = e[s];
213
+ if (t = pe(we(t) === 3 ? Array.from(t) : t, n), typeof t != "object")
214
214
  throw new Error(`Cannot resolve patch at '${e.join("/")}'.`);
215
215
  }
216
216
  return t;
217
217
  }
218
- function Pn(t) {
218
+ function Ts(t) {
219
219
  const e = Object.create(Object.getPrototypeOf(t));
220
- return Reflect.ownKeys(t).forEach((n) => {
221
- let s = Reflect.getOwnPropertyDescriptor(t, n);
222
- if (s.enumerable && s.configurable && s.writable) {
223
- e[n] = t[n];
220
+ return Reflect.ownKeys(t).forEach((s) => {
221
+ let n = Reflect.getOwnPropertyDescriptor(t, s);
222
+ if (n.enumerable && n.configurable && n.writable) {
223
+ e[s] = t[s];
224
224
  return;
225
225
  }
226
- s.writable || (s.writable = !0, s.configurable = !0), (s.get || s.set) && (s = {
226
+ n.writable || (n.writable = !0, n.configurable = !0), (n.get || n.set) && (n = {
227
227
  configurable: !0,
228
228
  writable: !0,
229
- enumerable: s.enumerable,
230
- value: t[n]
231
- }), Reflect.defineProperty(e, n, s);
229
+ enumerable: n.enumerable,
230
+ value: t[s]
231
+ }), Reflect.defineProperty(e, s, n);
232
232
  }), e;
233
233
  }
234
- const Dn = Object.prototype.propertyIsEnumerable;
234
+ const Ps = Object.prototype.propertyIsEnumerable;
235
235
  function qt(t, e) {
236
- let n;
236
+ let s;
237
237
  if (Array.isArray(t))
238
238
  return Array.prototype.concat.call(t);
239
239
  if (t instanceof Set)
240
240
  return new Set(t.values());
241
241
  if (t instanceof Map)
242
242
  return new Map(t);
243
- if (e != null && e.mark && (n = e.mark(t, Z), n !== void 0) && n !== Z.mutable) {
244
- if (n === Z.immutable)
245
- return Pn(t);
246
- if (typeof n == "function") {
243
+ if (e != null && e.mark && (s = e.mark(t, Z), s !== void 0) && s !== Z.mutable) {
244
+ if (s === Z.immutable)
245
+ return Ts(t);
246
+ if (typeof s == "function") {
247
247
  if (e.enablePatches || e.enableAutoFreeze)
248
248
  throw new Error("You can't use mark and patches or auto freeze together.");
249
- return n();
249
+ return s();
250
250
  }
251
- throw new Error(`Unsupported mark result: ${n}`);
251
+ throw new Error(`Unsupported mark result: ${s}`);
252
252
  } else if (typeof t == "object" && Object.getPrototypeOf(t) === Object.prototype) {
253
- const s = {};
253
+ const n = {};
254
254
  return Object.keys(t).forEach((i) => {
255
- s[i] = t[i];
255
+ n[i] = t[i];
256
256
  }), Object.getOwnPropertySymbols(t).forEach((i) => {
257
- Dn.call(t, i) && (s[i] = t[i]);
258
- }), s;
257
+ Ps.call(t, i) && (n[i] = t[i]);
258
+ }), n;
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 X(t) {
262
+ function q(t) {
263
263
  t.copy || (t.copy = qt(t.original, t.options));
264
264
  }
265
265
  function Ae(t) {
266
- if (!se(t))
266
+ if (!ne(t))
267
267
  return _t(t);
268
268
  if (Array.isArray(t))
269
269
  return t.map(Ae);
270
270
  if (t instanceof Map)
271
- return new Map(Array.from(t.entries()).map(([n, s]) => [n, Ae(s)]));
271
+ return new Map(Array.from(t.entries()).map(([s, n]) => [s, Ae(n)]));
272
272
  if (t instanceof Set)
273
273
  return new Set(Array.from(t).map(Ae));
274
274
  const e = Object.create(Object.getPrototypeOf(t));
275
- for (const n in t)
276
- e[n] = Ae(t[n]);
275
+ for (const s in t)
276
+ e[s] = Ae(t[s]);
277
277
  return e;
278
278
  }
279
279
  function Fe(t) {
@@ -286,78 +286,78 @@ function ue(t) {
286
286
  function Dt() {
287
287
  throw new Error("Cannot modify frozen object");
288
288
  }
289
- function Re(t, e, n, s, i) {
289
+ function Oe(t, e, s, n, i) {
290
290
  {
291
- n = n ?? /* @__PURE__ */ new WeakMap(), s = s ?? [], i = i ?? [];
292
- const r = n.has(t) ? n.get(t) : t;
293
- if (s.length > 0) {
294
- const a = s.indexOf(r);
291
+ s = s ?? /* @__PURE__ */ new WeakMap(), n = n ?? [], i = i ?? [];
292
+ const r = s.has(t) ? s.get(t) : t;
293
+ if (n.length > 0) {
294
+ const a = n.indexOf(r);
295
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, l) => {
296
+ throw n[0] === r ? new Error("Forbids circular reference") : new Error(`Forbids circular reference: ~/${i.slice(0, a).map((u, l) => {
297
297
  if (typeof u == "symbol")
298
298
  return `[${u.toString()}]`;
299
- const c = s[l];
299
+ const c = n[l];
300
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
+ n.push(r), i.push(e);
303
303
  } else
304
- s.push(r);
304
+ n.push(r);
305
305
  }
306
306
  if (Object.isFrozen(t) || be(t)) {
307
- s.pop(), i.pop();
307
+ n.pop(), i.pop();
308
308
  return;
309
309
  }
310
310
  switch (we(t)) {
311
311
  case 2:
312
312
  for (const [a, u] of t)
313
- Re(a, a, n, s, i), Re(u, a, n, s, i);
313
+ Oe(a, a, s, n, i), Oe(u, a, s, n, i);
314
314
  t.set = t.clear = t.delete = Dt;
315
315
  break;
316
316
  case 3:
317
317
  for (const a of t)
318
- Re(a, a, n, s, i);
318
+ Oe(a, a, s, n, i);
319
319
  t.add = t.clear = t.delete = Dt;
320
320
  break;
321
321
  case 1:
322
322
  Object.freeze(t);
323
323
  let r = 0;
324
324
  for (const a of t)
325
- Re(a, r, n, s, i), r += 1;
325
+ Oe(a, r, s, n, i), r += 1;
326
326
  break;
327
327
  default:
328
328
  Object.freeze(t), Object.keys(t).forEach((a) => {
329
329
  const u = t[a];
330
- Re(u, a, n, s, i);
330
+ Oe(u, a, s, n, i);
331
331
  });
332
332
  }
333
- s.pop(), i.pop();
333
+ n.pop(), i.pop();
334
334
  }
335
335
  function bt(t, e) {
336
- const n = we(t);
337
- if (n === 0)
338
- Reflect.ownKeys(t).forEach((s) => {
339
- e(s, t[s], t);
336
+ const s = we(t);
337
+ if (s === 0)
338
+ Reflect.ownKeys(t).forEach((n) => {
339
+ e(n, t[n], t);
340
340
  });
341
- else if (n === 1) {
342
- let s = 0;
341
+ else if (s === 1) {
342
+ let n = 0;
343
343
  for (const i of t)
344
- e(s, i, t), s += 1;
344
+ e(n, i, t), n += 1;
345
345
  } else
346
- t.forEach((s, i) => e(i, s, t));
346
+ t.forEach((n, i) => e(i, n, t));
347
347
  }
348
- function Qt(t, e, n) {
349
- if (be(t) || !se(t, n) || e.has(t) || Object.isFrozen(t))
348
+ function Qt(t, e, s) {
349
+ if (be(t) || !ne(t, s) || e.has(t) || Object.isFrozen(t))
350
350
  return;
351
- const s = t instanceof Set, i = s ? /* @__PURE__ */ new Map() : void 0;
351
+ const n = t instanceof Set, i = n ? /* @__PURE__ */ new Map() : void 0;
352
352
  if (e.add(t), bt(t, (o, r) => {
353
353
  var a;
354
354
  if (be(r)) {
355
355
  const u = P(r);
356
- X(u);
356
+ q(u);
357
357
  const l = !((a = u.assignedMap) === null || a === void 0) && a.size || u.operated ? u.copy : u.original;
358
- Te(s ? i : t, o, l);
358
+ Te(n ? i : t, o, l);
359
359
  } else
360
- Qt(r, e, n);
360
+ Qt(r, e, s);
361
361
  }), i) {
362
362
  const o = t, r = Array.from(o);
363
363
  o.clear(), r.forEach((a) => {
@@ -365,51 +365,51 @@ function Qt(t, e, n) {
365
365
  });
366
366
  }
367
367
  }
368
- function kn(t, e) {
369
- const n = t.type === 3 ? t.setMap : t.copy;
370
- t.finalities.revoke.length > 1 && t.assignedMap.get(e) && n && Qt(pe(n, e), t.finalities.handledSet, t.options);
368
+ function Ds(t, e) {
369
+ const s = t.type === 3 ? t.setMap : t.copy;
370
+ t.finalities.revoke.length > 1 && t.assignedMap.get(e) && s && Qt(pe(s, e), t.finalities.handledSet, t.options);
371
371
  }
372
372
  function at(t) {
373
373
  t.type === 3 && t.copy && (t.copy.clear(), t.setMap.forEach((e) => {
374
374
  t.copy.add(_t(e));
375
375
  }));
376
376
  }
377
- function ut(t, e, n, s) {
377
+ function ut(t, e, s, n) {
378
378
  if (t.operated && t.assignedMap && t.assignedMap.size > 0 && !t.finalized) {
379
- if (n && s) {
379
+ if (s && n) {
380
380
  const o = Xt(t);
381
- o && e(t, o, n, s);
381
+ o && e(t, o, s, n);
382
382
  }
383
383
  t.finalized = !0;
384
384
  }
385
385
  }
386
- function wt(t, e, n, s) {
387
- const i = P(n);
386
+ function wt(t, e, s, n) {
387
+ const i = P(s);
388
388
  i && (i.callbacks || (i.callbacks = []), i.callbacks.push((o, r) => {
389
389
  var a;
390
390
  const u = t.type === 3 ? t.setMap : t.copy;
391
- if (fe(pe(u, e), n)) {
391
+ if (fe(pe(u, e), s)) {
392
392
  let l = i.original;
393
- i.copy && (l = i.copy), at(t), ut(t, s, o, r), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(l, i.original)), Te(u, e, l);
393
+ i.copy && (l = i.copy), at(t), ut(t, n, o, r), t.options.enableAutoFreeze && (t.options.updatedValues = (a = t.options.updatedValues) !== null && a !== void 0 ? a : /* @__PURE__ */ new WeakMap(), t.options.updatedValues.set(l, i.original)), Te(u, e, l);
394
394
  }
395
- }), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), se(n, t.options) && t.finalities.draft.push(() => {
395
+ }), t.options.enableAutoFreeze && i.finalities !== t.finalities && (t.options.enableAutoFreeze = !1)), ne(s, t.options) && t.finalities.draft.push(() => {
396
396
  const o = t.type === 3 ? t.setMap : t.copy;
397
- fe(pe(o, e), n) && kn(t, e);
397
+ fe(pe(o, e), s) && Ds(t, e);
398
398
  });
399
399
  }
400
- function Hn(t, e, n, s, i) {
400
+ function ks(t, e, s, n, i) {
401
401
  let { original: o, assignedMap: r, options: a } = t, u = t.copy;
402
- u.length < o.length && ([o, u] = [u, o], [n, s] = [s, n]);
402
+ u.length < o.length && ([o, u] = [u, o], [s, n] = [n, s]);
403
403
  for (let l = 0; l < o.length; l += 1)
404
404
  if (r.get(l.toString()) && u[l] !== o[l]) {
405
405
  const c = e.concat([l]), d = _e(c, i);
406
- n.push({
407
- op: G.Replace,
406
+ s.push({
407
+ op: J.Replace,
408
408
  path: d,
409
409
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
410
410
  value: Fe(u[l])
411
- }), s.push({
412
- op: G.Replace,
411
+ }), n.push({
412
+ op: J.Replace,
413
413
  path: d,
414
414
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
415
415
  value: Fe(o[l])
@@ -417,8 +417,8 @@ function Hn(t, e, n, s, i) {
417
417
  }
418
418
  for (let l = o.length; l < u.length; l += 1) {
419
419
  const c = e.concat([l]), d = _e(c, i);
420
- n.push({
421
- op: G.Add,
420
+ s.push({
421
+ op: J.Add,
422
422
  path: d,
423
423
  // If it is a draft, it needs to be deep cloned, and it may also be non-draft.
424
424
  value: Fe(u[l])
@@ -428,41 +428,41 @@ function Hn(t, e, n, s, i) {
428
428
  const { arrayLengthAssignment: l = !0 } = a.enablePatches;
429
429
  if (l) {
430
430
  const c = e.concat(["length"]), d = _e(c, i);
431
- s.push({
432
- op: G.Replace,
431
+ n.push({
432
+ op: J.Replace,
433
433
  path: d,
434
434
  value: o.length
435
435
  });
436
436
  } else
437
437
  for (let c = u.length; o.length < c; c -= 1) {
438
- const d = e.concat([c - 1]), g = _e(d, i);
439
- s.push({
440
- op: G.Remove,
441
- path: g
438
+ const d = e.concat([c - 1]), _ = _e(d, i);
439
+ n.push({
440
+ op: J.Remove,
441
+ path: _
442
442
  });
443
443
  }
444
444
  }
445
445
  }
446
- function Nn({ original: t, copy: e, assignedMap: n }, s, i, o, r) {
447
- n.forEach((a, u) => {
448
- const l = pe(t, u), c = Fe(pe(e, u)), d = a ? Ie(t, u) ? G.Replace : G.Add : G.Remove;
449
- if (fe(l, c) && d === G.Replace)
446
+ function Hs({ original: t, copy: e, assignedMap: s }, n, i, o, r) {
447
+ s.forEach((a, u) => {
448
+ const l = pe(t, u), c = Fe(pe(e, u)), d = a ? Ie(t, u) ? J.Replace : J.Add : J.Remove;
449
+ if (fe(l, c) && d === J.Replace)
450
450
  return;
451
- const g = s.concat(u), v = _e(g, r);
452
- i.push(d === G.Remove ? { op: d, path: v } : { op: d, path: v, value: c }), o.push(d === G.Add ? { op: G.Remove, path: v } : d === G.Remove ? { op: G.Add, path: v, value: l } : { op: G.Replace, path: v, value: l });
451
+ const _ = n.concat(u), v = _e(_, r);
452
+ i.push(d === J.Remove ? { op: d, path: v } : { op: d, path: v, value: c }), o.push(d === J.Add ? { op: J.Remove, path: v } : d === J.Remove ? { op: J.Add, path: v, value: l } : { op: J.Replace, path: v, value: l });
453
453
  });
454
454
  }
455
- function jn({ original: t, copy: e }, n, s, i, o) {
455
+ function Ns({ original: t, copy: e }, s, n, i, o) {
456
456
  let r = 0;
457
457
  t.forEach((a) => {
458
458
  if (!e.has(a)) {
459
- const u = n.concat([r]), l = _e(u, o);
460
- s.push({
461
- op: G.Remove,
459
+ const u = s.concat([r]), l = _e(u, o);
460
+ n.push({
461
+ op: J.Remove,
462
462
  path: l,
463
463
  value: a
464
464
  }), i.unshift({
465
- op: G.Add,
465
+ op: J.Add,
466
466
  path: l,
467
467
  value: a
468
468
  });
@@ -470,13 +470,13 @@ function jn({ original: t, copy: e }, n, s, i, o) {
470
470
  r += 1;
471
471
  }), r = 0, e.forEach((a) => {
472
472
  if (!t.has(a)) {
473
- const u = n.concat([r]), l = _e(u, o);
474
- s.push({
475
- op: G.Add,
473
+ const u = s.concat([r]), l = _e(u, o);
474
+ n.push({
475
+ op: J.Add,
476
476
  path: l,
477
477
  value: a
478
478
  }), i.unshift({
479
- op: G.Remove,
479
+ op: J.Remove,
480
480
  path: l,
481
481
  value: a
482
482
  });
@@ -484,21 +484,21 @@ function jn({ original: t, copy: e }, n, s, i, o) {
484
484
  r += 1;
485
485
  });
486
486
  }
487
- function $e(t, e, n, s) {
487
+ function $e(t, e, s, n) {
488
488
  const { pathAsArray: i = !0 } = t.options.enablePatches;
489
489
  switch (t.type) {
490
490
  case 0:
491
491
  case 2:
492
- return Nn(t, e, n, s, i);
492
+ return Hs(t, e, s, n, i);
493
493
  case 1:
494
- return Hn(t, e, n, s, i);
494
+ return ks(t, e, s, n, i);
495
495
  case 3:
496
- return jn(t, e, n, s, i);
496
+ return Ns(t, e, s, n, i);
497
497
  }
498
498
  }
499
- let Un = !1;
500
- const ze = (t, e, n = !1) => {
501
- if (typeof t == "object" && t !== null && (!se(t, e) || n) && !Un)
499
+ let js = !1;
500
+ const ze = (t, e, s = !1) => {
501
+ if (typeof t == "object" && t !== null && (!ne(t, e) || s) && !js)
502
502
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
503
503
  }, ct = {
504
504
  get size() {
@@ -508,43 +508,43 @@ const ze = (t, e, n = !1) => {
508
508
  return Y(P(this)).has(t);
509
509
  },
510
510
  set(t, e) {
511
- const n = P(this), s = Y(n);
512
- return (!s.has(t) || !fe(s.get(t), e)) && (X(n), ue(n), n.assignedMap.set(t, !0), n.copy.set(t, e), wt(n, t, e, $e)), this;
511
+ const s = P(this), n = Y(s);
512
+ return (!n.has(t) || !fe(n.get(t), e)) && (q(s), ue(s), s.assignedMap.set(t, !0), s.copy.set(t, e), wt(s, t, e, $e)), this;
513
513
  },
514
514
  delete(t) {
515
515
  if (!this.has(t))
516
516
  return !1;
517
517
  const e = P(this);
518
- return X(e), ue(e), e.original.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.copy.delete(t), !0;
518
+ return q(e), ue(e), e.original.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.copy.delete(t), !0;
519
519
  },
520
520
  clear() {
521
521
  const t = P(this);
522
522
  if (this.size) {
523
- X(t), ue(t), t.assignedMap = /* @__PURE__ */ new Map();
523
+ q(t), ue(t), t.assignedMap = /* @__PURE__ */ new Map();
524
524
  for (const [e] of t.original)
525
525
  t.assignedMap.set(e, !1);
526
526
  t.copy.clear();
527
527
  }
528
528
  },
529
529
  forEach(t, e) {
530
- const n = P(this);
531
- Y(n).forEach((s, i) => {
530
+ const s = P(this);
531
+ Y(s).forEach((n, i) => {
532
532
  t.call(e, this.get(i), i, this);
533
533
  });
534
534
  },
535
535
  get(t) {
536
- var e, n;
537
- const s = P(this), i = Y(s).get(t), o = ((n = (e = s.options).mark) === null || n === void 0 ? void 0 : n.call(e, i, Z)) === Z.mutable;
538
- if (s.options.strict && ze(i, s.options, o), o || s.finalized || !se(i, s.options) || i !== s.original.get(t))
536
+ var e, s;
537
+ const n = P(this), i = Y(n).get(t), o = ((s = (e = n.options).mark) === null || s === void 0 ? void 0 : s.call(e, i, Z)) === Z.mutable;
538
+ if (n.options.strict && ze(i, n.options, o), o || n.finalized || !ne(i, n.options) || i !== n.original.get(t))
539
539
  return i;
540
540
  const r = gt.createDraft({
541
541
  original: i,
542
- parentDraft: s,
542
+ parentDraft: n,
543
543
  key: t,
544
- finalities: s.finalities,
545
- options: s.options
544
+ finalities: n.finalities,
545
+ options: n.options
546
546
  });
547
- return X(s), s.copy.set(t, r), r;
547
+ return q(n), n.copy.set(t, r), r;
548
548
  },
549
549
  keys() {
550
550
  return Y(P(this)).keys();
@@ -570,10 +570,10 @@ const ze = (t, e, n = !1) => {
570
570
  const e = t.next();
571
571
  if (e.done)
572
572
  return e;
573
- const n = this.get(e.value);
573
+ const s = this.get(e.value);
574
574
  return {
575
575
  done: !1,
576
- value: [e.value, n]
576
+ value: [e.value, s]
577
577
  };
578
578
  }
579
579
  };
@@ -581,15 +581,15 @@ const ze = (t, e, n = !1) => {
581
581
  [Be]() {
582
582
  return this.entries();
583
583
  }
584
- }, Bn = Reflect.ownKeys(ct), kt = (t, e, { isValuesIterator: n }) => () => {
585
- var s, i;
584
+ }, Us = Reflect.ownKeys(ct), kt = (t, e, { isValuesIterator: s }) => () => {
585
+ var n, i;
586
586
  const o = e.next();
587
587
  if (o.done)
588
588
  return o;
589
589
  const r = o.value;
590
590
  let a = t.setMap.get(r);
591
- const u = P(a), l = ((i = (s = t.options).mark) === null || i === void 0 ? void 0 : i.call(s, a, Z)) === Z.mutable;
592
- if (t.options.strict && ze(r, t.options, l), !l && !u && se(r, t.options) && !t.finalized && t.original.has(r)) {
591
+ const u = P(a), l = ((i = (n = t.options).mark) === null || i === void 0 ? void 0 : i.call(n, a, Z)) === Z.mutable;
592
+ if (t.options.strict && ze(r, t.options, l), !l && !u && ne(r, t.options) && !t.finalized && t.original.has(r)) {
593
593
  const c = gt.createDraft({
594
594
  original: r,
595
595
  parentDraft: t,
@@ -602,7 +602,7 @@ const ze = (t, e, n = !1) => {
602
602
  u && (a = u.proxy);
603
603
  return {
604
604
  done: !1,
605
- value: n ? a : [a, a]
605
+ value: s ? a : [a, a]
606
606
  };
607
607
  }, lt = {
608
608
  get size() {
@@ -612,34 +612,34 @@ const ze = (t, e, n = !1) => {
612
612
  const e = P(this);
613
613
  if (e.setMap.has(t))
614
614
  return !0;
615
- X(e);
616
- const n = P(t);
617
- return !!(n && e.setMap.has(n.original));
615
+ q(e);
616
+ const s = P(t);
617
+ return !!(s && e.setMap.has(s.original));
618
618
  },
619
619
  add(t) {
620
620
  const e = P(this);
621
- return this.has(t) || (X(e), ue(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), wt(e, t, t, $e)), this;
621
+ return this.has(t) || (q(e), ue(e), e.assignedMap.set(t, !0), e.setMap.set(t, t), wt(e, t, t, $e)), this;
622
622
  },
623
623
  delete(t) {
624
624
  if (!this.has(t))
625
625
  return !1;
626
626
  const e = P(this);
627
- X(e), ue(e);
628
- const n = P(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));
627
+ q(e), ue(e);
628
+ const s = P(t);
629
+ return s && e.setMap.has(s.original) ? (e.assignedMap.set(s.original, !1), e.setMap.delete(s.original)) : (!s && e.setMap.has(t) ? e.assignedMap.set(t, !1) : e.assignedMap.delete(t), e.setMap.delete(t));
630
630
  },
631
631
  clear() {
632
632
  if (!this.size)
633
633
  return;
634
634
  const t = P(this);
635
- X(t), ue(t);
635
+ q(t), ue(t);
636
636
  for (const e of t.original)
637
637
  t.assignedMap.set(e, !1);
638
638
  t.setMap.clear();
639
639
  },
640
640
  values() {
641
641
  const t = P(this);
642
- X(t);
642
+ q(t);
643
643
  const e = t.setMap.keys();
644
644
  return {
645
645
  [Symbol.iterator]: () => this.values(),
@@ -648,7 +648,7 @@ const ze = (t, e, n = !1) => {
648
648
  },
649
649
  entries() {
650
650
  const t = P(this);
651
- X(t);
651
+ q(t);
652
652
  const e = t.setMap.keys();
653
653
  return {
654
654
  [Symbol.iterator]: () => this.entries(),
@@ -664,34 +664,34 @@ const ze = (t, e, n = !1) => {
664
664
  return this.values();
665
665
  },
666
666
  forEach(t, e) {
667
- const n = this.values();
668
- let s = n.next();
669
- for (; !s.done; )
670
- t.call(e, s.value, s.value, this), s = n.next();
671
- }
672
- }, Fn = Reflect.ownKeys(lt), Yt = /* @__PURE__ */ new WeakSet(), Zt = {
673
- get(t, e, n) {
674
- var s, i;
675
- const o = (s = t.copy) === null || s === void 0 ? void 0 : s[e];
667
+ const s = this.values();
668
+ let n = s.next();
669
+ for (; !n.done; )
670
+ t.call(e, n.value, n.value, this), n = s.next();
671
+ }
672
+ }, Bs = Reflect.ownKeys(lt), Yt = /* @__PURE__ */ new WeakSet(), Zt = {
673
+ get(t, e, s) {
674
+ var n, i;
675
+ const o = (n = t.copy) === null || n === void 0 ? void 0 : n[e];
676
676
  if (o && Yt.has(o))
677
677
  return o;
678
678
  if (e === Kt)
679
679
  return t;
680
680
  let r;
681
681
  if (t.options.mark) {
682
- const l = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, n);
682
+ const l = e === "size" && (t.original instanceof Map || t.original instanceof Set) ? Reflect.get(t.original, e) : Reflect.get(t.original, e, s);
683
683
  if (r = t.options.mark(l, Z), r === Z.mutable)
684
684
  return t.options.strict && ze(l, t.options, !0), l;
685
685
  }
686
686
  const a = Y(t);
687
- if (a instanceof Map && Bn.includes(e)) {
687
+ if (a instanceof Map && Us.includes(e)) {
688
688
  if (e === "size")
689
689
  return Object.getOwnPropertyDescriptor(ct, "size").get.call(t.proxy);
690
690
  const l = ct[e];
691
691
  if (l)
692
692
  return l.bind(t.proxy);
693
693
  }
694
- if (a instanceof Set && Fn.includes(e)) {
694
+ if (a instanceof Set && Bs.includes(e)) {
695
695
  if (e === "size")
696
696
  return Object.getOwnPropertyDescriptor(lt, "size").get.call(t.proxy);
697
697
  const l = lt[e];
@@ -706,10 +706,10 @@ const ze = (t, e, n = !1) => {
706
706
  ) : void 0;
707
707
  }
708
708
  const u = a[e];
709
- if (t.options.strict && ze(u, t.options), t.finalized || !se(u, t.options))
709
+ if (t.options.strict && ze(u, t.options), t.finalized || !ne(u, t.options))
710
710
  return u;
711
711
  if (u === et(t.original, e)) {
712
- if (X(t), t.copy[e] = vt({
712
+ if (q(t), t.copy[e] = vt({
713
713
  original: t.original[e],
714
714
  parentDraft: t,
715
715
  key: t.type === 1 ? Number(e) : e,
@@ -717,14 +717,14 @@ const ze = (t, e, n = !1) => {
717
717
  options: t.options
718
718
  }), typeof r == "function") {
719
719
  const l = P(t.copy[e]);
720
- return X(l), ue(l), l.copy;
720
+ return q(l), ue(l), l.copy;
721
721
  }
722
722
  return t.copy[e];
723
723
  }
724
724
  return u;
725
725
  },
726
- set(t, e, n) {
727
- var s;
726
+ set(t, e, s) {
727
+ var n;
728
728
  if (t.type === 3 || t.type === 2)
729
729
  throw new Error("Map/Set draft does not support any property assignment.");
730
730
  let i;
@@ -732,9 +732,9 @@ const ze = (t, e, n = !1) => {
732
732
  throw new Error("Only supports setting array indices and the 'length' property.");
733
733
  const o = Pt(Y(t), e);
734
734
  if (o != null && o.set)
735
- return o.set.call(t.proxy, n), !0;
735
+ return o.set.call(t.proxy, s), !0;
736
736
  const r = et(Y(t), e), a = P(r);
737
- return a && fe(a.original, n) ? (t.copy[e] = n, t.assignedMap = (s = t.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (fe(n, r) && (n !== void 0 || Ie(t.original, e)) || (X(t), ue(t), Ie(t.original, e) && fe(n, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = n, wt(t, e, n, $e)), !0);
737
+ return a && fe(a.original, s) ? (t.copy[e] = s, t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.set(e, !1), !0) : (fe(s, r) && (s !== void 0 || Ie(t.original, e)) || (q(t), ue(t), Ie(t.original, e) && fe(s, t.original[e]) ? t.assignedMap.delete(e) : t.assignedMap.set(e, !0), t.copy[e] = s, wt(t, e, s, $e)), !0);
738
738
  },
739
739
  has(t, e) {
740
740
  return e in Y(t);
@@ -743,12 +743,12 @@ const ze = (t, e, n = !1) => {
743
743
  return Reflect.ownKeys(Y(t));
744
744
  },
745
745
  getOwnPropertyDescriptor(t, e) {
746
- const n = Y(t), s = Reflect.getOwnPropertyDescriptor(n, e);
747
- return s && {
746
+ const s = Y(t), n = Reflect.getOwnPropertyDescriptor(s, e);
747
+ return n && {
748
748
  writable: !0,
749
749
  configurable: t.type !== 1 || e !== "length",
750
- enumerable: s.enumerable,
751
- value: n[e]
750
+ enumerable: n.enumerable,
751
+ value: s[e]
752
752
  };
753
753
  },
754
754
  getPrototypeOf(t) {
@@ -761,15 +761,15 @@ const ze = (t, e, n = !1) => {
761
761
  throw new Error("Cannot call 'defineProperty()' on drafts");
762
762
  },
763
763
  deleteProperty(t, e) {
764
- var n;
765
- return t.type === 1 ? Zt.set.call(this, t, e, void 0, t.proxy) : (et(t.original, e) !== void 0 || e in t.original ? (X(t), ue(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (n = t.assignedMap) !== null && n !== void 0 ? n : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
764
+ var s;
765
+ return t.type === 1 ? Zt.set.call(this, t, e, void 0, t.proxy) : (et(t.original, e) !== void 0 || e in t.original ? (q(t), ue(t), t.assignedMap.set(e, !1)) : (t.assignedMap = (s = t.assignedMap) !== null && s !== void 0 ? s : /* @__PURE__ */ new Map(), t.assignedMap.delete(e)), t.copy && delete t.copy[e], !0);
766
766
  }
767
767
  };
768
768
  function vt(t) {
769
- const { original: e, parentDraft: n, key: s, finalities: i, options: o } = t, r = we(e), a = {
769
+ const { original: e, parentDraft: s, key: n, finalities: i, options: o } = t, r = we(e), a = {
770
770
  type: r,
771
771
  finalized: !1,
772
- parent: n,
772
+ parent: s,
773
773
  original: e,
774
774
  copy: null,
775
775
  proxy: null,
@@ -778,71 +778,71 @@ function vt(t) {
778
778
  // Mapping of draft Set items to their corresponding draft values.
779
779
  setMap: r === 3 ? new Map(e.entries()) : void 0
780
780
  };
781
- (s || "key" in t) && (a.key = s);
781
+ (n || "key" in t) && (a.key = n);
782
782
  const { proxy: u, revoke: l } = Proxy.revocable(r === 1 ? Object.assign([], a) : a, Zt);
783
- if (i.revoke.push(l), Yt.add(u), a.proxy = u, n) {
784
- const c = n;
785
- c.finalities.draft.push((d, g) => {
786
- var v, y;
787
- const R = P(u);
783
+ if (i.revoke.push(l), Yt.add(u), a.proxy = u, s) {
784
+ const c = s;
785
+ c.finalities.draft.push((d, _) => {
786
+ var v, m;
787
+ const S = P(u);
788
788
  let w = c.type === 3 ? c.setMap : c.copy;
789
- const $ = pe(w, s), b = P($);
789
+ const $ = pe(w, n), b = P($);
790
790
  if (b) {
791
791
  let A = b.original;
792
- b.operated && (A = _t($)), at(b), ut(b, $e, d, g), c.options.enableAutoFreeze && (c.options.updatedValues = (v = c.options.updatedValues) !== null && v !== void 0 ? v : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(A, b.original)), Te(w, s, A);
792
+ b.operated && (A = _t($)), at(b), ut(b, $e, d, _), c.options.enableAutoFreeze && (c.options.updatedValues = (v = c.options.updatedValues) !== null && v !== void 0 ? v : /* @__PURE__ */ new WeakMap(), c.options.updatedValues.set(A, b.original)), Te(w, n, A);
793
793
  }
794
- (y = R.callbacks) === null || y === void 0 || y.forEach((A) => {
795
- A(d, g);
794
+ (m = S.callbacks) === null || m === void 0 || m.forEach((A) => {
795
+ A(d, _);
796
796
  });
797
797
  });
798
798
  } else {
799
799
  const c = P(u);
800
- c.finalities.draft.push((d, g) => {
801
- at(c), ut(c, $e, d, g);
800
+ c.finalities.draft.push((d, _) => {
801
+ at(c), ut(c, $e, d, _);
802
802
  });
803
803
  }
804
804
  return u;
805
805
  }
806
806
  gt.createDraft = vt;
807
- function zn(t, e, n, s, i) {
807
+ function Fs(t, e, s, n, i) {
808
808
  var o;
809
809
  const r = P(t), a = (o = r == null ? void 0 : r.original) !== null && o !== void 0 ? o : t, u = !!e.length;
810
810
  if (r != null && r.operated)
811
811
  for (; r.finalities.draft.length > 0; )
812
- r.finalities.draft.pop()(n, s);
812
+ r.finalities.draft.pop()(s, n);
813
813
  const l = u ? e[0] : r ? r.operated ? r.copy : r.original : t;
814
- return r && ot(r), i && Re(l, l, r == null ? void 0 : r.options.updatedValues), [
814
+ return r && ot(r), i && Oe(l, l, r == null ? void 0 : r.options.updatedValues), [
815
815
  l,
816
- n && u ? [{ op: G.Replace, path: [], value: e[0] }] : n,
817
- s && u ? [{ op: G.Replace, path: [], value: a }] : s
816
+ s && u ? [{ op: J.Replace, path: [], value: e[0] }] : s,
817
+ n && u ? [{ op: J.Replace, path: [], value: a }] : n
818
818
  ];
819
819
  }
820
- function Gn(t, e) {
821
- var n;
822
- const s = {
820
+ function zs(t, e) {
821
+ var s;
822
+ const n = {
823
823
  draft: [],
824
824
  revoke: [],
825
825
  handledSet: /* @__PURE__ */ new WeakSet()
826
826
  };
827
827
  let i, o;
828
828
  e.enablePatches && (i = [], o = []);
829
- const a = ((n = e.mark) === null || n === void 0 ? void 0 : n.call(e, t, Z)) === Z.mutable || !se(t, e) ? t : vt({
829
+ const a = ((s = e.mark) === null || s === void 0 ? void 0 : s.call(e, t, Z)) === Z.mutable || !ne(t, e) ? t : vt({
830
830
  original: t,
831
831
  parentDraft: null,
832
- finalities: s,
832
+ finalities: n,
833
833
  options: e
834
834
  });
835
835
  return [
836
836
  a,
837
837
  (u = []) => {
838
- const [l, c, d] = zn(a, u, i, o, e.enableAutoFreeze);
838
+ const [l, c, d] = Fs(a, u, i, o, e.enableAutoFreeze);
839
839
  return e.enablePatches ? [l, c, d] : l;
840
840
  }
841
841
  ];
842
842
  }
843
843
  function ft(t) {
844
- const { rootDraft: e, value: n, useRawReturn: s = !1, isRoot: i = !0 } = t;
845
- bt(n, (o, r, a) => {
844
+ const { rootDraft: e, value: s, useRawReturn: n = !1, isRoot: i = !0 } = t;
845
+ bt(s, (o, r, a) => {
846
846
  const u = P(r);
847
847
  if (u && e && u.finalities === e.finalities) {
848
848
  t.isContainDraft = !0;
@@ -854,18 +854,18 @@ function ft(t) {
854
854
  Te(a, o, l);
855
855
  } else
856
856
  typeof r == "object" && r !== null && (t.value = r, t.isRoot = !1, ft(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."));
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."), n && console.warn("The return value contains drafts, please don't use 'rawReturn()' to wrap the return value."));
858
858
  }
859
- function en(t) {
859
+ function es(t) {
860
860
  const e = P(t);
861
- if (!se(t, e == null ? void 0 : e.options))
861
+ if (!ne(t, e == null ? void 0 : e.options))
862
862
  return t;
863
- const n = we(t);
863
+ const s = we(t);
864
864
  if (e && !e.operated)
865
865
  return e.original;
866
- let s;
866
+ let n;
867
867
  function i() {
868
- s = n === 2 ? new Map(t) : n === 3 ? Array.from(e.setMap.values()) : qt(t, e == null ? void 0 : e.options);
868
+ n = s === 2 ? new Map(t) : s === 3 ? Array.from(e.setMap.values()) : qt(t, e == null ? void 0 : e.options);
869
869
  }
870
870
  if (e) {
871
871
  e.finalized = !0;
@@ -875,52 +875,52 @@ function en(t) {
875
875
  e.finalized = !1;
876
876
  }
877
877
  } else
878
- s = t;
879
- return bt(s, (o, r) => {
878
+ n = t;
879
+ return bt(n, (o, r) => {
880
880
  if (e && fe(pe(e.original, o), r))
881
881
  return;
882
- const a = en(r);
883
- a !== r && (s === t && i(), Te(s, o, a));
884
- }), n === 3 ? new Set(s) : s;
882
+ const a = es(r);
883
+ a !== r && (n === t && i(), Te(n, o, a));
884
+ }), s === 3 ? new Set(n) : n;
885
885
  }
886
886
  function Ht(t) {
887
887
  if (!be(t))
888
888
  throw new Error(`current() is only used for Draft, parameter: ${t}`);
889
- return en(t);
889
+ return es(t);
890
890
  }
891
- const Vn = (t) => {
891
+ const Js = (t) => {
892
892
  if (t !== void 0 && Object.prototype.toString.call(t) !== "[object Object]")
893
893
  throw new Error(`Invalid options: ${String(t)}, 'options' should be an object.`);
894
- return function e(n, s, i) {
894
+ return function e(s, n, i) {
895
895
  var o, r, a;
896
- if (typeof n == "function" && typeof s != "function")
896
+ if (typeof s == "function" && typeof n != "function")
897
897
  return function(O, ...H) {
898
- return e(O, (S) => n.call(this, S, ...H), s);
898
+ return e(O, (R) => s.call(this, R, ...H), n);
899
899
  };
900
- const u = n, l = s;
900
+ const u = s, l = n;
901
901
  let c = i;
902
- if (typeof s != "function" && (c = s), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
902
+ if (typeof n != "function" && (c = n), c !== void 0 && Object.prototype.toString.call(c) !== "[object Object]")
903
903
  throw new Error(`Invalid options: ${c}, 'options' should be an object.`);
904
904
  c = Object.assign(Object.assign({}, t), c);
905
- const d = be(u) ? Ht(u) : u, g = Array.isArray(c.mark) ? (O, H) => {
906
- for (const S of c.mark) {
907
- if (typeof S != "function")
908
- throw new Error(`Invalid mark: ${S}, 'mark' should be a function.`);
909
- const L = S(O, H);
905
+ const d = be(u) ? Ht(u) : u, _ = Array.isArray(c.mark) ? (O, H) => {
906
+ for (const R of c.mark) {
907
+ if (typeof R != "function")
908
+ throw new Error(`Invalid mark: ${R}, 'mark' should be a function.`);
909
+ const L = R(O, H);
910
910
  if (L)
911
911
  return L;
912
912
  }
913
- } : c.mark, v = (o = c.enablePatches) !== null && o !== void 0 ? o : !1, y = (r = c.strict) !== null && r !== void 0 ? r : !1, w = {
913
+ } : c.mark, v = (o = c.enablePatches) !== null && o !== void 0 ? o : !1, m = (r = c.strict) !== null && r !== void 0 ? r : !1, w = {
914
914
  enableAutoFreeze: (a = c.enableAutoFreeze) !== null && a !== void 0 ? a : !1,
915
- mark: g,
916
- strict: y,
915
+ mark: _,
916
+ strict: m,
917
917
  enablePatches: v
918
918
  };
919
- if (!se(d, w) && typeof d == "object" && d !== null)
919
+ if (!ne(d, w) && typeof d == "object" && d !== null)
920
920
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
921
- const [$, b] = Gn(d, w);
922
- if (typeof s != "function") {
923
- if (!se(d, w))
921
+ const [$, b] = zs(d, w);
922
+ if (typeof n != "function") {
923
+ if (!ne(d, w))
924
924
  throw new Error("Invalid base state: create() only supports plain objects, arrays, Set, Map or using mark() to mark the state as immutable.");
925
925
  return [$, b];
926
926
  }
@@ -935,7 +935,7 @@ const Vn = (t) => {
935
935
  if (!be(O)) {
936
936
  if (O !== void 0 && !fe(O, $) && (H != null && H.operated))
937
937
  throw new Error("Either the value is returned as a new non-draft value, or only the draft is modified without returning any value.");
938
- const L = O == null ? void 0 : O[Ln];
938
+ const L = O == null ? void 0 : O[xs];
939
939
  if (L) {
940
940
  const U = L[0];
941
941
  return w.strict && typeof O == "object" && O !== null && ft({
@@ -949,9 +949,9 @@ const Vn = (t) => {
949
949
  }
950
950
  if (O === $ || O === void 0)
951
951
  return b([]);
952
- const S = P(O);
953
- if (w === S.options) {
954
- if (S.operated)
952
+ const R = P(O);
953
+ if (w === R.options) {
954
+ if (R.operated)
955
955
  throw new Error("Cannot return a modified child draft.");
956
956
  return b([Ht(O)]);
957
957
  }
@@ -961,18 +961,18 @@ const Vn = (t) => {
961
961
  throw ot(P($)), O;
962
962
  }) : E(A);
963
963
  };
964
- }, C = Vn();
964
+ }, C = Js();
965
965
  Object.prototype.constructor.toString();
966
- const Jn = yt(fetch), tn = async (t, e) => {
966
+ const Gs = yt(fetch), ts = async (t, e) => {
967
967
  if (!t)
968
968
  throw "Metapage definition null";
969
- if (t.version || (t = C(t, (s) => {
970
- s.version = "0.3";
969
+ if (t.version || (t = C(t, (n) => {
970
+ n.version = "0.3";
971
971
  })), !e)
972
972
  throw 'Missing "version" argument';
973
973
  if (j(e, Le) > 0)
974
974
  try {
975
- return await (await Jn(`https://module.metapage.io/conversion/metapage/v${e}`, {
975
+ return await (await Gs(`https://module.metapage.io/conversion/metapage/v${e}`, {
976
976
  redirect: "follow",
977
977
  retries: 3,
978
978
  retryDelay: 1e3,
@@ -982,59 +982,59 @@ const Jn = yt(fetch), tn = async (t, e) => {
982
982
  "Content-Type": "application/json"
983
983
  }
984
984
  })).json();
985
- } catch (s) {
986
- throw `Error converting metapage definition to version ${e}: ${s}`;
985
+ } catch (n) {
986
+ throw `Error converting metapage definition to version ${e}: ${n}`;
987
987
  }
988
- return Kn(t, e);
989
- }, Wn = async (t) => tn(t, Le), Kn = (t, e) => {
988
+ return Ws(t, e);
989
+ }, Vs = async (t) => ts(t, Le), Ws = (t, e) => {
990
990
  if (!t)
991
991
  throw "Metapage definition null";
992
992
  if (!t.version)
993
993
  throw `Missing "version" key in metapage definition: ${JSON.stringify(t)}`;
994
- let n = he(t.version);
995
- if (n === e)
994
+ let s = he(t.version);
995
+ if (s === e)
996
996
  return t;
997
- let s = t;
998
- for (; n !== e; )
999
- switch (n) {
997
+ let n = t;
998
+ for (; s !== e; )
999
+ switch (s) {
1000
1000
  case "0.2": {
1001
- if (j(e, n) > 0)
1002
- s = Xn(s), n = he(s.version);
1001
+ if (j(e, s) > 0)
1002
+ n = Ks(n), s = he(n.version);
1003
1003
  else
1004
- throw `Cannot convert from version ${n} to ${e}`;
1004
+ throw `Cannot convert from version ${s} to ${e}`;
1005
1005
  break;
1006
1006
  }
1007
1007
  case "0.3": {
1008
- j(e, n) > 0 ? (s = Qn(s), n = he(s.version)) : (s = qn(s), n = he(s.version));
1008
+ j(e, s) > 0 ? (n = qs(n), s = he(n.version)) : (n = Xs(n), s = he(n.version));
1009
1009
  break;
1010
1010
  }
1011
1011
  case "1": {
1012
- j(e, n) > 0 ? (s = es(s), n = he(s.version)) : (s = Yn(s), n = he(s.version));
1012
+ j(e, s) > 0 ? (n = Zs(n), s = he(n.version)) : (n = Qs(n), s = he(n.version));
1013
1013
  break;
1014
1014
  }
1015
1015
  case "2": {
1016
- if (j(e, n) > 0)
1017
- throw `Cannot convert from version ${n} to ${e}, 1 is the latest version`;
1018
- s = Zn(s), n = he(s.version);
1016
+ if (j(e, s) > 0)
1017
+ throw `Cannot convert from version ${s} to ${e}, 1 is the latest version`;
1018
+ n = Ys(n), s = he(n.version);
1019
1019
  break;
1020
1020
  }
1021
1021
  default:
1022
- throw `Unknow version ${n} to ${e}`;
1022
+ throw `Unknow version ${s} to ${e}`;
1023
1023
  }
1024
- return s;
1025
- }, Xn = (t) => C(t, (e) => {
1024
+ return n;
1025
+ }, Ks = (t) => C(t, (e) => {
1026
1026
  e.version = "0.3";
1027
- }), qn = (t) => C(t, (e) => {
1027
+ }), Xs = (t) => C(t, (e) => {
1028
1028
  e.version = "0.2";
1029
- }), Qn = (t) => C(t, (e) => {
1030
- const n = e;
1031
- delete n.plugins, n.version = "1";
1032
- }), Yn = (t) => C(t, (e) => (e.version = "0.3", e)), Zn = (t) => C(t, (e) => {
1033
- var n, s;
1034
- return e.version = "1", (n = e == null ? void 0 : e.meta) != null && n.tags && (e.meta.keywords = e.meta.tags, delete e.meta.tags), (s = e == null ? void 0 : e.meta) != null && s.authors && (e.meta.author = e.meta.authors[0], delete e.meta.authors), e;
1035
- }), es = (t) => C(t, (e) => {
1036
- var n, s;
1037
- return e.version = "2", (n = e == null ? void 0 : e.meta) != null && n.keywords && (e.meta.tags = e.meta.keywords, delete e.meta.keywords), (s = e == null ? void 0 : e.meta) != null && s.author && (e.meta.authors = [e.meta.author], delete e.meta.author), e;
1029
+ }), qs = (t) => C(t, (e) => {
1030
+ const s = e;
1031
+ delete s.plugins, s.version = "1";
1032
+ }), Qs = (t) => C(t, (e) => (e.version = "0.3", e)), Ys = (t) => C(t, (e) => {
1033
+ var s, n;
1034
+ return e.version = "1", (s = e == null ? void 0 : e.meta) != null && s.tags && (e.meta.keywords = e.meta.tags, delete e.meta.tags), (n = e == null ? void 0 : e.meta) != null && n.authors && (e.meta.author = e.meta.authors[0], delete e.meta.authors), e;
1035
+ }), Zs = (t) => C(t, (e) => {
1036
+ var s, n;
1037
+ return e.version = "2", (s = e == null ? void 0 : e.meta) != null && s.keywords && (e.meta.tags = e.meta.keywords, delete e.meta.keywords), (n = e == null ? void 0 : e.meta) != null && n.author && (e.meta.authors = [e.meta.author], delete e.meta.author), e;
1038
1038
  }), he = (t) => {
1039
1039
  if (t === "latest")
1040
1040
  return Le;
@@ -1049,7 +1049,7 @@ const Jn = yt(fetch), tn = async (t, e) => {
1049
1049
  if (t === "2")
1050
1050
  return "2";
1051
1051
  throw `Unknown version: ${t}`;
1052
- }, ts = yt(fetch), nn = async (t, e) => {
1052
+ }, en = yt(fetch), ss = async (t, e) => {
1053
1053
  if (!t)
1054
1054
  throw "Metaframe definition null";
1055
1055
  if (!t.version)
@@ -1058,7 +1058,7 @@ const Jn = yt(fetch), tn = async (t, e) => {
1058
1058
  throw 'Missing "version" argument';
1059
1059
  if (j(e, We) > 0)
1060
1060
  try {
1061
- return await (await ts(`https://module.metapage.io/conversion/metaframe/v${e}`, {
1061
+ return await (await en(`https://module.metapage.io/conversion/metaframe/v${e}`, {
1062
1062
  redirect: "follow",
1063
1063
  retries: 3,
1064
1064
  retryDelay: 1e3,
@@ -1068,100 +1068,100 @@ const Jn = yt(fetch), tn = async (t, e) => {
1068
1068
  "Content-Type": "application/json"
1069
1069
  }
1070
1070
  })).json();
1071
- } catch (s) {
1072
- throw `Error converting metapage definition to version ${e}: ${s}`;
1071
+ } catch (n) {
1072
+ throw `Error converting metapage definition to version ${e}: ${n}`;
1073
1073
  }
1074
- return ss(t, e);
1075
- }, ns = async (t) => nn(t, We), ss = (t, e) => {
1074
+ return sn(t, e);
1075
+ }, tn = async (t) => ss(t, We), sn = (t, e) => {
1076
1076
  if (!t)
1077
1077
  throw "Metaframe definition null";
1078
1078
  t.version || (t = C(t, (i) => {
1079
1079
  i.version = "0.3";
1080
1080
  }));
1081
- let n = te(t.version);
1082
- if (n === e)
1081
+ let s = te(t.version);
1082
+ if (s === e)
1083
1083
  return t;
1084
- let s = t;
1085
- for (; n !== e; )
1086
- switch (n) {
1084
+ let n = t;
1085
+ for (; s !== e; )
1086
+ switch (s) {
1087
1087
  case "0.3": {
1088
- if (j(e, n) > 0)
1089
- s = rs(s), n = te(s.version);
1088
+ if (j(e, s) > 0)
1089
+ n = rn(n), s = te(n.version);
1090
1090
  else
1091
- throw `Cannot convert from version ${n} to ${e}`;
1091
+ throw `Cannot convert from version ${s} to ${e}`;
1092
1092
  break;
1093
1093
  }
1094
1094
  case "0.4": {
1095
- j(e, n) > 0 ? (s = os(s), n = te(s.version)) : (s = is(s), n = te(s.version));
1095
+ j(e, s) > 0 ? (n = on(n), s = te(n.version)) : (n = nn(n), s = te(n.version));
1096
1096
  break;
1097
1097
  }
1098
1098
  case "0.5": {
1099
- j(e, n) > 0 ? (s = ps(s), n = te(s.version)) : (s = as(s), n = te(s.version));
1099
+ j(e, s) > 0 ? (n = pn(n), s = te(n.version)) : (n = an(n), s = te(n.version));
1100
1100
  break;
1101
1101
  }
1102
1102
  case "0.6": {
1103
- j(e, n) > 0 ? (s = us(s), n = te(s.version)) : (s = hs(s), n = te(s.version));
1103
+ j(e, s) > 0 ? (n = un(n), s = te(n.version)) : (n = hn(n), s = te(n.version));
1104
1104
  break;
1105
1105
  }
1106
1106
  case "1": {
1107
- j(e, n) > 0 ? (s = fs(s), n = te(s.version)) : (s = cs(s), n = te(s.version));
1107
+ j(e, s) > 0 ? (n = fn(n), s = te(n.version)) : (n = cn(n), s = te(n.version));
1108
1108
  break;
1109
1109
  }
1110
1110
  case "2": {
1111
- if (j(e, n) > 0)
1112
- throw `Cannot convert from version ${n} to ${e}`;
1113
- s = ls(s), n = te(s.version);
1111
+ if (j(e, s) > 0)
1112
+ throw `Cannot convert from version ${s} to ${e}`;
1113
+ n = ln(n), s = te(n.version);
1114
1114
  break;
1115
1115
  }
1116
1116
  default:
1117
- throw `Unknow version ${n} to ${e}`;
1117
+ throw `Unknow version ${s} to ${e}`;
1118
1118
  }
1119
- return s;
1119
+ return n;
1120
1120
  }, pt = async (t, e) => {
1121
1121
  if (t)
1122
- return ns(t);
1123
- }, is = (t) => C(t, (e) => {
1122
+ return tn(t);
1123
+ }, nn = (t) => C(t, (e) => {
1124
1124
  e.version = "0.3", delete e.allow;
1125
- }), rs = (t) => C(t, (e) => {
1125
+ }), rn = (t) => C(t, (e) => {
1126
1126
  e.version = "0.4";
1127
- }), os = (t) => C(t, (e) => {
1127
+ }), on = (t) => C(t, (e) => {
1128
1128
  if (e.version = "0.5", !(e != null && e.metadata))
1129
1129
  return;
1130
- const n = e.metadata.title;
1131
- delete e.metadata.title, e.metadata.name = n;
1132
- const s = e.metadata.descriptionUrl;
1133
- delete e.metadata.descriptionUrl, e.metadata.description = s;
1130
+ const s = e.metadata.title;
1131
+ delete e.metadata.title, e.metadata.name = s;
1132
+ const n = e.metadata.descriptionUrl;
1133
+ delete e.metadata.descriptionUrl, e.metadata.description = n;
1134
1134
  const i = e.metadata.keywords;
1135
1135
  delete e.metadata.keywords, e.metadata.tags = i;
1136
- }), as = (t) => C(t, (e) => {
1136
+ }), an = (t) => C(t, (e) => {
1137
1137
  if (e.version = "0.4", !(e != null && e.metadata))
1138
1138
  return;
1139
- const n = e.metadata.name;
1140
- delete e.metadata.name, e.metadata.title = n;
1141
- const s = e.metadata.description;
1142
- delete e.metadata.description, e.metadata.descriptionUrl = s;
1139
+ const s = e.metadata.name;
1140
+ delete e.metadata.name, e.metadata.title = s;
1141
+ const n = e.metadata.description;
1142
+ delete e.metadata.description, e.metadata.descriptionUrl = n;
1143
1143
  const i = e.metadata.tags;
1144
1144
  delete e.metadata.tags, e.metadata.keywords = i;
1145
- }), us = (t) => C(t, (e) => {
1146
- var n;
1147
- e.version = "1", (n = e == null ? void 0 : e.metadata) != null && n.operations && delete e.metadata.operations;
1148
- }), cs = (t) => C(t, (e) => {
1149
- var n;
1150
- e.version = "0.6", (n = e == null ? void 0 : e.metadata) != null && n.operations && delete e.metadata.operations;
1151
- }), ls = (t) => C(t, (e) => {
1152
- var n, s;
1153
- return e.version = "1", (n = e == null ? void 0 : e.metadata) != null && n.authors && (e.metadata.author = (s = e == null ? void 0 : e.metadata) == null ? void 0 : s.authors[0], delete e.metadata.authors), e;
1154
- }), fs = (t) => C(t, (e) => {
1155
- var n;
1156
- return e.version = "2", (n = e == null ? void 0 : e.metadata) != null && n.author && (e.metadata.authors = [
1145
+ }), un = (t) => C(t, (e) => {
1146
+ var s;
1147
+ e.version = "1", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
1148
+ }), cn = (t) => C(t, (e) => {
1149
+ var s;
1150
+ e.version = "0.6", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
1151
+ }), ln = (t) => C(t, (e) => {
1152
+ var s, n;
1153
+ return e.version = "1", (s = e == null ? void 0 : e.metadata) != null && s.authors && (e.metadata.author = (n = e == null ? void 0 : e.metadata) == null ? void 0 : n.authors[0], delete e.metadata.authors), e;
1154
+ }), fn = (t) => C(t, (e) => {
1155
+ var s;
1156
+ return e.version = "2", (s = e == null ? void 0 : e.metadata) != null && s.author && (e.metadata.authors = [
1157
1157
  e.metadata.author
1158
1158
  ], delete e.metadata.author), e;
1159
- }), ps = (t) => C(t, (e) => {
1160
- var n;
1161
- e.version = "0.6", (n = e == null ? void 0 : e.metadata) != null && n.operations && delete e.metadata.operations;
1162
- }), hs = (t) => C(t, (e) => {
1163
- var n;
1164
- e.version = "0.5", (n = e == null ? void 0 : e.metadata) != null && n.operations && delete e.metadata.operations;
1159
+ }), pn = (t) => C(t, (e) => {
1160
+ var s;
1161
+ e.version = "0.6", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
1162
+ }), hn = (t) => C(t, (e) => {
1163
+ var s;
1164
+ e.version = "0.5", (s = e == null ? void 0 : e.metadata) != null && s.operations && delete e.metadata.operations;
1165
1165
  }), te = (t) => {
1166
1166
  if (t === "latest")
1167
1167
  return We;
@@ -1181,58 +1181,58 @@ const Jn = yt(fetch), tn = async (t, e) => {
1181
1181
  return "2";
1182
1182
  throw `Unknown version: ${t}`;
1183
1183
  };
1184
- var Oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ee = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
1185
- for (var je = 0; je < Oe.length; je++)
1186
- Ee[Oe.charCodeAt(je)] = je;
1184
+ var Re = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ee = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
1185
+ for (var je = 0; je < Re.length; je++)
1186
+ Ee[Re.charCodeAt(je)] = je;
1187
1187
  var Ue = function(t) {
1188
- var e = new Uint8Array(t), n, s = e.length, i = "";
1189
- for (n = 0; n < s; n += 3)
1190
- i += Oe[e[n] >> 2], i += Oe[(e[n] & 3) << 4 | e[n + 1] >> 4], i += Oe[(e[n + 1] & 15) << 2 | e[n + 2] >> 6], i += Oe[e[n + 2] & 63];
1191
- return s % 3 === 2 ? i = i.substring(0, i.length - 1) + "=" : s % 3 === 1 && (i = i.substring(0, i.length - 2) + "=="), i;
1188
+ var e = new Uint8Array(t), s, n = e.length, i = "";
1189
+ for (s = 0; s < n; s += 3)
1190
+ i += Re[e[s] >> 2], i += Re[(e[s] & 3) << 4 | e[s + 1] >> 4], i += Re[(e[s + 1] & 15) << 2 | e[s + 2] >> 6], i += Re[e[s + 2] & 63];
1191
+ return n % 3 === 2 ? i = i.substring(0, i.length - 1) + "=" : n % 3 === 1 && (i = i.substring(0, i.length - 2) + "=="), i;
1192
1192
  }, de = function(t) {
1193
- var e = t.length * 0.75, n = t.length, s, i = 0, o, r, a, u;
1193
+ var e = t.length * 0.75, s = t.length, n, i = 0, o, r, a, u;
1194
1194
  t[t.length - 1] === "=" && (e--, t[t.length - 2] === "=" && e--);
1195
1195
  var l = new ArrayBuffer(e), c = new Uint8Array(l);
1196
- for (s = 0; s < n; s += 4)
1197
- o = Ee[t.charCodeAt(s)], r = Ee[t.charCodeAt(s + 1)], a = Ee[t.charCodeAt(s + 2)], u = Ee[t.charCodeAt(s + 3)], c[i++] = o << 2 | r >> 4, c[i++] = (r & 15) << 4 | a >> 2, c[i++] = (a & 3) << 6 | u & 63;
1196
+ for (n = 0; n < s; n += 4)
1197
+ o = Ee[t.charCodeAt(n)], r = Ee[t.charCodeAt(n + 1)], a = Ee[t.charCodeAt(n + 2)], u = Ee[t.charCodeAt(n + 3)], c[i++] = o << 2 | r >> 4, c[i++] = (r & 15) << 4 | a >> 2, c[i++] = (a & 3) << 6 | u & 63;
1198
1198
  return l;
1199
1199
  };
1200
1200
  const Ke = async (t) => C(t, async (e) => {
1201
- for (const n of Object.keys(t)) {
1202
- const s = await ds(t[n]);
1203
- return e[n] = s, e;
1201
+ for (const s of Object.keys(t)) {
1202
+ const n = await dn(t[s]);
1203
+ return e[s] = n, e;
1204
1204
  }
1205
1205
  }), Ce = async (t) => C(t, async (e) => {
1206
- for (const n of Object.keys(t)) {
1207
- const s = await sn(t[n]);
1208
- return e[n] = s, e;
1206
+ for (const s of Object.keys(t)) {
1207
+ const n = await ns(t[s]);
1208
+ return e[s] = n, e;
1209
1209
  }
1210
- }), $i = async (t, e, n) => {
1211
- if (t = sn(t), n = n || {}, n.type || (n.type = "application/octet-stream"), t instanceof ArrayBuffer)
1212
- return new File([t], e, n);
1210
+ }), $i = async (t, e, s) => {
1211
+ if (t = ns(t), s = s || {}, s.type || (s.type = "application/octet-stream"), t instanceof ArrayBuffer)
1212
+ return new File([t], e, s);
1213
1213
  if (t instanceof File || t instanceof Blob) {
1214
1214
  const i = await t.arrayBuffer();
1215
- return t instanceof File && (n.type = t.type), new File([i], e, n);
1215
+ return t instanceof File && (s.type = t.type), new File([i], e, s);
1216
1216
  }
1217
1217
  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) {
1218
1218
  const i = t;
1219
- return new File([i.buffer], e, n);
1219
+ return new File([i.buffer], e, s);
1220
1220
  }
1221
1221
  if (typeof t == "string") {
1222
- var s = new Blob([t], { type: "text/plain" });
1223
- return n.type = "text/plain", new File([s], e, n);
1222
+ var n = new Blob([t], { type: "text/plain" });
1223
+ return s.type = "text/plain", new File([n], e, s);
1224
1224
  }
1225
1225
  if (typeof t == "object") {
1226
1226
  const i = new Blob([JSON.stringify(t)], {
1227
1227
  type: "application/json"
1228
1228
  });
1229
- return n.type = "application/json", new File([i], e, n);
1229
+ return s.type = "application/json", new File([i], e, s);
1230
1230
  }
1231
- var s = new Blob([t], { type: "text/plain" });
1232
- return n.type = "text/plain", new File([s], e, n);
1233
- }, ds = async (t) => {
1231
+ var n = new Blob([t], { type: "text/plain" });
1232
+ return s.type = "text/plain", new File([n], e, s);
1233
+ }, dn = async (t) => {
1234
1234
  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) {
1235
- const e = t, n = {
1235
+ const e = t, s = {
1236
1236
  _s: !0,
1237
1237
  _c: t.constructor.name,
1238
1238
  value: Ue(e.buffer),
@@ -1240,55 +1240,55 @@ const Ke = async (t) => C(t, async (e) => {
1240
1240
  byteOffset: e.byteOffset,
1241
1241
  size: e.byteLength
1242
1242
  };
1243
- return Promise.resolve(n);
1243
+ return Promise.resolve(s);
1244
1244
  } else if (t instanceof File) {
1245
- const e = t, n = await e.arrayBuffer();
1245
+ const e = t, s = await e.arrayBuffer();
1246
1246
  return {
1247
1247
  _s: !0,
1248
1248
  _c: File.name,
1249
- value: Ue(n),
1249
+ value: Ue(s),
1250
1250
  name: e.name,
1251
1251
  fileType: e.type,
1252
1252
  lastModified: e.lastModified,
1253
- size: n.byteLength
1253
+ size: s.byteLength
1254
1254
  };
1255
1255
  } else if (t instanceof Blob) {
1256
- const e = t, n = await e.arrayBuffer();
1256
+ const e = t, s = await e.arrayBuffer();
1257
1257
  return {
1258
1258
  _s: !0,
1259
1259
  _c: Blob.name,
1260
- value: Ue(n),
1260
+ value: Ue(s),
1261
1261
  fileType: e.type,
1262
- size: n.byteLength
1262
+ size: s.byteLength
1263
1263
  };
1264
1264
  } else if (t instanceof ArrayBuffer) {
1265
- const e = t, n = {
1265
+ const e = t, s = {
1266
1266
  _s: !0,
1267
1267
  _c: ArrayBuffer.name,
1268
1268
  value: Ue(e),
1269
1269
  size: e.byteLength
1270
1270
  };
1271
- return Promise.resolve(n);
1271
+ return Promise.resolve(s);
1272
1272
  }
1273
1273
  return Promise.resolve(t);
1274
- }, sn = (t) => {
1274
+ }, ns = (t) => {
1275
1275
  if (!(t && typeof t == "object" && t._s === !0))
1276
1276
  return t;
1277
- const e = t, n = e._c;
1278
- if (n === Blob.name) {
1277
+ const e = t, s = e._c;
1278
+ if (s === Blob.name) {
1279
1279
  const r = t;
1280
1280
  return new Blob([de(e.value)], {
1281
1281
  type: r.fileType
1282
1282
  });
1283
- } else if (n === File.name) {
1283
+ } else if (s === File.name) {
1284
1284
  const r = t;
1285
1285
  return new File([de(e.value)], r.name, {
1286
1286
  type: r.fileType,
1287
1287
  lastModified: r.lastModified
1288
1288
  });
1289
- } else if (n === ArrayBuffer.name)
1289
+ } else if (s === ArrayBuffer.name)
1290
1290
  return de(e.value);
1291
- const s = t, i = de(s.value), o = s._c;
1291
+ const n = t, i = de(n.value), o = n._c;
1292
1292
  try {
1293
1293
  return new globalThis[o](i);
1294
1294
  } catch {
@@ -1297,27 +1297,27 @@ const Ke = async (t) => C(t, async (e) => {
1297
1297
  }, xi = (t) => {
1298
1298
  if (!(t && typeof t == "object" && t._s === !0))
1299
1299
  return;
1300
- const e = t, n = e._c;
1301
- if (n === Blob.name) {
1300
+ const e = t, s = e._c;
1301
+ if (s === Blob.name) {
1302
1302
  const r = t, a = new Blob([de(e.value)], {
1303
1303
  type: r.fileType
1304
1304
  });
1305
1305
  return new File([a], "file", {
1306
1306
  type: a.type
1307
1307
  });
1308
- } else if (n === File.name) {
1308
+ } else if (s === File.name) {
1309
1309
  const r = t;
1310
1310
  return new File([de(e.value)], r.name, {
1311
1311
  type: r.fileType,
1312
1312
  lastModified: r.lastModified
1313
1313
  });
1314
- } else if (n === ArrayBuffer.name) {
1314
+ } else if (s === ArrayBuffer.name) {
1315
1315
  const r = de(e.value);
1316
1316
  return new File([r], "file", {
1317
1317
  type: "application/octet-stream"
1318
1318
  });
1319
1319
  }
1320
- const s = t, i = de(s.value), o = s._c;
1320
+ const n = t, i = de(n.value), o = n._c;
1321
1321
  try {
1322
1322
  const r = new globalThis[o](i);
1323
1323
  return new File([r], "file", {
@@ -1330,10 +1330,10 @@ var x;
1330
1330
  (function(t) {
1331
1331
  t.Inputs = "inputs", t.Outputs = "outputs", t.State = "state", t.Definition = "definition", t.Error = "error", t.Warning = "warning", t.UrlHashUpdate = "urlhashupdate", t.Message = "Message";
1332
1332
  })(x || (x = {}));
1333
- var q;
1333
+ var X;
1334
1334
  (function(t) {
1335
1335
  t.InputsUpdate = "InputsUpdate", t.OutputsUpdate = "OutputsUpdate", t.SetupIframeClientRequest = "SetupIframeClientRequest", t.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", t.HashParamsUpdate = "HashParamsUpdate";
1336
- })(q || (q = {}));
1336
+ })(X || (X = {}));
1337
1337
  var me;
1338
1338
  (function(t) {
1339
1339
  t.InputsUpdate = "InputsUpdate", t.MessageAck = "MessageAck", t.SetupIframeServerResponse = "SetupIframeServerResponse";
@@ -1351,51 +1351,51 @@ function Hi(t) {
1351
1351
  return !1;
1352
1352
  }
1353
1353
  }
1354
- var rn = { exports: {} };
1354
+ var is = { exports: {} };
1355
1355
  (function(t) {
1356
- var e = Object.prototype.hasOwnProperty, n = "~";
1357
- function s() {
1356
+ var e = Object.prototype.hasOwnProperty, s = "~";
1357
+ function n() {
1358
1358
  }
1359
- Object.create && (s.prototype = /* @__PURE__ */ Object.create(null), new s().__proto__ || (n = !1));
1359
+ Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (s = !1));
1360
1360
  function i(u, l, c) {
1361
1361
  this.fn = u, this.context = l, this.once = c || !1;
1362
1362
  }
1363
- function o(u, l, c, d, g) {
1363
+ function o(u, l, c, d, _) {
1364
1364
  if (typeof c != "function")
1365
1365
  throw new TypeError("The listener must be a function");
1366
- var v = new i(c, d || u, g), y = n ? n + l : l;
1367
- return u._events[y] ? u._events[y].fn ? u._events[y] = [u._events[y], v] : u._events[y].push(v) : (u._events[y] = v, u._eventsCount++), u;
1366
+ var v = new i(c, d || u, _), m = s ? s + l : l;
1367
+ return u._events[m] ? u._events[m].fn ? u._events[m] = [u._events[m], v] : u._events[m].push(v) : (u._events[m] = v, u._eventsCount++), u;
1368
1368
  }
1369
1369
  function r(u, l) {
1370
- --u._eventsCount === 0 ? u._events = new s() : delete u._events[l];
1370
+ --u._eventsCount === 0 ? u._events = new n() : delete u._events[l];
1371
1371
  }
1372
1372
  function a() {
1373
- this._events = new s(), this._eventsCount = 0;
1373
+ this._events = new n(), this._eventsCount = 0;
1374
1374
  }
1375
1375
  a.prototype.eventNames = function() {
1376
1376
  var l = [], c, d;
1377
1377
  if (this._eventsCount === 0)
1378
1378
  return l;
1379
1379
  for (d in c = this._events)
1380
- e.call(c, d) && l.push(n ? d.slice(1) : d);
1380
+ e.call(c, d) && l.push(s ? d.slice(1) : d);
1381
1381
  return Object.getOwnPropertySymbols ? l.concat(Object.getOwnPropertySymbols(c)) : l;
1382
1382
  }, a.prototype.listeners = function(l) {
1383
- var c = n ? n + l : l, d = this._events[c];
1383
+ var c = s ? s + l : l, d = this._events[c];
1384
1384
  if (!d)
1385
1385
  return [];
1386
1386
  if (d.fn)
1387
1387
  return [d.fn];
1388
- for (var g = 0, v = d.length, y = new Array(v); g < v; g++)
1389
- y[g] = d[g].fn;
1390
- return y;
1388
+ for (var _ = 0, v = d.length, m = new Array(v); _ < v; _++)
1389
+ m[_] = d[_].fn;
1390
+ return m;
1391
1391
  }, a.prototype.listenerCount = function(l) {
1392
- var c = n ? n + l : l, d = this._events[c];
1392
+ var c = s ? s + l : l, d = this._events[c];
1393
1393
  return d ? d.fn ? 1 : d.length : 0;
1394
- }, a.prototype.emit = function(l, c, d, g, v, y) {
1395
- var R = n ? n + l : l;
1396
- if (!this._events[R])
1394
+ }, a.prototype.emit = function(l, c, d, _, v, m) {
1395
+ var S = s ? s + l : l;
1396
+ if (!this._events[S])
1397
1397
  return !1;
1398
- var w = this._events[R], $ = arguments.length, b, A;
1398
+ var w = this._events[S], $ = arguments.length, b, A;
1399
1399
  if (w.fn) {
1400
1400
  switch (w.once && this.removeListener(l, w.fn, void 0, !0), $) {
1401
1401
  case 1:
@@ -1405,11 +1405,11 @@ var rn = { exports: {} };
1405
1405
  case 3:
1406
1406
  return w.fn.call(w.context, c, d), !0;
1407
1407
  case 4:
1408
- return w.fn.call(w.context, c, d, g), !0;
1408
+ return w.fn.call(w.context, c, d, _), !0;
1409
1409
  case 5:
1410
- return w.fn.call(w.context, c, d, g, v), !0;
1410
+ return w.fn.call(w.context, c, d, _, v), !0;
1411
1411
  case 6:
1412
- return w.fn.call(w.context, c, d, g, v, y), !0;
1412
+ return w.fn.call(w.context, c, d, _, v, m), !0;
1413
1413
  }
1414
1414
  for (A = 1, b = new Array($ - 1); A < $; A++)
1415
1415
  b[A - 1] = arguments[A];
@@ -1428,7 +1428,7 @@ var rn = { exports: {} };
1428
1428
  w[A].fn.call(w[A].context, c, d);
1429
1429
  break;
1430
1430
  case 4:
1431
- w[A].fn.call(w[A].context, c, d, g);
1431
+ w[A].fn.call(w[A].context, c, d, _);
1432
1432
  break;
1433
1433
  default:
1434
1434
  if (!b)
@@ -1442,33 +1442,33 @@ var rn = { exports: {} };
1442
1442
  return o(this, l, c, d, !1);
1443
1443
  }, a.prototype.once = function(l, c, d) {
1444
1444
  return o(this, l, c, d, !0);
1445
- }, a.prototype.removeListener = function(l, c, d, g) {
1446
- var v = n ? n + l : l;
1445
+ }, a.prototype.removeListener = function(l, c, d, _) {
1446
+ var v = s ? s + l : l;
1447
1447
  if (!this._events[v])
1448
1448
  return this;
1449
1449
  if (!c)
1450
1450
  return r(this, v), this;
1451
- var y = this._events[v];
1452
- if (y.fn)
1453
- y.fn === c && (!g || y.once) && (!d || y.context === d) && r(this, v);
1451
+ var m = this._events[v];
1452
+ if (m.fn)
1453
+ m.fn === c && (!_ || m.once) && (!d || m.context === d) && r(this, v);
1454
1454
  else {
1455
- for (var R = 0, w = [], $ = y.length; R < $; R++)
1456
- (y[R].fn !== c || g && !y[R].once || d && y[R].context !== d) && w.push(y[R]);
1455
+ for (var S = 0, w = [], $ = m.length; S < $; S++)
1456
+ (m[S].fn !== c || _ && !m[S].once || d && m[S].context !== d) && w.push(m[S]);
1457
1457
  w.length ? this._events[v] = w.length === 1 ? w[0] : w : r(this, v);
1458
1458
  }
1459
1459
  return this;
1460
1460
  }, a.prototype.removeAllListeners = function(l) {
1461
1461
  var c;
1462
- return l ? (c = n ? n + l : l, this._events[c] && r(this, c)) : (this._events = new s(), this._eventsCount = 0), this;
1463
- }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = n, a.EventEmitter = a, t.exports = a;
1464
- })(rn);
1465
- var Rt = rn.exports;
1466
- function ms(t) {
1462
+ return l ? (c = s ? s + l : l, this._events[c] && r(this, c)) : (this._events = new n(), this._eventsCount = 0), this;
1463
+ }, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = s, a.EventEmitter = a, t.exports = a;
1464
+ })(is);
1465
+ var Ot = is.exports;
1466
+ function mn(t) {
1467
1467
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1468
1468
  }
1469
- var ys = function(t, e) {
1469
+ var yn = function(t, e) {
1470
1470
  e || (e = {}), typeof e == "function" && (e = { cmp: e });
1471
- var n = typeof e.cycles == "boolean" ? e.cycles : !1, s = e.cmp && /* @__PURE__ */ function(o) {
1471
+ var s = typeof e.cycles == "boolean" ? e.cycles : !1, n = e.cmp && /* @__PURE__ */ function(o) {
1472
1472
  return function(r) {
1473
1473
  return function(a, u) {
1474
1474
  var l = { key: a, value: r[a] }, c = { key: u, value: r[u] };
@@ -1491,44 +1491,44 @@ var ys = function(t, e) {
1491
1491
  if (r === null)
1492
1492
  return "null";
1493
1493
  if (i.indexOf(r) !== -1) {
1494
- if (n)
1494
+ if (s)
1495
1495
  return JSON.stringify("__cycle__");
1496
1496
  throw new TypeError("Converting circular structure to JSON");
1497
1497
  }
1498
- var l = i.push(r) - 1, c = Object.keys(r).sort(s && s(r));
1498
+ var l = i.push(r) - 1, c = Object.keys(r).sort(n && n(r));
1499
1499
  for (u = "", a = 0; a < c.length; a++) {
1500
- var d = c[a], g = o(r[d]);
1501
- g && (u && (u += ","), u += JSON.stringify(d) + ":" + g);
1500
+ var d = c[a], _ = o(r[d]);
1501
+ _ && (u && (u += ","), u += JSON.stringify(d) + ":" + _);
1502
1502
  }
1503
1503
  return i.splice(l, 1), "{" + u + "}";
1504
1504
  }
1505
1505
  }(t);
1506
1506
  };
1507
- const gs = /* @__PURE__ */ ms(ys), _s = (t) => on(gs(t)), bs = (t) => {
1507
+ const gn = /* @__PURE__ */ mn(yn), _n = (t) => rs(gn(t)), bn = (t) => {
1508
1508
  if (t && t.length > 0)
1509
1509
  try {
1510
- return JSON.parse(an(t));
1510
+ return JSON.parse(os(t));
1511
1511
  } catch {
1512
1512
  return JSON.parse(decodeURIComponent(atob(decodeURIComponent(t))));
1513
1513
  }
1514
- }, on = (t) => btoa(encodeURIComponent(t)), an = (t) => {
1514
+ }, rs = (t) => btoa(encodeURIComponent(t)), os = (t) => {
1515
1515
  try {
1516
1516
  return decodeURIComponent(atob(t));
1517
1517
  } catch {
1518
1518
  return decodeURIComponent(atob(decodeURIComponent(t)));
1519
1519
  }
1520
- }, un = (t) => {
1520
+ }, as = (t) => {
1521
1521
  const e = t instanceof URL ? t : new URL(t);
1522
- return cn(e.hash);
1523
- }, cn = (t) => {
1522
+ return us(e.hash);
1523
+ }, us = (t) => {
1524
1524
  let e = t;
1525
1525
  for (; e.startsWith("#"); )
1526
1526
  e = e.substring(1);
1527
- const n = e.indexOf("?");
1528
- if (n === -1)
1527
+ const s = e.indexOf("?");
1528
+ if (s === -1)
1529
1529
  return [e, {}];
1530
- const s = e.substring(0, n);
1531
- e = e.substring(n + 1);
1530
+ const n = e.substring(0, s);
1531
+ e = e.substring(s + 1);
1532
1532
  const i = {};
1533
1533
  return e.split("&").filter((o) => o.length > 0).map((o) => {
1534
1534
  const r = o.indexOf("=");
@@ -1540,17 +1540,17 @@ const gs = /* @__PURE__ */ ms(ys), _s = (t) => on(gs(t)), bs = (t) => {
1540
1540
  i[o] = r;
1541
1541
  }), Object.keys(i).forEach((o) => {
1542
1542
  i[o] = i[o];
1543
- }), [s, i];
1543
+ }), [n, i];
1544
1544
  }, Pe = (t, e) => {
1545
- const [n, s] = un(t);
1546
- return s[e];
1547
- }, ws = (t) => vs()[1][t], vs = () => un(window.location.href), Se = (t, e, n) => {
1548
- const s = window.location.hash.startsWith("#") ? window.location.hash.substring(1) : window.location.hash, i = Rs(s, t, e);
1549
- 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"))));
1550
- }, Rs = (t, e, n) => {
1551
- const [s, i] = cn(t);
1545
+ const [s, n] = as(t);
1546
+ return n[e];
1547
+ }, wn = (t) => vn()[1][t], vn = () => as(window.location.href), Se = (t, e, s) => {
1548
+ const n = window.location.hash.startsWith("#") ? window.location.hash.substring(1) : window.location.hash, i = On(n, t, e);
1549
+ i !== n && (s != null && s.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"))));
1550
+ }, On = (t, e, s) => {
1551
+ const [n, i] = us(t);
1552
1552
  let o = !1;
1553
- if (i.hasOwnProperty(e) && n === null || n === void 0 ? (delete i[e], o = !0) : i[e] !== n && (i[e] = n, o = !0), !o)
1553
+ if (i.hasOwnProperty(e) && s === null || s === void 0 ? (delete i[e], o = !0) : i[e] !== s && (i[e] = s, o = !0), !o)
1554
1554
  return t;
1555
1555
  const r = Object.keys(i);
1556
1556
  r.sort();
@@ -1558,36 +1558,36 @@ const gs = /* @__PURE__ */ ms(ys), _s = (t) => on(gs(t)), bs = (t) => {
1558
1558
  const c = i[u];
1559
1559
  return /^[A-Za-z0-9+/]+={0,2}$/.test(c) && c.length % 4, `${u}=${c}`;
1560
1560
  }).join("&");
1561
- return !s && !a ? "" : `${s || ""}${a ? "?" + a : ""}`;
1562
- }, Ot = (t, e) => {
1563
- const n = Pe(t, e);
1564
- if (n && n !== "")
1565
- return bs(n);
1566
- }, Os = (t, e, n) => {
1567
- const s = e ? _s(e) : void 0;
1568
- Se(t, s, n);
1569
- }, Ss = (t) => Ot(window.location.href, t), As = (t, e) => {
1570
- const n = Pe(t, e);
1571
- return n ? parseFloat(n) : void 0;
1572
- }, ln = (t, e, n) => {
1573
- Se(t, e != null ? e.toString() : void 0, n);
1574
- }, Es = (t) => As(window.location.href, t), Ms = (t, e) => {
1575
- const n = Pe(t, e);
1576
- return n ? parseInt(n) : void 0;
1577
- }, Is = (t, e, n) => {
1578
- ln(t, e, n);
1579
- }, Cs = (t) => Ms(window.location.href, t), $s = (t, e) => Pe(t, e) === "true", xs = (t, e, n) => {
1580
- Se(t, e ? "true" : void 0, n);
1581
- }, Ls = (t) => $s(window.location.href, t), Ts = (t, e) => {
1582
- const n = Pe(t, e);
1583
- return n && n !== "" ? an(n) : void 0;
1584
- }, Ps = (t, e, n) => {
1585
- const s = e == null ? void 0 : on(e);
1586
- Se(t, s, n);
1587
- }, Ds = (t) => Ts(window.location.href, t);
1588
- var ks = function(t, e) {
1561
+ return !n && !a ? "" : `${n || ""}${a ? "?" + a : ""}`;
1562
+ }, Rt = (t, e) => {
1563
+ const s = Pe(t, e);
1564
+ if (s && s !== "")
1565
+ return bn(s);
1566
+ }, Rn = (t, e, s) => {
1567
+ const n = e ? _n(e) : void 0;
1568
+ Se(t, n, s);
1569
+ }, Sn = (t) => Rt(window.location.href, t), An = (t, e) => {
1570
+ const s = Pe(t, e);
1571
+ return s ? parseFloat(s) : void 0;
1572
+ }, cs = (t, e, s) => {
1573
+ Se(t, e != null ? e.toString() : void 0, s);
1574
+ }, En = (t) => An(window.location.href, t), Mn = (t, e) => {
1575
+ const s = Pe(t, e);
1576
+ return s ? parseInt(s) : void 0;
1577
+ }, In = (t, e, s) => {
1578
+ cs(t, e, s);
1579
+ }, Cn = (t) => Mn(window.location.href, t), $n = (t, e) => Pe(t, e) === "true", xn = (t, e, s) => {
1580
+ Se(t, e ? "true" : void 0, s);
1581
+ }, Ln = (t) => $n(window.location.href, t), Tn = (t, e) => {
1582
+ const s = Pe(t, e);
1583
+ return s && s !== "" ? os(s) : void 0;
1584
+ }, Pn = (t, e, s) => {
1585
+ const n = e == null ? void 0 : rs(e);
1586
+ Se(t, n, s);
1587
+ }, Dn = (t) => Tn(window.location.href, t);
1588
+ var kn = function(t, e) {
1589
1589
  e || (e = {}), typeof e == "function" && (e = { cmp: e });
1590
- var n = typeof e.cycles == "boolean" ? e.cycles : !1, s = e.cmp && function(o) {
1590
+ var s = typeof e.cycles == "boolean" ? e.cycles : !1, n = e.cmp && function(o) {
1591
1591
  return function(r) {
1592
1592
  return function(a, u) {
1593
1593
  var l = { key: a, value: r[a] }, c = { key: u, value: r[u] };
@@ -1610,37 +1610,37 @@ var ks = function(t, e) {
1610
1610
  if (r === null)
1611
1611
  return "null";
1612
1612
  if (i.indexOf(r) !== -1) {
1613
- if (n)
1613
+ if (s)
1614
1614
  return JSON.stringify("__cycle__");
1615
1615
  throw new TypeError("Converting circular structure to JSON");
1616
1616
  }
1617
- var l = i.push(r) - 1, c = Object.keys(r).sort(s && s(r));
1617
+ var l = i.push(r) - 1, c = Object.keys(r).sort(n && n(r));
1618
1618
  for (u = "", a = 0; a < c.length; a++) {
1619
- var d = c[a], g = o(r[d]);
1620
- g && (u && (u += ","), u += JSON.stringify(d) + ":" + g);
1619
+ var d = c[a], _ = o(r[d]);
1620
+ _ && (u && (u += ","), u += JSON.stringify(d) + ":" + _);
1621
1621
  }
1622
1622
  return i.splice(l, 1), "{" + u + "}";
1623
1623
  }
1624
1624
  }(t);
1625
1625
  };
1626
- const fn = /* @__PURE__ */ mt(ks);
1626
+ const ls = /* @__PURE__ */ mt(kn);
1627
1627
  var xe;
1628
1628
  (function(t) {
1629
1629
  t.mp_debug = "mp_debug";
1630
1630
  })(xe || (xe = {}));
1631
- const Hs = () => {
1631
+ const Hn = () => {
1632
1632
  try {
1633
1633
  return window !== window.top;
1634
1634
  } catch {
1635
1635
  return !1;
1636
1636
  }
1637
- }, pn = {
1637
+ }, fs = {
1638
1638
  version: Le,
1639
1639
  metaframes: {}
1640
1640
  };
1641
- class Ns extends Rt.EventEmitter {
1641
+ class Nn extends Ot.EventEmitter {
1642
1642
  constructor() {
1643
- super(), this._definition = pn, this.getDefinition = this.getDefinition.bind(this);
1643
+ super(), this._definition = fs, this.getDefinition = this.getDefinition.bind(this);
1644
1644
  }
1645
1645
  error(e) {
1646
1646
  throw "Subclass should implement";
@@ -1649,31 +1649,31 @@ class Ns extends Rt.EventEmitter {
1649
1649
  return this._definition;
1650
1650
  }
1651
1651
  }
1652
- const Ge = (t, e) => e ? C(t, (n) => {
1653
- Object.keys(e).forEach((s) => {
1654
- e[s] === void 0 ? delete n[s] : n[s] = e[s];
1652
+ const Je = (t, e) => e ? C(t, (s) => {
1653
+ Object.keys(e).forEach((n) => {
1654
+ e[n] === void 0 ? delete s[n] : s[n] = e[n];
1655
1655
  });
1656
1656
  }) : t, Ni = (t) => window.location.search ? new URLSearchParams(window.location.search).get(t) : null, ji = () => new URLSearchParams(window.location.search).has(xe.mp_debug), ht = () => {
1657
1657
  const t = new URLSearchParams(window.location.search).get(xe.mp_debug);
1658
1658
  return t === "true" || t === "1";
1659
- }, Ui = (t = 8) => St(t), js = (t = 8) => St(t), Bi = (t = 8) => St(t), Nt = "abcdefghijklmnopqrstuvwxyz0123456789", St = (t = 8) => {
1660
- for (var e = "", n = Nt.length, s = 0; s < t; s++)
1661
- e += Nt.charAt(Math.floor(Math.random() * n));
1659
+ }, Ui = (t = 8) => St(t), jn = (t = 8) => St(t), Bi = (t = 8) => St(t), Nt = "abcdefghijklmnopqrstuvwxyz0123456789", St = (t = 8) => {
1660
+ for (var e = "", s = Nt.length, n = 0; n < t; n++)
1661
+ e += Nt.charAt(Math.floor(Math.random() * s));
1662
1662
  return e;
1663
- }, At = (t, e, n) => {
1663
+ }, At = (t, e, s) => {
1664
1664
  e = e || "000", e && e.trim() == "" && (e = void 0);
1665
- let s;
1666
- if (typeof t == "string" ? s = t : typeof t == "number" ? s = t + "" : s = JSON.stringify(t, null, " "), e && e.trim() != "") {
1665
+ let n;
1666
+ if (typeof t == "string" ? n = t : typeof t == "number" ? n = t + "" : n = JSON.stringify(t, null, " "), e && e.trim() != "") {
1667
1667
  var i = `color: #${e}`;
1668
- n && (i = `${i}; background: #${n}`), s = `%c${s}`, window.console.log(s, i);
1668
+ s && (i = `${i}; background: #${s}`), n = `%c${n}`, window.console.log(n, i);
1669
1669
  } else
1670
- window.console.log(s);
1671
- }, hn = (t) => Bs(Us(t)), Us = (t) => {
1670
+ window.console.log(n);
1671
+ }, ps = (t) => Bn(Un(t)), Un = (t) => {
1672
1672
  var e = 0;
1673
- for (let n = 0; n < t.length; n++)
1674
- e = t.charCodeAt(n) + ((e << 5) - e);
1673
+ for (let s = 0; s < t.length; s++)
1674
+ e = t.charCodeAt(s) + ((e << 5) - e);
1675
1675
  return e;
1676
- }, Bs = (t) => {
1676
+ }, Bn = (t) => {
1677
1677
  var e = (t & 16777215).toString(16).toUpperCase();
1678
1678
  return "00000".substring(0, 6 - e.length) + e;
1679
1679
  }, tt = () => document.readyState == "complete" || document.readyState == "interactive", Xe = async () => tt() ? Promise.resolve() : new Promise((t) => {
@@ -1688,18 +1688,18 @@ const Ge = (t, e) => e ? C(t, (n) => {
1688
1688
  !e && tt() && (e = !0, t());
1689
1689
  }, 200);
1690
1690
  }), Fi = async (t) => {
1691
- const e = fn(t);
1692
- return await dn(e);
1691
+ const e = ls(t);
1692
+ return await hs(e);
1693
1693
  }, zi = async (t) => {
1694
- const e = fn({
1694
+ const e = ls({
1695
1695
  version: t.version,
1696
1696
  metaframes: t.metaframes
1697
1697
  });
1698
- return await dn(e);
1698
+ return await hs(e);
1699
1699
  };
1700
- async function dn(t) {
1701
- const n = new TextEncoder().encode(t), s = await crypto.subtle.digest("SHA-256", n);
1702
- return btoa(String.fromCharCode(...new Uint8Array(s)));
1700
+ async function hs(t) {
1701
+ const s = new TextEncoder().encode(t), n = await crypto.subtle.digest("SHA-256", s);
1702
+ return btoa(String.fromCharCode(...new Uint8Array(n)));
1703
1703
  }
1704
1704
  var ae;
1705
1705
  (function(t) {
@@ -1709,48 +1709,48 @@ var z;
1709
1709
  (function(t) {
1710
1710
  t.Connected = "connected", t.Error = "error", t.Input = "input", t.Inputs = "inputs", t.Message = "message";
1711
1711
  })(z || (z = {}));
1712
- class ie extends Rt.EventEmitter {
1712
+ class ie extends Ot.EventEmitter {
1713
1713
  constructor(e) {
1714
- if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = ae.WaitingForPageLoad, this._messageSendCount = 0, this.debug = ht(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = ht(), this._isIframe = Hs(), 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) {
1714
+ if (super(), this._inputPipeValues = {}, this._outputPipeValues = {}, this._state = ae.WaitingForPageLoad, this._messageSendCount = 0, this.debug = ht(), this.isInputOutputBlobSerialization = !0, this.id = window.name, this.debug = ht(), this._isIframe = Hn(), 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) {
1715
1715
  this.log("Not an iframe, metaframe code disabled");
1716
1716
  return;
1717
1717
  }
1718
- const n = this;
1718
+ const s = this;
1719
1719
  Xe().then(() => {
1720
- this.log("pageLoaded"), window.addEventListener("message", this.onMessage), n.sendRpc(q.SetupIframeClientRequest, {
1720
+ this.log("pageLoaded"), window.addEventListener("message", this.onMessage), s.sendRpc(X.SetupIframeClientRequest, {
1721
1721
  version: ie.version
1722
- }), n._state = ae.SentSetupIframeClientRequest;
1722
+ }), s._state = ae.SentSetupIframeClientRequest;
1723
1723
  }), e && e.disableHashChangeEvent || window.addEventListener("hashchange", this._onHashUrlChange);
1724
1724
  }
1725
1725
  _resolveSetupIframeServerResponse(e) {
1726
1726
  if (this._state === ae.WaitingForPageLoad)
1727
1727
  throw "Got message but page has not finished loading, we should never get in this state";
1728
- (async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = hn(this.id), this._parentId = e.parentId, this.log(`metapage[${this._parentId}](v${this._parentVersion ? this._parentVersion : "unknown"}) registered`), e.state && e.state.inputs && (this.isInputOutputBlobSerialization ? this._inputPipeValues = await Ce(e.state.inputs) : this._inputPipeValues = e.state.inputs), this._state = ae.Ready, this.sendRpc(q.SetupIframeServerResponseAck, {
1728
+ (async () => this._parentId ? this.log("Got JsonRpcMethods.SetupIframeServerResponse but already resolved") : (this._parentVersion = e.version, this.color = ps(this.id), this._parentId = e.parentId, this.log(`metapage[${this._parentId}](v${this._parentVersion ? this._parentVersion : "unknown"}) registered`), e.state && e.state.inputs && (this.isInputOutputBlobSerialization ? this._inputPipeValues = await Ce(e.state.inputs) : this._inputPipeValues = e.state.inputs), this._state = ae.Ready, this.sendRpc(X.SetupIframeServerResponseAck, {
1729
1729
  version: ie.version
1730
- }), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(z.Inputs, this._inputPipeValues), this.listenerCount(z.Input) > 0 && Object.keys(this._inputPipeValues).forEach((n) => this.emit(z.Input, n, this._inputPipeValues[n]))), this.emit(z.Connected), this.sendRpc(q.OutputsUpdate, this._outputPipeValues)))();
1730
+ }), this._inputPipeValues && Object.keys(this._inputPipeValues).length > 0 && (this.emit(z.Inputs, this._inputPipeValues), this.listenerCount(z.Input) > 0 && Object.keys(this._inputPipeValues).forEach((s) => this.emit(z.Input, s, this._inputPipeValues[s]))), this.emit(z.Connected), this.sendRpc(X.OutputsUpdate, this._outputPipeValues)))();
1731
1731
  }
1732
1732
  isConnected() {
1733
1733
  return this._state === ae.Ready;
1734
1734
  }
1735
1735
  async connected() {
1736
- return new Promise((e, n) => {
1736
+ return new Promise((e, s) => {
1737
1737
  if (this._state === ae.Ready) {
1738
1738
  e();
1739
1739
  return;
1740
1740
  }
1741
- let s;
1742
- s = this.addListenerReturnDisposer(z.Connected, () => {
1743
- e(), s();
1741
+ let n;
1742
+ n = this.addListenerReturnDisposer(z.Connected, () => {
1743
+ e(), n();
1744
1744
  });
1745
1745
  });
1746
1746
  }
1747
- addListenerReturnDisposer(e, n) {
1748
- return super.addListener(e, n), () => {
1749
- super.removeListener(e, n);
1747
+ addListenerReturnDisposer(e, s) {
1748
+ return super.addListener(e, s), () => {
1749
+ super.removeListener(e, s);
1750
1750
  };
1751
1751
  }
1752
- log(e, n, s) {
1753
- this.debug && this.logInternal(e, n || this.color);
1752
+ log(e, s, n) {
1753
+ this.debug && this.logInternal(e, s || this.color);
1754
1754
  }
1755
1755
  warn(e) {
1756
1756
  this.debug && this.logInternal(e, "000", this.color);
@@ -1758,48 +1758,48 @@ class ie extends Rt.EventEmitter {
1758
1758
  error(e) {
1759
1759
  this.logInternal(e, this.color, "f00");
1760
1760
  }
1761
- logInternal(e, n, s) {
1761
+ logInternal(e, s, n) {
1762
1762
  let i;
1763
- typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), n = n && n + "", i = (this.id ? `Metaframe[${this.id}] ` : "") + `${i}`, At(i, n, s);
1763
+ typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), s = s && s + "", i = (this.id ? `Metaframe[${this.id}] ` : "") + `${i}`, At(i, s, n);
1764
1764
  }
1765
1765
  dispose() {
1766
1766
  super.removeAllListeners(), window.removeEventListener("message", this.onMessage), this.disableNotifyOnHashUrlChange(), this._inputPipeValues = void 0, this._outputPipeValues = void 0;
1767
1767
  }
1768
- addListener(e, n) {
1769
- return super.addListener(e, n), e === z.Inputs && window.setTimeout(() => {
1770
- this._inputPipeValues && n(this._inputPipeValues);
1768
+ addListener(e, s) {
1769
+ return super.addListener(e, s), e === z.Inputs && window.setTimeout(() => {
1770
+ this._inputPipeValues && s(this._inputPipeValues);
1771
1771
  }, 0), this;
1772
1772
  }
1773
- onInput(e, n) {
1774
- return this.addListenerReturnDisposer(z.Input, (s, i) => {
1775
- e === s && n(i);
1773
+ onInput(e, s) {
1774
+ return this.addListenerReturnDisposer(z.Input, (n, i) => {
1775
+ e === n && s(i);
1776
1776
  });
1777
1777
  }
1778
1778
  onInputs(e) {
1779
1779
  return this.addListenerReturnDisposer(z.Inputs, e);
1780
1780
  }
1781
- setInput(e, n) {
1782
- var s = {};
1783
- s[e] = n, this.setInputs(s);
1781
+ setInput(e, s) {
1782
+ var n = {};
1783
+ n[e] = s, this.setInputs(n);
1784
1784
  }
1785
1785
  async setInputs(e) {
1786
- this.isInputOutputBlobSerialization && (e = await Ce(e)), this.sendRpc(q.InputsUpdate, e);
1786
+ this.isInputOutputBlobSerialization && (e = await Ce(e)), this.sendRpc(X.InputsUpdate, e);
1787
1787
  }
1788
1788
  async setInternalInputsAndNotify(e) {
1789
1789
  this.isInputOutputBlobSerialization && (e = await Ce(e));
1790
- const n = e;
1791
- if (this._inputPipeValues = Ge(this._inputPipeValues, e), this._inputPipeValues !== n) {
1792
- Object.keys(e).forEach((s) => {
1790
+ const s = e;
1791
+ if (this._inputPipeValues = Je(this._inputPipeValues, e), this._inputPipeValues !== s) {
1792
+ Object.keys(e).forEach((n) => {
1793
1793
  try {
1794
- this.emit(z.Input, s, e[s]);
1794
+ this.emit(z.Input, n, e[n]);
1795
1795
  } catch (i) {
1796
- console.error(`Error emitting input ${s}: ${i}`), this.emit(z.Error, `Error emitting input ${s}: ${i}`);
1796
+ console.error(`Error emitting input ${n}: ${i}`), this.emit(z.Error, `Error emitting input ${n}: ${i}`);
1797
1797
  }
1798
1798
  });
1799
1799
  try {
1800
1800
  this.emit(z.Inputs, e);
1801
- } catch (s) {
1802
- console.error(`Error emitting inputs: ${s}`), this.emit(z.Error, `Error emitting inputs: ${s}`);
1801
+ } catch (n) {
1802
+ console.error(`Error emitting inputs: ${n}`), this.emit(z.Error, `Error emitting inputs: ${n}`);
1803
1803
  }
1804
1804
  }
1805
1805
  }
@@ -1809,110 +1809,110 @@ class ie extends Rt.EventEmitter {
1809
1809
  getInputs() {
1810
1810
  return this._inputPipeValues;
1811
1811
  }
1812
- setOutput(e, n) {
1812
+ setOutput(e, s) {
1813
1813
  console.assert(!!e);
1814
- var s = {};
1815
- s[e] = n, this.setOutputs(s);
1814
+ var n = {};
1815
+ n[e] = s, this.setOutputs(n);
1816
1816
  }
1817
1817
  async setOutputs(e) {
1818
1818
  this.isInputOutputBlobSerialization && (e = await Ke(e));
1819
- const n = e;
1820
- this._outputPipeValues = Ge(this._outputPipeValues, e), this._outputPipeValues !== n && this._state === ae.Ready && this.sendRpc(q.OutputsUpdate, e);
1819
+ const s = e;
1820
+ this._outputPipeValues = Je(this._outputPipeValues, e), this._outputPipeValues !== s && this._state === ae.Ready && this.sendRpc(X.OutputsUpdate, e);
1821
1821
  }
1822
1822
  disableNotifyOnHashUrlChange() {
1823
1823
  window.removeEventListener("hashchange", this._onHashUrlChange);
1824
1824
  }
1825
1825
  _onHashUrlChange(e) {
1826
- const n = {
1826
+ const s = {
1827
1827
  hash: window.location.hash,
1828
1828
  metaframe: this.id
1829
1829
  };
1830
- this.sendRpc(q.HashParamsUpdate, n);
1830
+ this.sendRpc(X.HashParamsUpdate, s);
1831
1831
  }
1832
- sendRpc(e, n) {
1832
+ sendRpc(e, s) {
1833
1833
  if (this._isIframe) {
1834
- const s = {
1834
+ const n = {
1835
1835
  jsonrpc: "2.0",
1836
1836
  id: ++this._messageSendCount,
1837
1837
  method: e,
1838
- params: n,
1838
+ params: s,
1839
1839
  iframeId: this.id,
1840
1840
  parentId: this._parentId
1841
1841
  };
1842
- window.parent && window.parent.postMessage(s, "*");
1842
+ window.parent && window.parent.postMessage(n, "*");
1843
1843
  } else
1844
1844
  this.log("Cannot send JSON-RPC window message: there is no window.parent which means we are not an iframe");
1845
1845
  }
1846
1846
  onMessage(e) {
1847
1847
  if (typeof e.data == "object") {
1848
- let s = e.data;
1849
- if (s.jsonrpc === "2.0") {
1850
- var n = s.method;
1851
- if (!(n == "SetupIframeServerResponse" || s.parentId == this._parentId && s.iframeId == this.id)) {
1852
- this.log(`window.message: received message (method=${n}) but jsonrpc.parentId=${s.parentId} _parentId=${this._parentId} jsonrpc.iframeId=${s.iframeId} id=${this.id}`);
1848
+ let n = e.data;
1849
+ if (n.jsonrpc === "2.0") {
1850
+ var s = n.method;
1851
+ if (!(s == "SetupIframeServerResponse" || n.parentId == this._parentId && n.iframeId == this.id)) {
1852
+ this.log(`window.message: received message (method=${s}) but jsonrpc.parentId=${n.parentId} _parentId=${this._parentId} jsonrpc.iframeId=${n.iframeId} id=${this.id}`);
1853
1853
  return;
1854
1854
  }
1855
- switch (n) {
1855
+ switch (s) {
1856
1856
  case me.SetupIframeServerResponse:
1857
- this._resolveSetupIframeServerResponse(s.params);
1857
+ this._resolveSetupIframeServerResponse(n.params);
1858
1858
  break;
1859
1859
  case me.InputsUpdate:
1860
1860
  if (this._state !== ae.Ready)
1861
1861
  throw "Got InputsUpdate but metaframe is not MetaframeLoadingState.Ready";
1862
- this.setInternalInputsAndNotify(s.params.inputs);
1862
+ this.setInternalInputsAndNotify(n.params.inputs);
1863
1863
  break;
1864
1864
  case me.MessageAck:
1865
- this.debug && this.log(`ACK: ${JSON.stringify(s)}`);
1865
+ this.debug && this.log(`ACK: ${JSON.stringify(n)}`);
1866
1866
  break;
1867
1867
  default:
1868
- this.debug && this.log(`window.message: unknown JSON-RPC method: ${JSON.stringify(s)}`);
1868
+ this.debug && this.log(`window.message: unknown JSON-RPC method: ${JSON.stringify(n)}`);
1869
1869
  break;
1870
1870
  }
1871
- this.listenerCount(z.Message) > 0 && this.emit(z.Message, s);
1871
+ this.listenerCount(z.Message) > 0 && this.emit(z.Message, n);
1872
1872
  }
1873
1873
  }
1874
1874
  }
1875
- setParameter(e, n) {
1876
- Se(e, n);
1875
+ setParameter(e, s) {
1876
+ Se(e, s);
1877
1877
  }
1878
1878
  getParameter(e) {
1879
- return ws(e);
1879
+ return wn(e);
1880
1880
  }
1881
- setParameterBoolean(e, n) {
1882
- xs(e, n);
1881
+ setParameterBoolean(e, s) {
1882
+ xn(e, s);
1883
1883
  }
1884
1884
  getParameterBoolean(e) {
1885
- return Ls(e);
1885
+ return Ln(e);
1886
1886
  }
1887
- setParameterJson(e, n) {
1888
- Os(e, n);
1887
+ setParameterJson(e, s) {
1888
+ Rn(e, s);
1889
1889
  }
1890
1890
  getParameterJson(e) {
1891
- return Ss(e);
1891
+ return Sn(e);
1892
1892
  }
1893
- setParameterBase64(e, n) {
1894
- Ps(e, n);
1893
+ setParameterBase64(e, s) {
1894
+ Pn(e, s);
1895
1895
  }
1896
1896
  getParameterBase64(e) {
1897
- return Ds(e);
1897
+ return Dn(e);
1898
1898
  }
1899
- setParameterFloat(e, n) {
1900
- ln(e, n);
1899
+ setParameterFloat(e, s) {
1900
+ cs(e, s);
1901
1901
  }
1902
1902
  getParameterFloat(e) {
1903
- return Es(e);
1903
+ return En(e);
1904
1904
  }
1905
- setParameterInt(e, n) {
1906
- Is(e, n);
1905
+ setParameterInt(e, s) {
1906
+ In(e, s);
1907
1907
  }
1908
1908
  getParameterInt(e) {
1909
- return Cs(e);
1909
+ return Cn(e);
1910
1910
  }
1911
1911
  deleteParameter(e) {
1912
1912
  Se(e, void 0);
1913
1913
  }
1914
1914
  }
1915
- ie.version = En;
1915
+ ie.version = As;
1916
1916
  ie.ERROR = z.Error;
1917
1917
  ie.CONNECTED = z.Connected;
1918
1918
  ie.INPUT = z.Input;
@@ -1921,25 +1921,25 @@ ie.MESSAGE = z.Message;
1921
1921
  ie.deserializeInputs = Ce;
1922
1922
  ie.serializeInputs = Ke;
1923
1923
  var qe = {};
1924
- const oe = "\\\\/", jt = `[^${oe}]`, le = "\\.", Fs = "\\+", zs = "\\?", Qe = "\\/", Gs = "(?=.)", mn = "[^/]", Et = `(?:${Qe}|$)`, yn = `(?:^|${Qe})`, Mt = `${le}{1,2}${Et}`, Vs = `(?!${le})`, Js = `(?!${yn}${Mt})`, Ws = `(?!${le}{0,1}${Et})`, Ks = `(?!${Mt})`, Xs = `[^.${Qe}]`, qs = `${mn}*?`, Qs = "/", gn = {
1924
+ const oe = "\\\\/", jt = `[^${oe}]`, le = "\\.", Fn = "\\+", zn = "\\?", Qe = "\\/", Jn = "(?=.)", ds = "[^/]", Et = `(?:${Qe}|$)`, ms = `(?:^|${Qe})`, Mt = `${le}{1,2}${Et}`, Gn = `(?!${le})`, Vn = `(?!${ms}${Mt})`, Wn = `(?!${le}{0,1}${Et})`, Kn = `(?!${Mt})`, Xn = `[^.${Qe}]`, qn = `${ds}*?`, Qn = "/", ys = {
1925
1925
  DOT_LITERAL: le,
1926
- PLUS_LITERAL: Fs,
1927
- QMARK_LITERAL: zs,
1926
+ PLUS_LITERAL: Fn,
1927
+ QMARK_LITERAL: zn,
1928
1928
  SLASH_LITERAL: Qe,
1929
- ONE_CHAR: Gs,
1930
- QMARK: mn,
1929
+ ONE_CHAR: Jn,
1930
+ QMARK: ds,
1931
1931
  END_ANCHOR: Et,
1932
1932
  DOTS_SLASH: Mt,
1933
- NO_DOT: Vs,
1934
- NO_DOTS: Js,
1935
- NO_DOT_SLASH: Ws,
1936
- NO_DOTS_SLASH: Ks,
1937
- QMARK_NO_DOT: Xs,
1938
- STAR: qs,
1939
- START_ANCHOR: yn,
1940
- SEP: Qs
1941
- }, Ys = {
1942
- ...gn,
1933
+ NO_DOT: Gn,
1934
+ NO_DOTS: Vn,
1935
+ NO_DOT_SLASH: Wn,
1936
+ NO_DOTS_SLASH: Kn,
1937
+ QMARK_NO_DOT: Xn,
1938
+ STAR: qn,
1939
+ START_ANCHOR: ms,
1940
+ SEP: Qn
1941
+ }, Yn = {
1942
+ ...ys,
1943
1943
  SLASH_LITERAL: `[${oe}]`,
1944
1944
  QMARK: jt,
1945
1945
  STAR: `${jt}*?`,
@@ -1952,7 +1952,7 @@ const oe = "\\\\/", jt = `[^${oe}]`, le = "\\.", Fs = "\\+", zs = "\\?", Qe = "\
1952
1952
  START_ANCHOR: `(?:^|[${oe}])`,
1953
1953
  END_ANCHOR: `(?:[${oe}]|$)`,
1954
1954
  SEP: "\\"
1955
- }, Zs = {
1955
+ }, Zn = {
1956
1956
  alnum: "a-zA-Z0-9",
1957
1957
  alpha: "a-zA-Z",
1958
1958
  ascii: "\\x00-\\x7F",
@@ -1970,7 +1970,7 @@ const oe = "\\\\/", jt = `[^${oe}]`, le = "\\.", Fs = "\\+", zs = "\\?", Qe = "\
1970
1970
  };
1971
1971
  var Ye = {
1972
1972
  MAX_LENGTH: 1024 * 64,
1973
- POSIX_REGEX_SOURCE: Zs,
1973
+ POSIX_REGEX_SOURCE: Zn,
1974
1974
  // regular expressions
1975
1975
  REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
1976
1976
  REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
@@ -2089,17 +2089,17 @@ var Ye = {
2089
2089
  * Create GLOB_CHARS
2090
2090
  */
2091
2091
  globChars(t) {
2092
- return t === !0 ? Ys : gn;
2092
+ return t === !0 ? Yn : ys;
2093
2093
  }
2094
2094
  };
2095
2095
  (function(t) {
2096
2096
  const {
2097
2097
  REGEX_BACKSLASH: e,
2098
- REGEX_REMOVE_BACKSLASH: n,
2099
- REGEX_SPECIAL_CHARS: s,
2098
+ REGEX_REMOVE_BACKSLASH: s,
2099
+ REGEX_SPECIAL_CHARS: n,
2100
2100
  REGEX_SPECIAL_CHARS_GLOBAL: i
2101
2101
  } = Ye;
2102
- t.isObject = (o) => o !== null && typeof o == "object" && !Array.isArray(o), t.hasRegexChars = (o) => s.test(o), t.isRegexChar = (o) => o.length === 1 && t.hasRegexChars(o), t.escapeRegex = (o) => o.replace(i, "\\$1"), t.toPosixSlashes = (o) => o.replace(e, "/"), t.removeBackslashes = (o) => o.replace(n, (r) => r === "\\" ? "" : r), t.supportsLookbehinds = () => {
2102
+ t.isObject = (o) => o !== null && typeof o == "object" && !Array.isArray(o), t.hasRegexChars = (o) => n.test(o), t.isRegexChar = (o) => o.length === 1 && t.hasRegexChars(o), t.escapeRegex = (o) => o.replace(i, "\\$1"), t.toPosixSlashes = (o) => o.replace(e, "/"), t.removeBackslashes = (o) => o.replace(s, (r) => r === "\\" ? "" : r), t.supportsLookbehinds = () => {
2103
2103
  const o = process.version.slice(1).split(".").map(Number);
2104
2104
  return o.length === 3 && o[0] >= 9 || o[0] === 8 && o[1] >= 10;
2105
2105
  }, t.escapeLast = (o, r, a) => {
@@ -2115,7 +2115,7 @@ var Ye = {
2115
2115
  }, t.basename = (o, { windows: r } = {}) => r ? o.replace(/[\\/]$/, "").replace(/.*[\\/]/, "") : o.replace(/\/$/, "").replace(/.*\//, "");
2116
2116
  })(qe);
2117
2117
  const Ut = qe, {
2118
- CHAR_ASTERISK: nt,
2118
+ CHAR_ASTERISK: st,
2119
2119
  /* * */
2120
2120
  CHAR_AT: ei,
2121
2121
  /* @ */
@@ -2123,19 +2123,19 @@ const Ut = qe, {
2123
2123
  /* \ */
2124
2124
  CHAR_COMMA: ti,
2125
2125
  /* , */
2126
- CHAR_DOT: st,
2126
+ CHAR_DOT: nt,
2127
2127
  /* . */
2128
2128
  CHAR_EXCLAMATION_MARK: Bt,
2129
2129
  /* ! */
2130
- CHAR_FORWARD_SLASH: _n,
2130
+ CHAR_FORWARD_SLASH: gs,
2131
2131
  /* / */
2132
2132
  CHAR_LEFT_CURLY_BRACE: it,
2133
2133
  /* { */
2134
2134
  CHAR_LEFT_PARENTHESES: rt,
2135
2135
  /* ( */
2136
- CHAR_LEFT_SQUARE_BRACKET: ni,
2136
+ CHAR_LEFT_SQUARE_BRACKET: si,
2137
2137
  /* [ */
2138
- CHAR_PLUS: si,
2138
+ CHAR_PLUS: ni,
2139
2139
  /* + */
2140
2140
  CHAR_QUESTION_MARK: Ft,
2141
2141
  /* ? */
@@ -2145,41 +2145,41 @@ const Ut = qe, {
2145
2145
  /* ) */
2146
2146
  CHAR_RIGHT_SQUARE_BRACKET: ri
2147
2147
  /* ] */
2148
- } = Ye, Gt = (t) => t === _n || t === Me, Vt = (t) => {
2148
+ } = Ye, Jt = (t) => t === gs || t === Me, Gt = (t) => {
2149
2149
  t.isPrefix !== !0 && (t.depth = t.isGlobstar ? 1 / 0 : 1);
2150
2150
  }, oi = (t, e) => {
2151
- const n = e || {}, s = t.length - 1, i = n.parts === !0 || n.scanToEnd === !0, o = [], r = [], a = [];
2152
- let u = t, l = -1, c = 0, d = 0, g = !1, v = !1, y = !1, R = !1, w = !1, $ = !1, b = !1, A = !1, E = !1, O = 0, H, S, L = { value: "", depth: 0, isGlob: !1 };
2153
- const U = () => l >= s, f = () => u.charCodeAt(l + 1), M = () => (H = S, u.charCodeAt(++l));
2154
- for (; l < s; ) {
2155
- S = M();
2151
+ const s = e || {}, n = t.length - 1, i = s.parts === !0 || s.scanToEnd === !0, o = [], r = [], a = [];
2152
+ let u = t, l = -1, c = 0, d = 0, _ = !1, v = !1, m = !1, S = !1, w = !1, $ = !1, b = !1, A = !1, E = !1, O = 0, H, R, L = { value: "", depth: 0, isGlob: !1 };
2153
+ const U = () => l >= n, f = () => u.charCodeAt(l + 1), M = () => (H = R, u.charCodeAt(++l));
2154
+ for (; l < n; ) {
2155
+ R = M();
2156
2156
  let W;
2157
- if (S === Me) {
2158
- b = L.backslashes = !0, S = M(), S === it && ($ = !0);
2157
+ if (R === Me) {
2158
+ b = L.backslashes = !0, R = M(), R === it && ($ = !0);
2159
2159
  continue;
2160
2160
  }
2161
- if ($ === !0 || S === it) {
2162
- for (O++; U() !== !0 && (S = M()); ) {
2163
- if (S === Me) {
2161
+ if ($ === !0 || R === it) {
2162
+ for (O++; U() !== !0 && (R = M()); ) {
2163
+ if (R === Me) {
2164
2164
  b = L.backslashes = !0, M();
2165
2165
  continue;
2166
2166
  }
2167
- if (S === it) {
2167
+ if (R === it) {
2168
2168
  O++;
2169
2169
  continue;
2170
2170
  }
2171
- if ($ !== !0 && S === st && (S = M()) === st) {
2172
- if (g = L.isBrace = !0, y = L.isGlob = !0, E = !0, i === !0)
2171
+ if ($ !== !0 && R === nt && (R = M()) === nt) {
2172
+ if (_ = L.isBrace = !0, m = L.isGlob = !0, E = !0, i === !0)
2173
2173
  continue;
2174
2174
  break;
2175
2175
  }
2176
- if ($ !== !0 && S === ti) {
2177
- if (g = L.isBrace = !0, y = L.isGlob = !0, E = !0, i === !0)
2176
+ if ($ !== !0 && R === ti) {
2177
+ if (_ = L.isBrace = !0, m = L.isGlob = !0, E = !0, i === !0)
2178
2178
  continue;
2179
2179
  break;
2180
2180
  }
2181
- if (S === ii && (O--, O === 0)) {
2182
- $ = !1, g = L.isBrace = !0, E = !0;
2181
+ if (R === ii && (O--, O === 0)) {
2182
+ $ = !1, _ = L.isBrace = !0, E = !0;
2183
2183
  break;
2184
2184
  }
2185
2185
  }
@@ -2187,25 +2187,25 @@ const Ut = qe, {
2187
2187
  continue;
2188
2188
  break;
2189
2189
  }
2190
- if (S === _n) {
2190
+ if (R === gs) {
2191
2191
  if (o.push(l), r.push(L), L = { value: "", depth: 0, isGlob: !1 }, E === !0)
2192
2192
  continue;
2193
- if (H === st && l === c + 1) {
2193
+ if (H === nt && l === c + 1) {
2194
2194
  c += 2;
2195
2195
  continue;
2196
2196
  }
2197
2197
  d = l + 1;
2198
2198
  continue;
2199
2199
  }
2200
- if (n.noext !== !0 && (S === si || S === ei || S === nt || S === Ft || S === Bt) === !0 && f() === rt) {
2201
- if (y = L.isGlob = !0, R = L.isExtglob = !0, E = !0, i === !0) {
2202
- for (; U() !== !0 && (S = M()); ) {
2203
- if (S === Me) {
2204
- b = L.backslashes = !0, S = M();
2200
+ if (s.noext !== !0 && (R === ni || R === ei || R === st || R === Ft || R === Bt) === !0 && f() === rt) {
2201
+ if (m = L.isGlob = !0, S = L.isExtglob = !0, E = !0, i === !0) {
2202
+ for (; U() !== !0 && (R = M()); ) {
2203
+ if (R === Me) {
2204
+ b = L.backslashes = !0, R = M();
2205
2205
  continue;
2206
2206
  }
2207
- if (S === zt) {
2208
- y = L.isGlob = !0, E = !0;
2207
+ if (R === zt) {
2208
+ m = L.isGlob = !0, E = !0;
2209
2209
  break;
2210
2210
  }
2211
2211
  }
@@ -2213,40 +2213,40 @@ const Ut = qe, {
2213
2213
  }
2214
2214
  break;
2215
2215
  }
2216
- if (S === nt) {
2217
- if (H === nt && (w = L.isGlobstar = !0), y = L.isGlob = !0, E = !0, i === !0)
2216
+ if (R === st) {
2217
+ if (H === st && (w = L.isGlobstar = !0), m = L.isGlob = !0, E = !0, i === !0)
2218
2218
  continue;
2219
2219
  break;
2220
2220
  }
2221
- if (S === Ft) {
2222
- if (y = L.isGlob = !0, E = !0, i === !0)
2221
+ if (R === Ft) {
2222
+ if (m = L.isGlob = !0, E = !0, i === !0)
2223
2223
  continue;
2224
2224
  break;
2225
2225
  }
2226
- if (S === ni)
2226
+ if (R === si)
2227
2227
  for (; U() !== !0 && (W = M()); ) {
2228
2228
  if (W === Me) {
2229
2229
  b = L.backslashes = !0, M();
2230
2230
  continue;
2231
2231
  }
2232
2232
  if (W === ri) {
2233
- if (v = L.isBracket = !0, y = L.isGlob = !0, E = !0, i === !0)
2233
+ if (v = L.isBracket = !0, m = L.isGlob = !0, E = !0, i === !0)
2234
2234
  continue;
2235
2235
  break;
2236
2236
  }
2237
2237
  }
2238
- if (n.nonegate !== !0 && S === Bt && l === c) {
2238
+ if (s.nonegate !== !0 && R === Bt && l === c) {
2239
2239
  A = L.negated = !0, c++;
2240
2240
  continue;
2241
2241
  }
2242
- if (n.noparen !== !0 && S === rt) {
2243
- if (y = L.isGlob = !0, i === !0) {
2244
- for (; U() !== !0 && (S = M()); ) {
2245
- if (S === rt) {
2246
- b = L.backslashes = !0, S = M();
2242
+ if (s.noparen !== !0 && R === rt) {
2243
+ if (m = L.isGlob = !0, i === !0) {
2244
+ for (; U() !== !0 && (R = M()); ) {
2245
+ if (R === rt) {
2246
+ b = L.backslashes = !0, R = M();
2247
2247
  continue;
2248
2248
  }
2249
- if (S === zt) {
2249
+ if (R === zt) {
2250
2250
  E = !0;
2251
2251
  break;
2252
2252
  }
@@ -2255,89 +2255,89 @@ const Ut = qe, {
2255
2255
  }
2256
2256
  break;
2257
2257
  }
2258
- if (y === !0) {
2258
+ if (m === !0) {
2259
2259
  if (E = !0, i === !0)
2260
2260
  continue;
2261
2261
  break;
2262
2262
  }
2263
2263
  }
2264
- n.noext === !0 && (R = !1, y = !1);
2264
+ s.noext === !0 && (S = !1, m = !1);
2265
2265
  let I = u, B = "", h = "";
2266
- c > 0 && (B = u.slice(0, c), u = u.slice(c), d -= c), I && y === !0 && d > 0 ? (I = u.slice(0, d), h = u.slice(d)) : y === !0 ? (I = "", h = u) : I = u, I && I !== "" && I !== "/" && I !== u && Gt(I.charCodeAt(I.length - 1)) && (I = I.slice(0, -1)), n.unescape === !0 && (h && (h = Ut.removeBackslashes(h)), I && b === !0 && (I = Ut.removeBackslashes(I)));
2266
+ c > 0 && (B = u.slice(0, c), u = u.slice(c), d -= c), I && m === !0 && d > 0 ? (I = u.slice(0, d), h = u.slice(d)) : m === !0 ? (I = "", h = u) : I = u, I && I !== "" && I !== "/" && I !== u && Jt(I.charCodeAt(I.length - 1)) && (I = I.slice(0, -1)), s.unescape === !0 && (h && (h = Ut.removeBackslashes(h)), I && b === !0 && (I = Ut.removeBackslashes(I)));
2267
2267
  const p = {
2268
2268
  prefix: B,
2269
2269
  input: t,
2270
2270
  start: c,
2271
2271
  base: I,
2272
2272
  glob: h,
2273
- isBrace: g,
2273
+ isBrace: _,
2274
2274
  isBracket: v,
2275
- isGlob: y,
2276
- isExtglob: R,
2275
+ isGlob: m,
2276
+ isExtglob: S,
2277
2277
  isGlobstar: w,
2278
2278
  negated: A
2279
2279
  };
2280
- if (n.tokens === !0 && (p.maxDepth = 0, Gt(S) || r.push(L), p.tokens = r), n.parts === !0 || n.tokens === !0) {
2280
+ if (s.tokens === !0 && (p.maxDepth = 0, Jt(R) || r.push(L), p.tokens = r), s.parts === !0 || s.tokens === !0) {
2281
2281
  let W;
2282
2282
  for (let k = 0; k < o.length; k++) {
2283
2283
  const re = W ? W + 1 : c, ce = o[k], Q = t.slice(re, ce);
2284
- n.tokens && (k === 0 && c !== 0 ? (r[k].isPrefix = !0, r[k].value = B) : r[k].value = Q, Vt(r[k]), p.maxDepth += r[k].depth), (k !== 0 || Q !== "") && a.push(Q), W = ce;
2284
+ s.tokens && (k === 0 && c !== 0 ? (r[k].isPrefix = !0, r[k].value = B) : r[k].value = Q, Gt(r[k]), p.maxDepth += r[k].depth), (k !== 0 || Q !== "") && a.push(Q), W = ce;
2285
2285
  }
2286
2286
  if (W && W + 1 < t.length) {
2287
2287
  const k = t.slice(W + 1);
2288
- a.push(k), n.tokens && (r[r.length - 1].value = k, Vt(r[r.length - 1]), p.maxDepth += r[r.length - 1].depth);
2288
+ a.push(k), s.tokens && (r[r.length - 1].value = k, Gt(r[r.length - 1]), p.maxDepth += r[r.length - 1].depth);
2289
2289
  }
2290
2290
  p.slashes = o, p.parts = a;
2291
2291
  }
2292
2292
  return p;
2293
2293
  };
2294
2294
  var ai = oi;
2295
- const Ve = Ye, ne = qe, {
2296
- MAX_LENGTH: Je,
2295
+ const Ge = Ye, se = qe, {
2296
+ MAX_LENGTH: Ve,
2297
2297
  POSIX_REGEX_SOURCE: ui,
2298
2298
  REGEX_NON_SPECIAL_CHARS: ci,
2299
2299
  REGEX_SPECIAL_CHARS_BACKREF: li,
2300
- REPLACEMENTS: bn
2301
- } = Ve, fi = (t, e) => {
2300
+ REPLACEMENTS: _s
2301
+ } = Ge, fi = (t, e) => {
2302
2302
  if (typeof e.expandRange == "function")
2303
2303
  return e.expandRange(...t, e);
2304
2304
  t.sort();
2305
- const n = `[${t.join("-")}]`;
2305
+ const s = `[${t.join("-")}]`;
2306
2306
  try {
2307
- new RegExp(n);
2307
+ new RegExp(s);
2308
2308
  } catch {
2309
- return t.map((i) => ne.escapeRegex(i)).join("..");
2309
+ return t.map((i) => se.escapeRegex(i)).join("..");
2310
2310
  }
2311
- return n;
2312
- }, ve = (t, e) => `Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`, wn = (t, e) => {
2311
+ return s;
2312
+ }, ve = (t, e) => `Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`, bs = (t, e) => {
2313
2313
  if (typeof t != "string")
2314
2314
  throw new TypeError("Expected a string");
2315
- t = bn[t] || t;
2316
- const n = { ...e }, s = typeof n.maxLength == "number" ? Math.min(Je, n.maxLength) : Je;
2315
+ t = _s[t] || t;
2316
+ const s = { ...e }, n = typeof s.maxLength == "number" ? Math.min(Ve, s.maxLength) : Ve;
2317
2317
  let i = t.length;
2318
- if (i > s)
2319
- throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${s}`);
2320
- const o = { type: "bos", value: "", output: n.prepend || "" }, r = [o], a = n.capture ? "" : "?:", u = Ve.globChars(n.windows), l = Ve.extglobChars(u), {
2318
+ if (i > n)
2319
+ throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);
2320
+ const o = { type: "bos", value: "", output: s.prepend || "" }, r = [o], a = s.capture ? "" : "?:", u = Ge.globChars(s.windows), l = Ge.extglobChars(u), {
2321
2321
  DOT_LITERAL: c,
2322
2322
  PLUS_LITERAL: d,
2323
- SLASH_LITERAL: g,
2323
+ SLASH_LITERAL: _,
2324
2324
  ONE_CHAR: v,
2325
- DOTS_SLASH: y,
2326
- NO_DOT: R,
2325
+ DOTS_SLASH: m,
2326
+ NO_DOT: S,
2327
2327
  NO_DOT_SLASH: w,
2328
2328
  NO_DOTS_SLASH: $,
2329
2329
  QMARK: b,
2330
2330
  QMARK_NO_DOT: A,
2331
2331
  STAR: E,
2332
2332
  START_ANCHOR: O
2333
- } = u, H = (_) => `(${a}(?:(?!${O}${_.dot ? y : c}).)*?)`, S = n.dot ? "" : R, L = n.dot ? b : A;
2334
- let U = n.bash === !0 ? H(n) : E;
2335
- n.capture && (U = `(${U})`), typeof n.noext == "boolean" && (n.noextglob = n.noext);
2333
+ } = u, H = (g) => `(${a}(?:(?!${O}${g.dot ? m : c}).)*?)`, R = s.dot ? "" : S, L = s.dot ? b : A;
2334
+ let U = s.bash === !0 ? H(s) : E;
2335
+ s.capture && (U = `(${U})`), typeof s.noext == "boolean" && (s.noextglob = s.noext);
2336
2336
  const f = {
2337
2337
  input: t,
2338
2338
  index: -1,
2339
2339
  start: 0,
2340
- dot: n.dot === !0,
2340
+ dot: s.dot === !0,
2341
2341
  consumed: "",
2342
2342
  output: "",
2343
2343
  prefix: "",
@@ -2350,87 +2350,87 @@ const Ve = Ye, ne = qe, {
2350
2350
  globstar: !1,
2351
2351
  tokens: r
2352
2352
  };
2353
- t = ne.removePrefix(t, f), i = t.length;
2353
+ t = se.removePrefix(t, f), i = t.length;
2354
2354
  const M = [], I = [], B = [];
2355
2355
  let h = o, p;
2356
- const W = () => f.index === i - 1, k = f.peek = (_ = 1) => t[f.index + _], re = f.advance = () => t[++f.index], ce = () => t.slice(f.index + 1), Q = (_ = "", N = 0) => {
2357
- f.consumed += _, f.index += N;
2358
- }, De = (_) => {
2359
- f.output += _.output != null ? _.output : _.value, Q(_.value);
2360
- }, Sn = () => {
2361
- let _ = 1;
2356
+ const W = () => f.index === i - 1, k = f.peek = (g = 1) => t[f.index + g], re = f.advance = () => t[++f.index], ce = () => t.slice(f.index + 1), Q = (g = "", N = 0) => {
2357
+ f.consumed += g, f.index += N;
2358
+ }, De = (g) => {
2359
+ f.output += g.output != null ? g.output : g.value, Q(g.value);
2360
+ }, Rs = () => {
2361
+ let g = 1;
2362
2362
  for (; k() === "!" && (k(2) !== "(" || k(3) === "?"); )
2363
- re(), f.start++, _++;
2364
- return _ % 2 === 0 ? !1 : (f.negated = !0, f.start++, !0);
2365
- }, ke = (_) => {
2366
- f[_]++, B.push(_);
2367
- }, ye = (_) => {
2368
- f[_]--, B.pop();
2369
- }, T = (_) => {
2363
+ re(), f.start++, g++;
2364
+ return g % 2 === 0 ? !1 : (f.negated = !0, f.start++, !0);
2365
+ }, ke = (g) => {
2366
+ f[g]++, B.push(g);
2367
+ }, ye = (g) => {
2368
+ f[g]--, B.pop();
2369
+ }, T = (g) => {
2370
2370
  if (h.type === "globstar") {
2371
- const N = f.braces > 0 && (_.type === "comma" || _.type === "brace"), m = _.extglob === !0 || M.length && (_.type === "pipe" || _.type === "paren");
2372
- _.type !== "slash" && _.type !== "paren" && !N && !m && (f.output = f.output.slice(0, -h.output.length), h.type = "star", h.value = "*", h.output = U, f.output += h.output);
2371
+ const N = f.braces > 0 && (g.type === "comma" || g.type === "brace"), y = g.extglob === !0 || M.length && (g.type === "pipe" || g.type === "paren");
2372
+ g.type !== "slash" && g.type !== "paren" && !N && !y && (f.output = f.output.slice(0, -h.output.length), h.type = "star", h.value = "*", h.output = U, f.output += h.output);
2373
2373
  }
2374
- if (M.length && _.type !== "paren" && !l[_.value] && (M[M.length - 1].inner += _.value), (_.value || _.output) && De(_), h && h.type === "text" && _.type === "text") {
2375
- h.value += _.value, h.output = (h.output || "") + _.value;
2374
+ if (M.length && g.type !== "paren" && !l[g.value] && (M[M.length - 1].inner += g.value), (g.value || g.output) && De(g), h && h.type === "text" && g.type === "text") {
2375
+ h.value += g.value, h.output = (h.output || "") + g.value;
2376
2376
  return;
2377
2377
  }
2378
- _.prev = h, r.push(_), h = _;
2379
- }, He = (_, N) => {
2380
- const m = { ...l[N], conditions: 1, inner: "" };
2381
- m.prev = h, m.parens = f.parens, m.output = f.output;
2382
- const D = (n.capture ? "(" : "") + m.open;
2383
- ke("parens"), T({ type: _, value: N, output: f.output ? "" : v }), T({ type: "paren", extglob: !0, value: re(), output: D }), M.push(m);
2384
- }, An = (_) => {
2385
- let N = _.close + (n.capture ? ")" : "");
2386
- if (_.type === "negate") {
2387
- let m = U;
2388
- _.inner && _.inner.length > 1 && _.inner.includes("/") && (m = H(n)), (m !== U || W() || /^\)+$/.test(ce())) && (N = _.close = `)$))${m}`), _.prev.type === "bos" && W() && (f.negatedExtglob = !0);
2378
+ g.prev = h, r.push(g), h = g;
2379
+ }, He = (g, N) => {
2380
+ const y = { ...l[N], conditions: 1, inner: "" };
2381
+ y.prev = h, y.parens = f.parens, y.output = f.output;
2382
+ const D = (s.capture ? "(" : "") + y.open;
2383
+ ke("parens"), T({ type: g, value: N, output: f.output ? "" : v }), T({ type: "paren", extglob: !0, value: re(), output: D }), M.push(y);
2384
+ }, Ss = (g) => {
2385
+ let N = g.close + (s.capture ? ")" : "");
2386
+ if (g.type === "negate") {
2387
+ let y = U;
2388
+ g.inner && g.inner.length > 1 && g.inner.includes("/") && (y = H(s)), (y !== U || W() || /^\)+$/.test(ce())) && (N = g.close = `)$))${y}`), g.prev.type === "bos" && W() && (f.negatedExtglob = !0);
2389
2389
  }
2390
2390
  T({ type: "paren", extglob: !0, value: p, output: N }), ye("parens");
2391
2391
  };
2392
- if (n.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(t)) {
2393
- let _ = !1, N = t.replace(li, (m, D, F, K, J, Ze) => K === "\\" ? (_ = !0, m) : K === "?" ? D ? D + K + (J ? b.repeat(J.length) : "") : Ze === 0 ? L + (J ? b.repeat(J.length) : "") : b.repeat(F.length) : K === "." ? c.repeat(F.length) : K === "*" ? D ? D + K + (J ? U : "") : U : D ? m : `\\${m}`);
2394
- return _ === !0 && (n.unescape === !0 ? N = N.replace(/\\/g, "") : N = N.replace(/\\+/g, (m) => m.length % 2 === 0 ? "\\\\" : m ? "\\" : "")), N === t && n.contains === !0 ? (f.output = t, f) : (f.output = ne.wrapOutput(N, f, e), f);
2392
+ if (s.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(t)) {
2393
+ let g = !1, N = t.replace(li, (y, D, F, K, V, Ze) => K === "\\" ? (g = !0, y) : K === "?" ? D ? D + K + (V ? b.repeat(V.length) : "") : Ze === 0 ? L + (V ? b.repeat(V.length) : "") : b.repeat(F.length) : K === "." ? c.repeat(F.length) : K === "*" ? D ? D + K + (V ? U : "") : U : D ? y : `\\${y}`);
2394
+ return g === !0 && (s.unescape === !0 ? N = N.replace(/\\/g, "") : N = N.replace(/\\+/g, (y) => y.length % 2 === 0 ? "\\\\" : y ? "\\" : "")), N === t && s.contains === !0 ? (f.output = t, f) : (f.output = se.wrapOutput(N, f, e), f);
2395
2395
  }
2396
2396
  for (; !W(); ) {
2397
2397
  if (p = re(), p === "\0")
2398
2398
  continue;
2399
2399
  if (p === "\\") {
2400
- const m = k();
2401
- if (m === "/" && n.bash !== !0 || m === "." || m === ";")
2400
+ const y = k();
2401
+ if (y === "/" && s.bash !== !0 || y === "." || y === ";")
2402
2402
  continue;
2403
- if (!m) {
2403
+ if (!y) {
2404
2404
  p += "\\", T({ type: "text", value: p });
2405
2405
  continue;
2406
2406
  }
2407
2407
  const D = /^\\+/.exec(ce());
2408
2408
  let F = 0;
2409
- if (D && D[0].length > 2 && (F = D[0].length, f.index += F, F % 2 !== 0 && (p += "\\")), n.unescape === !0 ? p = re() || "" : p += re() || "", f.brackets === 0) {
2409
+ if (D && D[0].length > 2 && (F = D[0].length, f.index += F, F % 2 !== 0 && (p += "\\")), s.unescape === !0 ? p = re() || "" : p += re() || "", f.brackets === 0) {
2410
2410
  T({ type: "text", value: p });
2411
2411
  continue;
2412
2412
  }
2413
2413
  }
2414
2414
  if (f.brackets > 0 && (p !== "]" || h.value === "[" || h.value === "[^")) {
2415
- if (n.posix !== !1 && p === ":") {
2416
- const m = h.value.slice(1);
2417
- if (m.includes("[") && (h.posix = !0, m.includes(":"))) {
2418
- const D = h.value.lastIndexOf("["), F = h.value.slice(0, D), K = h.value.slice(D + 2), J = ui[K];
2419
- if (J) {
2420
- h.value = F + J, f.backtrack = !0, re(), !o.output && r.indexOf(h) === 1 && (o.output = v);
2415
+ if (s.posix !== !1 && p === ":") {
2416
+ const y = h.value.slice(1);
2417
+ if (y.includes("[") && (h.posix = !0, y.includes(":"))) {
2418
+ const D = h.value.lastIndexOf("["), F = h.value.slice(0, D), K = h.value.slice(D + 2), V = ui[K];
2419
+ if (V) {
2420
+ h.value = F + V, f.backtrack = !0, re(), !o.output && r.indexOf(h) === 1 && (o.output = v);
2421
2421
  continue;
2422
2422
  }
2423
2423
  }
2424
2424
  }
2425
- (p === "[" && k() !== ":" || p === "-" && k() === "]") && (p = `\\${p}`), p === "]" && (h.value === "[" || h.value === "[^") && (p = `\\${p}`), n.posix === !0 && p === "!" && h.value === "[" && (p = "^"), h.value += p, De({ value: p });
2425
+ (p === "[" && k() !== ":" || p === "-" && k() === "]") && (p = `\\${p}`), p === "]" && (h.value === "[" || h.value === "[^") && (p = `\\${p}`), s.posix === !0 && p === "!" && h.value === "[" && (p = "^"), h.value += p, De({ value: p });
2426
2426
  continue;
2427
2427
  }
2428
2428
  if (f.quotes === 1 && p !== '"') {
2429
- p = ne.escapeRegex(p), h.value += p, De({ value: p });
2429
+ p = se.escapeRegex(p), h.value += p, De({ value: p });
2430
2430
  continue;
2431
2431
  }
2432
2432
  if (p === '"') {
2433
- f.quotes = f.quotes === 1 ? 0 : 1, n.keepQuotes === !0 && T({ type: "text", value: p });
2433
+ f.quotes = f.quotes === 1 ? 0 : 1, s.keepQuotes === !0 && T({ type: "text", value: p });
2434
2434
  continue;
2435
2435
  }
2436
2436
  if (p === "(") {
@@ -2438,19 +2438,19 @@ const Ve = Ye, ne = qe, {
2438
2438
  continue;
2439
2439
  }
2440
2440
  if (p === ")") {
2441
- if (f.parens === 0 && n.strictBrackets === !0)
2441
+ if (f.parens === 0 && s.strictBrackets === !0)
2442
2442
  throw new SyntaxError(ve("opening", "("));
2443
- const m = M[M.length - 1];
2444
- if (m && f.parens === m.parens + 1) {
2445
- An(M.pop());
2443
+ const y = M[M.length - 1];
2444
+ if (y && f.parens === y.parens + 1) {
2445
+ Ss(M.pop());
2446
2446
  continue;
2447
2447
  }
2448
2448
  T({ type: "paren", value: p, output: f.parens ? ")" : "\\)" }), ye("parens");
2449
2449
  continue;
2450
2450
  }
2451
2451
  if (p === "[") {
2452
- if (n.nobracket === !0 || !ce().includes("]")) {
2453
- if (n.nobracket !== !0 && n.strictBrackets === !0)
2452
+ if (s.nobracket === !0 || !ce().includes("]")) {
2453
+ if (s.nobracket !== !0 && s.strictBrackets === !0)
2454
2454
  throw new SyntaxError(ve("closing", "]"));
2455
2455
  p = `\\${p}`;
2456
2456
  } else
@@ -2459,58 +2459,58 @@ const Ve = Ye, ne = qe, {
2459
2459
  continue;
2460
2460
  }
2461
2461
  if (p === "]") {
2462
- if (n.nobracket === !0 || h && h.type === "bracket" && h.value.length === 1) {
2462
+ if (s.nobracket === !0 || h && h.type === "bracket" && h.value.length === 1) {
2463
2463
  T({ type: "text", value: p, output: `\\${p}` });
2464
2464
  continue;
2465
2465
  }
2466
2466
  if (f.brackets === 0) {
2467
- if (n.strictBrackets === !0)
2467
+ if (s.strictBrackets === !0)
2468
2468
  throw new SyntaxError(ve("opening", "["));
2469
2469
  T({ type: "text", value: p, output: `\\${p}` });
2470
2470
  continue;
2471
2471
  }
2472
2472
  ye("brackets");
2473
- const m = h.value.slice(1);
2474
- if (h.posix !== !0 && m[0] === "^" && !m.includes("/") && (p = `/${p}`), h.value += p, De({ value: p }), n.literalBrackets === !1 || ne.hasRegexChars(m))
2473
+ const y = h.value.slice(1);
2474
+ if (h.posix !== !0 && y[0] === "^" && !y.includes("/") && (p = `/${p}`), h.value += p, De({ value: p }), s.literalBrackets === !1 || se.hasRegexChars(y))
2475
2475
  continue;
2476
- const D = ne.escapeRegex(h.value);
2477
- if (f.output = f.output.slice(0, -h.value.length), n.literalBrackets === !0) {
2476
+ const D = se.escapeRegex(h.value);
2477
+ if (f.output = f.output.slice(0, -h.value.length), s.literalBrackets === !0) {
2478
2478
  f.output += D, h.value = D;
2479
2479
  continue;
2480
2480
  }
2481
2481
  h.value = `(${a}${D}|${h.value})`, f.output += h.value;
2482
2482
  continue;
2483
2483
  }
2484
- if (p === "{" && n.nobrace !== !0) {
2484
+ if (p === "{" && s.nobrace !== !0) {
2485
2485
  ke("braces");
2486
- const m = {
2486
+ const y = {
2487
2487
  type: "brace",
2488
2488
  value: p,
2489
2489
  output: "(",
2490
2490
  outputIndex: f.output.length,
2491
2491
  tokensIndex: f.tokens.length
2492
2492
  };
2493
- I.push(m), T(m);
2493
+ I.push(y), T(y);
2494
2494
  continue;
2495
2495
  }
2496
2496
  if (p === "}") {
2497
- const m = I[I.length - 1];
2498
- if (n.nobrace === !0 || !m) {
2497
+ const y = I[I.length - 1];
2498
+ if (s.nobrace === !0 || !y) {
2499
2499
  T({ type: "text", value: p, output: p });
2500
2500
  continue;
2501
2501
  }
2502
2502
  let D = ")";
2503
- if (m.dots === !0) {
2503
+ if (y.dots === !0) {
2504
2504
  const F = r.slice(), K = [];
2505
- for (let J = F.length - 1; J >= 0 && (r.pop(), F[J].type !== "brace"); J--)
2506
- F[J].type !== "dots" && K.unshift(F[J].value);
2507
- D = fi(K, n), f.backtrack = !0;
2505
+ for (let V = F.length - 1; V >= 0 && (r.pop(), F[V].type !== "brace"); V--)
2506
+ F[V].type !== "dots" && K.unshift(F[V].value);
2507
+ D = fi(K, s), f.backtrack = !0;
2508
2508
  }
2509
- if (m.comma !== !0 && m.dots !== !0) {
2510
- const F = f.output.slice(0, m.outputIndex), K = f.tokens.slice(m.tokensIndex);
2511
- m.value = m.output = "\\{", p = D = "\\}", f.output = F;
2512
- for (const J of K)
2513
- f.output += J.output || J.value;
2509
+ if (y.comma !== !0 && y.dots !== !0) {
2510
+ const F = f.output.slice(0, y.outputIndex), K = f.tokens.slice(y.tokensIndex);
2511
+ y.value = y.output = "\\{", p = D = "\\}", f.output = F;
2512
+ for (const V of K)
2513
+ f.output += V.output || V.value;
2514
2514
  }
2515
2515
  T({ type: "brace", value: p, output: D }), ye("braces"), I.pop();
2516
2516
  continue;
@@ -2520,9 +2520,9 @@ const Ve = Ye, ne = qe, {
2520
2520
  continue;
2521
2521
  }
2522
2522
  if (p === ",") {
2523
- let m = p;
2523
+ let y = p;
2524
2524
  const D = I[I.length - 1];
2525
- D && B[B.length - 1] === "braces" && (D.comma = !0, m = "|"), T({ type: "comma", value: p, output: m });
2525
+ D && B[B.length - 1] === "braces" && (D.comma = !0, y = "|"), T({ type: "comma", value: p, output: y });
2526
2526
  continue;
2527
2527
  }
2528
2528
  if (p === "/") {
@@ -2530,14 +2530,14 @@ const Ve = Ye, ne = qe, {
2530
2530
  f.start = f.index + 1, f.consumed = "", f.output = "", r.pop(), h = o;
2531
2531
  continue;
2532
2532
  }
2533
- T({ type: "slash", value: p, output: g });
2533
+ T({ type: "slash", value: p, output: _ });
2534
2534
  continue;
2535
2535
  }
2536
2536
  if (p === ".") {
2537
2537
  if (f.braces > 0 && h.type === "dot") {
2538
2538
  h.value === "." && (h.output = c);
2539
- const m = I[I.length - 1];
2540
- h.type = "dots", h.output += p, h.value += p, m.dots = !0;
2539
+ const y = I[I.length - 1];
2540
+ h.type = "dots", h.output += p, h.value += p, y.dots = !0;
2541
2541
  continue;
2542
2542
  }
2543
2543
  if (f.braces + f.parens === 0 && h.type !== "bos" && h.type !== "slash") {
@@ -2548,19 +2548,19 @@ const Ve = Ye, ne = qe, {
2548
2548
  continue;
2549
2549
  }
2550
2550
  if (p === "?") {
2551
- if (!(h && h.value === "(") && n.noextglob !== !0 && k() === "(" && k(2) !== "?") {
2551
+ if (!(h && h.value === "(") && s.noextglob !== !0 && k() === "(" && k(2) !== "?") {
2552
2552
  He("qmark", p);
2553
2553
  continue;
2554
2554
  }
2555
2555
  if (h && h.type === "paren") {
2556
2556
  const D = k();
2557
2557
  let F = p;
2558
- if (D === "<" && !ne.supportsLookbehinds())
2558
+ if (D === "<" && !se.supportsLookbehinds())
2559
2559
  throw new Error("Node.js v10 or higher is required for regex lookbehinds");
2560
2560
  (h.value === "(" && !/[!=<:]/.test(D) || D === "<" && !/<([!=]|\w+>)/.test(ce())) && (F = `\\${p}`), T({ type: "text", value: p, output: F });
2561
2561
  continue;
2562
2562
  }
2563
- if (n.dot !== !0 && (h.type === "slash" || h.type === "bos")) {
2563
+ if (s.dot !== !0 && (h.type === "slash" || h.type === "bos")) {
2564
2564
  T({ type: "qmark", value: p, output: A });
2565
2565
  continue;
2566
2566
  }
@@ -2568,21 +2568,21 @@ const Ve = Ye, ne = qe, {
2568
2568
  continue;
2569
2569
  }
2570
2570
  if (p === "!") {
2571
- if (n.noextglob !== !0 && k() === "(" && (k(2) !== "?" || !/[!=<:]/.test(k(3)))) {
2571
+ if (s.noextglob !== !0 && k() === "(" && (k(2) !== "?" || !/[!=<:]/.test(k(3)))) {
2572
2572
  He("negate", p);
2573
2573
  continue;
2574
2574
  }
2575
- if (n.nonegate !== !0 && f.index === 0) {
2576
- Sn();
2575
+ if (s.nonegate !== !0 && f.index === 0) {
2576
+ Rs();
2577
2577
  continue;
2578
2578
  }
2579
2579
  }
2580
2580
  if (p === "+") {
2581
- if (n.noextglob !== !0 && k() === "(" && k(2) !== "?") {
2581
+ if (s.noextglob !== !0 && k() === "(" && k(2) !== "?") {
2582
2582
  He("plus", p);
2583
2583
  continue;
2584
2584
  }
2585
- if (h && h.value === "(" || n.regex === !1) {
2585
+ if (h && h.value === "(" || s.regex === !1) {
2586
2586
  T({ type: "plus", value: p, output: d });
2587
2587
  continue;
2588
2588
  }
@@ -2594,7 +2594,7 @@ const Ve = Ye, ne = qe, {
2594
2594
  continue;
2595
2595
  }
2596
2596
  if (p === "@") {
2597
- if (n.noextglob !== !0 && k() === "(" && k(2) !== "?") {
2597
+ if (s.noextglob !== !0 && k() === "(" && k(2) !== "?") {
2598
2598
  T({ type: "at", extglob: !0, value: p, output: "" });
2599
2599
  continue;
2600
2600
  }
@@ -2603,98 +2603,98 @@ const Ve = Ye, ne = qe, {
2603
2603
  }
2604
2604
  if (p !== "*") {
2605
2605
  (p === "$" || p === "^") && (p = `\\${p}`);
2606
- const m = ci.exec(ce());
2607
- m && (p += m[0], f.index += m[0].length), T({ type: "text", value: p });
2606
+ const y = ci.exec(ce());
2607
+ y && (p += y[0], f.index += y[0].length), T({ type: "text", value: p });
2608
2608
  continue;
2609
2609
  }
2610
2610
  if (h && (h.type === "globstar" || h.star === !0)) {
2611
2611
  h.type = "star", h.star = !0, h.value += p, h.output = U, f.backtrack = !0, f.globstar = !0, Q(p);
2612
2612
  continue;
2613
2613
  }
2614
- let _ = ce();
2615
- if (n.noextglob !== !0 && /^\([^?]/.test(_)) {
2614
+ let g = ce();
2615
+ if (s.noextglob !== !0 && /^\([^?]/.test(g)) {
2616
2616
  He("star", p);
2617
2617
  continue;
2618
2618
  }
2619
2619
  if (h.type === "star") {
2620
- if (n.noglobstar === !0) {
2620
+ if (s.noglobstar === !0) {
2621
2621
  Q(p);
2622
2622
  continue;
2623
2623
  }
2624
- const m = h.prev, D = m.prev, F = m.type === "slash" || m.type === "bos", K = D && (D.type === "star" || D.type === "globstar");
2625
- if (n.bash === !0 && (!F || _[0] && _[0] !== "/")) {
2624
+ const y = h.prev, D = y.prev, F = y.type === "slash" || y.type === "bos", K = D && (D.type === "star" || D.type === "globstar");
2625
+ if (s.bash === !0 && (!F || g[0] && g[0] !== "/")) {
2626
2626
  T({ type: "star", value: p, output: "" });
2627
2627
  continue;
2628
2628
  }
2629
- const J = f.braces > 0 && (m.type === "comma" || m.type === "brace"), Ze = M.length && (m.type === "pipe" || m.type === "paren");
2630
- if (!F && m.type !== "paren" && !J && !Ze) {
2629
+ const V = f.braces > 0 && (y.type === "comma" || y.type === "brace"), Ze = M.length && (y.type === "pipe" || y.type === "paren");
2630
+ if (!F && y.type !== "paren" && !V && !Ze) {
2631
2631
  T({ type: "star", value: p, output: "" });
2632
2632
  continue;
2633
2633
  }
2634
- for (; _.slice(0, 3) === "/**"; ) {
2634
+ for (; g.slice(0, 3) === "/**"; ) {
2635
2635
  const Ne = t[f.index + 4];
2636
2636
  if (Ne && Ne !== "/")
2637
2637
  break;
2638
- _ = _.slice(3), Q("/**", 3);
2638
+ g = g.slice(3), Q("/**", 3);
2639
2639
  }
2640
- if (m.type === "bos" && W()) {
2641
- h.type = "globstar", h.value += p, h.output = H(n), f.output = h.output, f.globstar = !0, Q(p);
2640
+ if (y.type === "bos" && W()) {
2641
+ h.type = "globstar", h.value += p, h.output = H(s), f.output = h.output, f.globstar = !0, Q(p);
2642
2642
  continue;
2643
2643
  }
2644
- if (m.type === "slash" && m.prev.type !== "bos" && !K && W()) {
2645
- f.output = f.output.slice(0, -(m.output + h.output).length), m.output = `(?:${m.output}`, h.type = "globstar", h.output = H(n) + (n.strictSlashes ? ")" : "|$)"), h.value += p, f.globstar = !0, f.output += m.output + h.output, Q(p);
2644
+ if (y.type === "slash" && y.prev.type !== "bos" && !K && W()) {
2645
+ f.output = f.output.slice(0, -(y.output + h.output).length), y.output = `(?:${y.output}`, h.type = "globstar", h.output = H(s) + (s.strictSlashes ? ")" : "|$)"), h.value += p, f.globstar = !0, f.output += y.output + h.output, Q(p);
2646
2646
  continue;
2647
2647
  }
2648
- if (m.type === "slash" && m.prev.type !== "bos" && _[0] === "/") {
2649
- const Ne = _[1] !== void 0 ? "|$" : "";
2650
- f.output = f.output.slice(0, -(m.output + h.output).length), m.output = `(?:${m.output}`, h.type = "globstar", h.output = `${H(n)}${g}|${g}${Ne})`, h.value += p, f.output += m.output + h.output, f.globstar = !0, Q(p + re()), T({ type: "slash", value: "/", output: "" });
2648
+ if (y.type === "slash" && y.prev.type !== "bos" && g[0] === "/") {
2649
+ const Ne = g[1] !== void 0 ? "|$" : "";
2650
+ f.output = f.output.slice(0, -(y.output + h.output).length), y.output = `(?:${y.output}`, h.type = "globstar", h.output = `${H(s)}${_}|${_}${Ne})`, h.value += p, f.output += y.output + h.output, f.globstar = !0, Q(p + re()), T({ type: "slash", value: "/", output: "" });
2651
2651
  continue;
2652
2652
  }
2653
- if (m.type === "bos" && _[0] === "/") {
2654
- h.type = "globstar", h.value += p, h.output = `(?:^|${g}|${H(n)}${g})`, f.output = h.output, f.globstar = !0, Q(p + re()), T({ type: "slash", value: "/", output: "" });
2653
+ if (y.type === "bos" && g[0] === "/") {
2654
+ h.type = "globstar", h.value += p, h.output = `(?:^|${_}|${H(s)}${_})`, f.output = h.output, f.globstar = !0, Q(p + re()), T({ type: "slash", value: "/", output: "" });
2655
2655
  continue;
2656
2656
  }
2657
- f.output = f.output.slice(0, -h.output.length), h.type = "globstar", h.output = H(n), h.value += p, f.output += h.output, f.globstar = !0, Q(p);
2657
+ f.output = f.output.slice(0, -h.output.length), h.type = "globstar", h.output = H(s), h.value += p, f.output += h.output, f.globstar = !0, Q(p);
2658
2658
  continue;
2659
2659
  }
2660
2660
  const N = { type: "star", value: p, output: U };
2661
- if (n.bash === !0) {
2662
- N.output = ".*?", (h.type === "bos" || h.type === "slash") && (N.output = S + N.output), T(N);
2661
+ if (s.bash === !0) {
2662
+ N.output = ".*?", (h.type === "bos" || h.type === "slash") && (N.output = R + N.output), T(N);
2663
2663
  continue;
2664
2664
  }
2665
- if (h && (h.type === "bracket" || h.type === "paren") && n.regex === !0) {
2665
+ if (h && (h.type === "bracket" || h.type === "paren") && s.regex === !0) {
2666
2666
  N.output = p, T(N);
2667
2667
  continue;
2668
2668
  }
2669
- (f.index === f.start || h.type === "slash" || h.type === "dot") && (h.type === "dot" ? (f.output += w, h.output += w) : n.dot === !0 ? (f.output += $, h.output += $) : (f.output += S, h.output += S), k() !== "*" && (f.output += v, h.output += v)), T(N);
2669
+ (f.index === f.start || h.type === "slash" || h.type === "dot") && (h.type === "dot" ? (f.output += w, h.output += w) : s.dot === !0 ? (f.output += $, h.output += $) : (f.output += R, h.output += R), k() !== "*" && (f.output += v, h.output += v)), T(N);
2670
2670
  }
2671
2671
  for (; f.brackets > 0; ) {
2672
- if (n.strictBrackets === !0)
2672
+ if (s.strictBrackets === !0)
2673
2673
  throw new SyntaxError(ve("closing", "]"));
2674
- f.output = ne.escapeLast(f.output, "["), ye("brackets");
2674
+ f.output = se.escapeLast(f.output, "["), ye("brackets");
2675
2675
  }
2676
2676
  for (; f.parens > 0; ) {
2677
- if (n.strictBrackets === !0)
2677
+ if (s.strictBrackets === !0)
2678
2678
  throw new SyntaxError(ve("closing", ")"));
2679
- f.output = ne.escapeLast(f.output, "("), ye("parens");
2679
+ f.output = se.escapeLast(f.output, "("), ye("parens");
2680
2680
  }
2681
2681
  for (; f.braces > 0; ) {
2682
- if (n.strictBrackets === !0)
2682
+ if (s.strictBrackets === !0)
2683
2683
  throw new SyntaxError(ve("closing", "}"));
2684
- f.output = ne.escapeLast(f.output, "{"), ye("braces");
2684
+ f.output = se.escapeLast(f.output, "{"), ye("braces");
2685
2685
  }
2686
- if (n.strictSlashes !== !0 && (h.type === "star" || h.type === "bracket") && T({ type: "maybe_slash", value: "", output: `${g}?` }), f.backtrack === !0) {
2686
+ if (s.strictSlashes !== !0 && (h.type === "star" || h.type === "bracket") && T({ type: "maybe_slash", value: "", output: `${_}?` }), f.backtrack === !0) {
2687
2687
  f.output = "";
2688
- for (const _ of f.tokens)
2689
- f.output += _.output != null ? _.output : _.value, _.suffix && (f.output += _.suffix);
2688
+ for (const g of f.tokens)
2689
+ f.output += g.output != null ? g.output : g.value, g.suffix && (f.output += g.suffix);
2690
2690
  }
2691
2691
  return f;
2692
2692
  };
2693
- wn.fastpaths = (t, e) => {
2694
- const n = { ...e }, s = typeof n.maxLength == "number" ? Math.min(Je, n.maxLength) : Je, i = t.length;
2695
- if (i > s)
2696
- throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${s}`);
2697
- t = bn[t] || t;
2693
+ bs.fastpaths = (t, e) => {
2694
+ const s = { ...e }, n = typeof s.maxLength == "number" ? Math.min(Ve, s.maxLength) : Ve, i = t.length;
2695
+ if (i > n)
2696
+ throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);
2697
+ t = _s[t] || t;
2698
2698
  const {
2699
2699
  DOT_LITERAL: o,
2700
2700
  SLASH_LITERAL: r,
@@ -2703,132 +2703,132 @@ wn.fastpaths = (t, e) => {
2703
2703
  NO_DOT: l,
2704
2704
  NO_DOTS: c,
2705
2705
  NO_DOTS_SLASH: d,
2706
- STAR: g,
2706
+ STAR: _,
2707
2707
  START_ANCHOR: v
2708
- } = Ve.globChars(n.windows), y = n.dot ? c : l, R = n.dot ? d : l, w = n.capture ? "" : "?:", $ = { negated: !1, prefix: "" };
2709
- let b = n.bash === !0 ? ".*?" : g;
2710
- n.capture && (b = `(${b})`);
2711
- const A = (S) => S.noglobstar === !0 ? b : `(${w}(?:(?!${v}${S.dot ? u : o}).)*?)`, E = (S) => {
2712
- switch (S) {
2708
+ } = Ge.globChars(s.windows), m = s.dot ? c : l, S = s.dot ? d : l, w = s.capture ? "" : "?:", $ = { negated: !1, prefix: "" };
2709
+ let b = s.bash === !0 ? ".*?" : _;
2710
+ s.capture && (b = `(${b})`);
2711
+ const A = (R) => R.noglobstar === !0 ? b : `(${w}(?:(?!${v}${R.dot ? u : o}).)*?)`, E = (R) => {
2712
+ switch (R) {
2713
2713
  case "*":
2714
- return `${y}${a}${b}`;
2714
+ return `${m}${a}${b}`;
2715
2715
  case ".*":
2716
2716
  return `${o}${a}${b}`;
2717
2717
  case "*.*":
2718
- return `${y}${b}${o}${a}${b}`;
2718
+ return `${m}${b}${o}${a}${b}`;
2719
2719
  case "*/*":
2720
- return `${y}${b}${r}${a}${R}${b}`;
2720
+ return `${m}${b}${r}${a}${S}${b}`;
2721
2721
  case "**":
2722
- return y + A(n);
2722
+ return m + A(s);
2723
2723
  case "**/*":
2724
- return `(?:${y}${A(n)}${r})?${R}${a}${b}`;
2724
+ return `(?:${m}${A(s)}${r})?${S}${a}${b}`;
2725
2725
  case "**/*.*":
2726
- return `(?:${y}${A(n)}${r})?${R}${b}${o}${a}${b}`;
2726
+ return `(?:${m}${A(s)}${r})?${S}${b}${o}${a}${b}`;
2727
2727
  case "**/.*":
2728
- return `(?:${y}${A(n)}${r})?${o}${a}${b}`;
2728
+ return `(?:${m}${A(s)}${r})?${o}${a}${b}`;
2729
2729
  default: {
2730
- const L = /^(.*?)\.(\w+)$/.exec(S);
2730
+ const L = /^(.*?)\.(\w+)$/.exec(R);
2731
2731
  if (!L)
2732
2732
  return;
2733
2733
  const U = E(L[1]);
2734
2734
  return U ? U + o + L[2] : void 0;
2735
2735
  }
2736
2736
  }
2737
- }, O = ne.removePrefix(t, $);
2737
+ }, O = se.removePrefix(t, $);
2738
2738
  let H = E(O);
2739
- return H && n.strictSlashes !== !0 && (H += `${r}?`), H;
2739
+ return H && s.strictSlashes !== !0 && (H += `${r}?`), H;
2740
2740
  };
2741
- var pi = wn;
2742
- const hi = ai, dt = pi, vn = qe, di = Ye, mi = (t) => t && typeof t == "object" && !Array.isArray(t), V = (t, e, n = !1) => {
2741
+ var pi = bs;
2742
+ const hi = ai, dt = pi, ws = qe, di = Ye, mi = (t) => t && typeof t == "object" && !Array.isArray(t), G = (t, e, s = !1) => {
2743
2743
  if (Array.isArray(t)) {
2744
- const c = t.map((g) => V(g, e, n));
2745
- return (g) => {
2744
+ const c = t.map((_) => G(_, e, s));
2745
+ return (_) => {
2746
2746
  for (const v of c) {
2747
- const y = v(g);
2748
- if (y)
2749
- return y;
2747
+ const m = v(_);
2748
+ if (m)
2749
+ return m;
2750
2750
  }
2751
2751
  return !1;
2752
2752
  };
2753
2753
  }
2754
- const s = mi(t) && t.tokens && t.input;
2755
- if (t === "" || typeof t != "string" && !s)
2754
+ const n = mi(t) && t.tokens && t.input;
2755
+ if (t === "" || typeof t != "string" && !n)
2756
2756
  throw new TypeError("Expected pattern to be a non-empty string");
2757
- const i = e || {}, o = i.windows, r = s ? V.compileRe(t, e) : V.makeRe(t, e, !1, !0), a = r.state;
2757
+ const i = e || {}, o = i.windows, r = n ? G.compileRe(t, e) : G.makeRe(t, e, !1, !0), a = r.state;
2758
2758
  delete r.state;
2759
2759
  let u = () => !1;
2760
2760
  if (i.ignore) {
2761
2761
  const c = { ...e, ignore: null, onMatch: null, onResult: null };
2762
- u = V(i.ignore, c, n);
2762
+ u = G(i.ignore, c, s);
2763
2763
  }
2764
2764
  const l = (c, d = !1) => {
2765
- const { isMatch: g, match: v, output: y } = V.test(c, r, e, { glob: t, posix: o }), R = { glob: t, state: a, regex: r, posix: o, input: c, output: y, match: v, isMatch: g };
2766
- return typeof i.onResult == "function" && i.onResult(R), g === !1 ? (R.isMatch = !1, d ? R : !1) : u(c) ? (typeof i.onIgnore == "function" && i.onIgnore(R), R.isMatch = !1, d ? R : !1) : (typeof i.onMatch == "function" && i.onMatch(R), d ? R : !0);
2765
+ const { isMatch: _, match: v, output: m } = G.test(c, r, e, { glob: t, posix: o }), S = { glob: t, state: a, regex: r, posix: o, input: c, output: m, match: v, isMatch: _ };
2766
+ return typeof i.onResult == "function" && i.onResult(S), _ === !1 ? (S.isMatch = !1, d ? S : !1) : u(c) ? (typeof i.onIgnore == "function" && i.onIgnore(S), S.isMatch = !1, d ? S : !1) : (typeof i.onMatch == "function" && i.onMatch(S), d ? S : !0);
2767
2767
  };
2768
- return n && (l.state = a), l;
2768
+ return s && (l.state = a), l;
2769
2769
  };
2770
- V.test = (t, e, n, { glob: s, posix: i } = {}) => {
2770
+ G.test = (t, e, s, { glob: n, posix: i } = {}) => {
2771
2771
  if (typeof t != "string")
2772
2772
  throw new TypeError("Expected input to be a string");
2773
2773
  if (t === "")
2774
2774
  return { isMatch: !1, output: "" };
2775
- const o = n || {}, r = o.format || (i ? vn.toPosixSlashes : null);
2776
- let a = t === s, u = a && r ? r(t) : t;
2777
- return a === !1 && (u = r ? r(t) : t, a = u === s), (a === !1 || o.capture === !0) && (o.matchBase === !0 || o.basename === !0 ? a = V.matchBase(t, e, n, i) : a = e.exec(u)), { isMatch: !!a, match: a, output: u };
2775
+ const o = s || {}, r = o.format || (i ? ws.toPosixSlashes : null);
2776
+ let a = t === n, u = a && r ? r(t) : t;
2777
+ return a === !1 && (u = r ? r(t) : t, a = u === n), (a === !1 || o.capture === !0) && (o.matchBase === !0 || o.basename === !0 ? a = G.matchBase(t, e, s, i) : a = e.exec(u)), { isMatch: !!a, match: a, output: u };
2778
2778
  };
2779
- V.matchBase = (t, e, n) => (e instanceof RegExp ? e : V.makeRe(e, n)).test(vn.basename(t));
2780
- V.isMatch = (t, e, n) => V(e, n)(t);
2781
- V.parse = (t, e) => Array.isArray(t) ? t.map((n) => V.parse(n, e)) : dt(t, { ...e, fastpaths: !1 });
2782
- V.scan = (t, e) => hi(t, e);
2783
- V.compileRe = (t, e, n = !1, s = !1) => {
2784
- if (n === !0)
2779
+ G.matchBase = (t, e, s) => (e instanceof RegExp ? e : G.makeRe(e, s)).test(ws.basename(t));
2780
+ G.isMatch = (t, e, s) => G(e, s)(t);
2781
+ G.parse = (t, e) => Array.isArray(t) ? t.map((s) => G.parse(s, e)) : dt(t, { ...e, fastpaths: !1 });
2782
+ G.scan = (t, e) => hi(t, e);
2783
+ G.compileRe = (t, e, s = !1, n = !1) => {
2784
+ if (s === !0)
2785
2785
  return t.output;
2786
2786
  const i = e || {}, o = i.contains ? "" : "^", r = i.contains ? "" : "$";
2787
2787
  let a = `${o}(?:${t.output})${r}`;
2788
2788
  t && t.negated === !0 && (a = `^(?!${a}).*$`);
2789
- const u = V.toRegex(a, e);
2790
- return s === !0 && (u.state = t), u;
2789
+ const u = G.toRegex(a, e);
2790
+ return n === !0 && (u.state = t), u;
2791
2791
  };
2792
- V.makeRe = (t, e, n = !1, s = !1) => {
2792
+ G.makeRe = (t, e, s = !1, n = !1) => {
2793
2793
  if (!t || typeof t != "string")
2794
2794
  throw new TypeError("Expected a non-empty string");
2795
2795
  const i = e || {};
2796
2796
  let o = { negated: !1, fastpaths: !0 }, r = "", a;
2797
- return t.startsWith("./") && (t = t.slice(2), r = o.prefix = "./"), i.fastpaths !== !1 && (t[0] === "." || t[0] === "*") && (a = dt.fastpaths(t, e)), a === void 0 ? (o = dt(t, e), o.prefix = r + (o.prefix || "")) : o.output = a, V.compileRe(o, e, n, s);
2797
+ return t.startsWith("./") && (t = t.slice(2), r = o.prefix = "./"), i.fastpaths !== !1 && (t[0] === "." || t[0] === "*") && (a = dt.fastpaths(t, e)), a === void 0 ? (o = dt(t, e), o.prefix = r + (o.prefix || "")) : o.output = a, G.compileRe(o, e, s, n);
2798
2798
  };
2799
- V.toRegex = (t, e) => {
2799
+ G.toRegex = (t, e) => {
2800
2800
  try {
2801
- const n = e || {};
2802
- return new RegExp(t, n.flags || (n.nocase ? "i" : ""));
2803
- } catch (n) {
2801
+ const s = e || {};
2802
+ return new RegExp(t, s.flags || (s.nocase ? "i" : ""));
2803
+ } catch (s) {
2804
2804
  if (e && e.debug === !0)
2805
- throw n;
2805
+ throw s;
2806
2806
  return /$^/;
2807
2807
  }
2808
2808
  };
2809
- V.constants = di;
2810
- var yi = V, gi = yi;
2811
- const _i = /* @__PURE__ */ mt(gi), Rn = yt(fetch), bi = async (t, e) => {
2812
- const n = new URL(t);
2813
- n.pathname = n.pathname + (n.pathname.endsWith("/") ? "metapage.json" : "/metapage.json");
2814
- const i = await (await Rn(n.href, {
2809
+ G.constants = di;
2810
+ var yi = G, gi = yi;
2811
+ const _i = /* @__PURE__ */ mt(gi), vs = yt(fetch), bi = async (t, e) => {
2812
+ const s = new URL(t);
2813
+ s.pathname = s.pathname + (s.pathname.endsWith("/") ? "metapage.json" : "/metapage.json");
2814
+ const i = await (await vs(s.href, {
2815
2815
  redirect: "follow",
2816
2816
  retries: 3,
2817
2817
  retryDelay: 1e3
2818
2818
  })).json();
2819
- return await tn(i, e || Le);
2819
+ return await ts(i, e || Le);
2820
2820
  }, wi = async (t, e) => {
2821
2821
  if (t.startsWith("data:") || t.startsWith("https://docs.google.com"))
2822
2822
  return;
2823
- const n = new URL(t);
2824
- if (n.origin.endsWith(".notion.site"))
2823
+ const s = new URL(t);
2824
+ if (s.origin.endsWith(".notion.site"))
2825
2825
  return;
2826
- let s = Ot(t, "definition");
2827
- if (s != null && s.version)
2828
- return pt(s);
2829
- n.pathname.endsWith("metaframe.json") || (n.pathname = n.pathname + (n.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json"));
2826
+ let n = Rt(t, "definition");
2827
+ if (n != null && n.version)
2828
+ return pt(n);
2829
+ s.pathname.endsWith("metaframe.json") || (s.pathname = s.pathname + (s.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json"));
2830
2830
  try {
2831
- const i = await Rn(n.href, {
2831
+ const i = await vs(s.href, {
2832
2832
  redirect: "follow",
2833
2833
  retries: 3,
2834
2834
  retryDelay: 1e3
@@ -2836,48 +2836,48 @@ const _i = /* @__PURE__ */ mt(gi), Rn = yt(fetch), bi = async (t, e) => {
2836
2836
  if (i.status !== 200)
2837
2837
  return;
2838
2838
  const o = await i.json();
2839
- return await nn(o, e || We);
2839
+ return await ss(o, e || We);
2840
2840
  } catch (i) {
2841
- console.error(`Error fetching metaframe definition from ${n.href}: ${i}`);
2841
+ console.error(`Error fetching metaframe definition from ${s.href}: ${i}`);
2842
2842
  return;
2843
2843
  }
2844
- }, Gi = (t) => t ? !(t != null && t.inputs && Object.keys(t.inputs).length > 0 || t != null && t.outputs && Object.keys(t.outputs).length > 0 || t != null && t.allow || t != null && t.metadata && Object.keys(t.metadata).length > 0) : !0;
2845
- class vi extends Rt.EventEmitter {
2846
- constructor(e, n, s, i, o, r = !1) {
2844
+ }, Ji = (t) => t ? !(t != null && t.inputs && Object.keys(t.inputs).length > 0 || t != null && t.outputs && Object.keys(t.outputs).length > 0 || t != null && t.allow || t != null && t.metadata && Object.keys(t.metadata).length > 0) : !0;
2845
+ class vi extends Ot.EventEmitter {
2846
+ constructor(e, s, n, i, o, r = !1) {
2847
2847
  if (super(), this.inputs = {}, this.outputs = {}, this._disposables = [], this._rpcListeners = [], this._loaded = !1, this._onLoaded = [], this._sendInputsAfterRegistration = !1, this._cachedEventInputsUpdate = {
2848
2848
  iframeId: void 0,
2849
2849
  inputs: void 0
2850
2850
  }, this._cachedEventOutputsUpdate = {
2851
2851
  iframeId: null,
2852
2852
  inputs: null
2853
- }, !n.startsWith("data:") && !n.startsWith("http")) {
2854
- for (; n.startsWith("/"); )
2855
- n = n.substring(1);
2856
- n = window.location.protocol + "//" + window.location.hostname + (window.location.port && window.location.port != "" ? ":" + window.location.port : "") + "/" + n;
2853
+ }, !s.startsWith("data:") && !s.startsWith("http")) {
2854
+ for (; s.startsWith("/"); )
2855
+ s = s.substring(1);
2856
+ s = window.location.protocol + "//" + window.location.hostname + (window.location.port && window.location.port != "" ? ":" + window.location.port : "") + "/" + s;
2857
2857
  }
2858
- if (this.url = n, this._metapage = e, this._debug = r, r) {
2858
+ if (this.url = s, this._metapage = e, this._debug = r, r) {
2859
2859
  var a = new URL(this.url);
2860
2860
  a.searchParams.set(xe.mp_debug, "true"), this.url = a.href;
2861
2861
  }
2862
- this.id = s, this._parentId = i, this._color = hn(this.id), this._consoleBackgroundColor = o, this._iframe = document.createElement("iframe"), this._iframe.name = this.id;
2862
+ this.id = n, this._parentId = i, this._color = ps(this.id), this._consoleBackgroundColor = o, this._iframe = document.createElement("iframe"), this._iframe.name = this.id;
2863
2863
  const u = this;
2864
2864
  this.iframe = new Promise((l) => {
2865
2865
  Xe().then(async () => {
2866
- var c, d, g, v;
2866
+ var c, d, _, v;
2867
2867
  if (u._iframe) {
2868
- if ((v = (g = (d = (c = this._metapage) == null ? void 0 : c._definition) == null ? void 0 : d.metaframes) == null ? void 0 : g[this.id]) != null && v.allow)
2868
+ if ((v = (_ = (d = (c = this._metapage) == null ? void 0 : c._definition) == null ? void 0 : d.metaframes) == null ? void 0 : _[this.id]) != null && v.allow)
2869
2869
  u._iframe.allow = this._metapage._definition.metaframes[this.id].allow, this._debug && this.log(`mf allow=${u._iframe.allow} from this._metapage?._definition`);
2870
2870
  else {
2871
- let y = Ot(this.url, "definition");
2872
- if (y = y && (y != null && y.version) ? await pt(y) : void 0, !u._iframe)
2871
+ let m = Rt(this.url, "definition");
2872
+ if (m = m && (m != null && m.version) ? await pt(m) : void 0, !u._iframe)
2873
2873
  return;
2874
- if (y != null && y.allow)
2875
- u._iframe.allow = y.allow;
2874
+ if (m != null && m.allow)
2875
+ u._iframe.allow = m.allow;
2876
2876
  else {
2877
- let R = await u.getDefinition();
2878
- if (this._debug && this.log(`mf metaframeDef=${JSON.stringify(R)}`), R = R && (R != null && R.version) ? await pt(R) : void 0, this._debug && this.log(`mf metaframeDef=${JSON.stringify(R)}`), !u._iframe)
2877
+ let S = await u.getDefinition();
2878
+ if (this._debug && this.log(`mf metaframeDef=${JSON.stringify(S)}`), S = S && (S != null && S.version) ? await pt(S) : void 0, this._debug && this.log(`mf metaframeDef=${JSON.stringify(S)}`), !u._iframe)
2879
2879
  return;
2880
- R && R.allow && (u._iframe.allow = R.allow);
2880
+ S && S.allow && (u._iframe.allow = S.allow);
2881
2881
  }
2882
2882
  }
2883
2883
  this._debug && this.log(`mf allow=${u._iframe.allow} from ${this.url}`), u._iframe.src = this.url, l(u._iframe);
@@ -2885,9 +2885,9 @@ class vi extends Rt.EventEmitter {
2885
2885
  });
2886
2886
  }), 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);
2887
2887
  }
2888
- addListenerReturnDisposer(e, n) {
2889
- return super.addListener(e, n), () => {
2890
- super.removeListener(e, n);
2888
+ addListenerReturnDisposer(e, s) {
2889
+ return super.addListener(e, s), () => {
2890
+ super.removeListener(e, s);
2891
2891
  };
2892
2892
  }
2893
2893
  setMetapage(e) {
@@ -2901,62 +2901,62 @@ class vi extends Rt.EventEmitter {
2901
2901
  if (this._definition)
2902
2902
  return this._definition;
2903
2903
  try {
2904
- const n = await wi(this.url);
2905
- if (n)
2906
- return this._definition = n, this._definition;
2907
- } catch (n) {
2904
+ const s = await wi(this.url);
2905
+ if (s)
2906
+ return this._definition = s, this._definition;
2907
+ } catch (s) {
2908
2908
  var e = this.getDefinitionUrl();
2909
2909
  this.emit(x.Warning, `Failed to fetch or convert: ${e}
2910
- Error: ${n != null && n.message ? n == null ? void 0 : n.message : n == null ? void 0 : n.toString()}`);
2910
+ Error: ${s != null && s.message ? s == null ? void 0 : s.message : s == null ? void 0 : s.toString()}`);
2911
2911
  }
2912
2912
  }
2913
- setInput(e, n) {
2913
+ setInput(e, s) {
2914
2914
  console.assert(!!e);
2915
- var s = {};
2916
- s[e] = n, this.setInputs(s);
2915
+ var n = {};
2916
+ n[e] = s, this.setInputs(n);
2917
2917
  }
2918
2918
  setInputs(e) {
2919
2919
  this.log({ m: "MetapageIFrameRpcClient", inputs: e });
2920
- const n = e;
2921
- if (this.inputs = Ge(this.inputs, e), this.inputs === n)
2920
+ const s = e;
2921
+ if (this.inputs = Je(this.inputs, e), this.inputs === s)
2922
2922
  return this;
2923
2923
  if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(e), this.emit(x.Inputs, this.inputs), this._metapage.listenerCount(x.Inputs) > 0) {
2924
- var s = {};
2925
- s[this.id] = e, this._metapage.emit(x.Inputs, s);
2924
+ var n = {};
2925
+ n[this.id] = e, this._metapage.emit(x.Inputs, n);
2926
2926
  }
2927
2927
  return this;
2928
2928
  }
2929
- setOutput(e, n) {
2929
+ setOutput(e, s) {
2930
2930
  console.assert(!!e);
2931
- var s = {};
2932
- s[e] = n, this.setOutputs(s);
2931
+ var n = {};
2932
+ n[e] = s, this.setOutputs(n);
2933
2933
  }
2934
2934
  setOutputs(e) {
2935
- const n = e;
2936
- if (this.outputs = Ge(this.outputs, e), this.outputs === n)
2935
+ const s = e;
2936
+ if (this.outputs = Je(this.outputs, e), this.outputs === s)
2937
2937
  return this;
2938
2938
  if (this.emit(x.Outputs, e), this._metapage.listenerCount(x.Outputs) > 0) {
2939
- var s = {};
2940
- s[this.id] = this.outputs, this._metapage.emit(x.Outputs, s);
2939
+ var n = {};
2940
+ n[this.id] = this.outputs, this._metapage.emit(x.Outputs, n);
2941
2941
  }
2942
2942
  }
2943
2943
  onInputs(e) {
2944
2944
  return this.addListenerReturnDisposer(x.Inputs, e);
2945
2945
  }
2946
- onInput(e, n) {
2947
- var s = function(i) {
2948
- i.hasOwnProperty(e) && n(i[e]);
2946
+ onInput(e, s) {
2947
+ var n = function(i) {
2948
+ i.hasOwnProperty(e) && s(i[e]);
2949
2949
  };
2950
- return this.addListenerReturnDisposer(x.Inputs, s);
2950
+ return this.addListenerReturnDisposer(x.Inputs, n);
2951
2951
  }
2952
2952
  onOutputs(e) {
2953
2953
  return this.addListenerReturnDisposer(x.Outputs, e);
2954
2954
  }
2955
- onOutput(e, n) {
2956
- var s = function(i) {
2957
- i.hasOwnProperty(e) && n(i[e]);
2955
+ onOutput(e, s) {
2956
+ var n = function(i) {
2957
+ i.hasOwnProperty(e) && s(i[e]);
2958
2958
  };
2959
- return this.addListenerReturnDisposer(x.Outputs, s);
2959
+ return this.addListenerReturnDisposer(x.Outputs, n);
2960
2960
  }
2961
2961
  isDisposed() {
2962
2962
  return this.inputs === void 0;
@@ -2975,7 +2975,7 @@ Error: ${n != null && n.message ? n == null ? void 0 : n.message : n == null ? v
2975
2975
  state: {
2976
2976
  inputs: this.inputs
2977
2977
  },
2978
- version: Jt
2978
+ version: Vt
2979
2979
  };
2980
2980
  this.sendRpcInternal(me.SetupIframeServerResponse, e);
2981
2981
  }
@@ -2994,44 +2994,44 @@ Error: ${n != null && n.message ? n == null ? void 0 : n.message : n == null ? v
2994
2994
  parentId: this._parentId
2995
2995
  }));
2996
2996
  }
2997
- sendRpc(e, n) {
2998
- var s, i;
2999
- if ((s = this == null ? void 0 : this._iframe) != null && s.parentNode && this._loaded)
3000
- this.sendRpcInternal(e, n);
2997
+ sendRpc(e, s) {
2998
+ var n, i;
2999
+ if ((n = this == null ? void 0 : this._iframe) != null && n.parentNode && this._loaded)
3000
+ this.sendRpcInternal(e, s);
3001
3001
  else {
3002
3002
  (i = this == null ? void 0 : this._metapage) == null || i.error("sending rpc later");
3003
3003
  const o = this;
3004
3004
  this == null || this._onLoaded.push(() => {
3005
- o.sendRpcInternal(e, n);
3005
+ o.sendRpcInternal(e, s);
3006
3006
  });
3007
3007
  }
3008
3008
  }
3009
3009
  ack(e) {
3010
3010
  if (this._debug) {
3011
3011
  this.log("⚒ ⚒ ⚒ sending ack from client to frame");
3012
- var n = {
3012
+ var s = {
3013
3013
  message: e
3014
3014
  };
3015
- this.sendRpc(me.MessageAck, n);
3015
+ this.sendRpc(me.MessageAck, s);
3016
3016
  }
3017
3017
  }
3018
3018
  log(e) {
3019
3019
  this._debug && this.logInternal(e);
3020
3020
  }
3021
3021
  logInternal(e) {
3022
- let n;
3023
- typeof e == "string" ? n = e : typeof e == "string" ? n = e + "" : n = JSON.stringify(e), At(`Metapage[${this._parentId}] Metaframe[${this.id}] ${n}`, this._color, this._consoleBackgroundColor);
3022
+ let s;
3023
+ typeof e == "string" ? s = e : typeof e == "string" ? s = e + "" : s = JSON.stringify(e), At(`Metapage[${this._parentId}] Metaframe[${this.id}] ${s}`, this._color, this._consoleBackgroundColor);
3024
3024
  }
3025
- sendRpcInternal(e, n) {
3026
- const s = {
3025
+ sendRpcInternal(e, s) {
3026
+ const n = {
3027
3027
  id: "_",
3028
3028
  iframeId: this.id,
3029
3029
  jsonrpc: "2.0",
3030
3030
  method: e,
3031
- params: n,
3031
+ params: s,
3032
3032
  parentId: this._parentId
3033
3033
  };
3034
- 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)}`);
3034
+ this._iframe ? this.sendOrBufferPostMessage(n) : this._metapage ? this._metapage.error(`Cannot send to child iframe messageJSON=${JSON.stringify(n).substring(0, 200)}`) : console.error(`Cannot send to child iframe messageJSON=${JSON.stringify(n).substring(0, 200)}`);
3035
3035
  }
3036
3036
  sendOrBufferPostMessage(e) {
3037
3037
  if (this._iframe && this._iframe.contentWindow)
@@ -3040,9 +3040,9 @@ Error: ${n != null && n.message ? n == null ? void 0 : n.message : n == null ? v
3040
3040
  this._bufferMessages.push(e);
3041
3041
  else {
3042
3042
  this._bufferMessages = [e];
3043
- const n = this;
3043
+ const s = this;
3044
3044
  this._bufferTimeout = window.setInterval(function() {
3045
- 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);
3045
+ s._iframe && s._iframe.contentWindow && (s._bufferMessages.forEach((n) => s._iframe.contentWindow.postMessage(n, s.url)), window.clearInterval(s._bufferTimeout), s._bufferTimeout = void 0, s._bufferMessages = void 0);
3046
3046
  }, 0);
3047
3047
  }
3048
3048
  }
@@ -3052,9 +3052,9 @@ const ge = C({
3052
3052
  inputs: {},
3053
3053
  outputs: {}
3054
3054
  }
3055
- }, (t) => t), Vi = (t) => he(t), Ri = (t, e) => !!(!e || e === "**" || t === e || _i.isMatch(t, e)), Oi = "bcbcbc";
3056
- class ee extends Ns {
3057
- static async from(e, n) {
3055
+ }, (t) => t), Gi = (t) => he(t), Oi = (t, e) => !!(!e || e === "**" || t === e || _i.isMatch(t, e)), Ri = "bcbcbc";
3056
+ class ee extends Nn {
3057
+ static async from(e, s) {
3058
3058
  if (e == null)
3059
3059
  throw "Metapage definition cannot be null";
3060
3060
  if (typeof e == "string")
@@ -3063,32 +3063,32 @@ class ee extends Ns {
3063
3063
  } catch {
3064
3064
  throw "Cannot parse into JSON:\n${metaPageDef}";
3065
3065
  }
3066
- var s = new ee();
3067
- return s.setDefinition(e);
3066
+ var n = new ee();
3067
+ return n.setDefinition(e);
3068
3068
  }
3069
3069
  constructor(e) {
3070
- super(), this._state = ge, this._metaframes = C({}, (n) => n), this.debug = ht(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = C({}, (n) => n), this._inputMap = {}, this._id = e && e.id ? e.id : js(), this._consoleBackgroundColor = e && e.color ? e.color : Oi, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframes = this.getMetaframes.bind(this), this.getState = this.getState.bind(this), this.getStateMetaframes = this.getStateMetaframes.bind(this), this.isValidJSONRpcMessage = this.isValidJSONRpcMessage.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.metaframeIds = this.metaframeIds.bind(this), this.metaframes = this.metaframes.bind(this), this.onMessage = this.onMessage.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this), this.setDefinition = this.setDefinition.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setInputStateOnlyMetaframeInputValue = this.setInputStateOnlyMetaframeInputValue.bind(this), this.setInputStateOnlyMetaframeInputMap = this.setInputStateOnlyMetaframeInputMap.bind(this), this.setInputStateOnlyMetapageInstanceInputs = this.setInputStateOnlyMetapageInstanceInputs.bind(this), this.setOutputStateOnlyMetaframeInputValue = this.setOutputStateOnlyMetaframeInputValue.bind(this), this.setOutputStateOnlyMetaframeInputMap = this.setOutputStateOnlyMetaframeInputMap.bind(this), this.setOutputStateOnlyMetapageInstanceInputs = this.setOutputStateOnlyMetapageInstanceInputs.bind(this), this.setMetadata = this.setMetadata.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), Xe().then(() => {
3070
+ super(), this._state = ge, this._metaframes = C({}, (s) => s), this.debug = ht(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = C({}, (s) => s), this._inputMap = {}, this._id = e && e.id ? e.id : jn(), this._consoleBackgroundColor = e && e.color ? e.color : Ri, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframes = this.getMetaframes.bind(this), this.getState = this.getState.bind(this), this.getStateMetaframes = this.getStateMetaframes.bind(this), this.isValidJSONRpcMessage = this.isValidJSONRpcMessage.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.metaframeIds = this.metaframeIds.bind(this), this.metaframes = this.metaframes.bind(this), this.onMessage = this.onMessage.bind(this), this.onMessageJsonRpc = this.onMessageJsonRpc.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this), this.setDefinition = this.setDefinition.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setOutputs = this.setOutputs.bind(this), this.setMetaframeOutputs = this.setMetaframeOutputs.bind(this), this.setInputStateOnlyMetaframeInputValue = this.setInputStateOnlyMetaframeInputValue.bind(this), this.setInputStateOnlyMetaframeInputMap = this.setInputStateOnlyMetaframeInputMap.bind(this), this.setInputStateOnlyMetapageInstanceInputs = this.setInputStateOnlyMetapageInstanceInputs.bind(this), this.setOutputStateOnlyMetaframeInputValue = this.setOutputStateOnlyMetaframeInputValue.bind(this), this.setOutputStateOnlyMetaframeInputMap = this.setOutputStateOnlyMetaframeInputMap.bind(this), this.setOutputStateOnlyMetapageInstanceInputs = this.setOutputStateOnlyMetapageInstanceInputs.bind(this), this.setMetadata = this.setMetadata.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), Xe().then(() => {
3071
3071
  this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
3072
3072
  });
3073
3073
  }
3074
3074
  isDisposed() {
3075
3075
  return this._metaframes === void 0;
3076
3076
  }
3077
- addListenerReturnDisposer(e, n) {
3078
- return super.addListener(e, n), () => {
3079
- super.removeListener(e, n);
3077
+ addListenerReturnDisposer(e, s) {
3078
+ return super.addListener(e, s), () => {
3079
+ super.removeListener(e, s);
3080
3080
  };
3081
3081
  }
3082
3082
  setDebugFromUrlParams() {
3083
3083
  const e = new URL(window.location.href);
3084
- return this.debug = ["debug", "mp_debug"].reduce((n, s) => n || e.searchParams.get(s) === "true" || e.searchParams.get(s) === "1", !1), this;
3084
+ return this.debug = ["debug", "mp_debug"].reduce((s, n) => s || e.searchParams.get(n) === "true" || e.searchParams.get(n) === "1", !1), this;
3085
3085
  }
3086
3086
  getState() {
3087
3087
  return this._state;
3088
3088
  }
3089
3089
  setState(e) {
3090
- this._state = C(e, (n) => n), this.getMetaframeIds().forEach((n) => {
3091
- this.getMetaframe(n).setInputs(this._state.metaframes.inputs[n]), this.getMetaframe(n).setOutputs(this._state.metaframes.outputs[n]);
3090
+ this._state = C(e, (s) => s), this.getMetaframeIds().forEach((s) => {
3091
+ this.getMetaframe(s).setInputs(this._state.metaframes.inputs[s]), this.getMetaframe(s).setOutputs(this._state.metaframes.outputs[s]);
3092
3092
  }), this.listenerCount(x.State) > 0 && ge !== this._state && this.emit(x.State, this._state);
3093
3093
  }
3094
3094
  getStateMetaframes() {
@@ -3097,34 +3097,34 @@ class ee extends Ns {
3097
3097
  getDefinition() {
3098
3098
  return this._definition;
3099
3099
  }
3100
- async setDefinition(e, n) {
3100
+ async setDefinition(e, s) {
3101
3101
  if (!e.version)
3102
3102
  throw "Metapage definition must have a version";
3103
- const s = await Wn(e);
3103
+ const n = await Vs(e);
3104
3104
  if (this.isDisposed())
3105
3105
  return this;
3106
- s.metaframes && Object.keys(s.metaframes).forEach((o) => {
3107
- var r = s.metaframes[o];
3106
+ n.metaframes && Object.keys(n.metaframes).forEach((o) => {
3107
+ var r = n.metaframes[o];
3108
3108
  if (typeof r != "object")
3109
3109
  throw this.emitErrorMessage(`Metaframe "${o}" is not an object`), `Metaframe "${o}" is not an object`;
3110
3110
  if (!r.url)
3111
3111
  throw this.emitErrorMessage(`Metaframe "${o}" missing field: url`), `Metaframe "${o}" missing field: url`;
3112
3112
  });
3113
3113
  const i = this._definition;
3114
- return this._definition = s, Object.keys(this._metaframes).forEach((o) => {
3115
- (!s.metaframes || !s.metaframes[o]) && this.removeMetaframe(o);
3116
- }), n && (this._state = C(n, (o) => o)), s.metaframes && Object.keys(s.metaframes).forEach((o) => {
3114
+ return this._definition = n, Object.keys(this._metaframes).forEach((o) => {
3115
+ (!n.metaframes || !n.metaframes[o]) && this.removeMetaframe(o);
3116
+ }), s && (this._state = C(s, (o) => o)), n.metaframes && Object.keys(n.metaframes).forEach((o) => {
3117
3117
  if (!this._metaframes.hasOwnProperty(o)) {
3118
- const r = s.metaframes[o];
3118
+ const r = n.metaframes[o];
3119
3119
  this.addMetaframe(o, r);
3120
3120
  }
3121
- }), i !== pn && window.setTimeout(() => {
3122
- !this.isDisposed() && s === this._definition && (this._emitDefinitionEvent(), n && this.listenerCount(x.State) > 0 && ge !== this._state && this.emit(x.State, this._state));
3121
+ }), i !== fs && window.setTimeout(() => {
3122
+ !this.isDisposed() && n === this._definition && (this._emitDefinitionEvent(), s && this.listenerCount(x.State) > 0 && ge !== this._state && this.emit(x.State, this._state));
3123
3123
  }, 0), this;
3124
3124
  }
3125
3125
  setMetadata(e) {
3126
- this._definition = C(this._definition, (n) => {
3127
- n.meta = e;
3126
+ this._definition = C(this._definition, (s) => {
3127
+ s.meta = e;
3128
3128
  }), this._emitDefinitionEvent();
3129
3129
  }
3130
3130
  _emitDefinitionEvent() {
@@ -3136,24 +3136,24 @@ class ee extends Ns {
3136
3136
  this.emit(x.Definition, e);
3137
3137
  }
3138
3138
  }
3139
- addPipe(e, n) {
3140
- this._inputMap = C(this._inputMap, (s) => {
3141
- s[e] || (s[e] = []), s[e].push(n);
3139
+ addPipe(e, s) {
3140
+ this._inputMap = C(this._inputMap, (n) => {
3141
+ n[e] || (n[e] = []), n[e].push(s);
3142
3142
  });
3143
3143
  }
3144
3144
  removeMetaframe(e) {
3145
- this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes = C(this._metaframes, (n) => {
3146
- delete n[e];
3147
- }), this._state = C(this._state, (n) => {
3148
- delete n.metaframes.inputs[e], delete n.metaframes.outputs[e];
3149
- }), this._inputMap = C(this._inputMap, (n) => {
3150
- delete n[e], Object.keys(n).forEach((s) => {
3151
- const i = n[s];
3145
+ this._metaframes[e] && (this._metaframes[e].dispose(), this._metaframes = C(this._metaframes, (s) => {
3146
+ delete s[e];
3147
+ }), this._state = C(this._state, (s) => {
3148
+ delete s.metaframes.inputs[e], delete s.metaframes.outputs[e];
3149
+ }), this._inputMap = C(this._inputMap, (s) => {
3150
+ delete s[e], Object.keys(s).forEach((n) => {
3151
+ const i = s[n];
3152
3152
  let o = 0;
3153
3153
  for (; o <= i.length; )
3154
3154
  i[o] && i[o].metaframe === e ? i.splice(o, 1) : o++;
3155
3155
  });
3156
- }), this._cachedInputLookupMap = C({}, (n) => n));
3156
+ }), this._cachedInputLookupMap = C({}, (s) => s));
3157
3157
  }
3158
3158
  removeAll() {
3159
3159
  Object.keys(this._metaframes).forEach((e) => this._metaframes[e].dispose()), this._metaframes = C({}, (e) => e), this._state = ge, this._inputMap = C({}, (e) => e), this._cachedInputLookupMap = C({}, (e) => e);
@@ -3173,31 +3173,31 @@ class ee extends Ns {
3173
3173
  getMetaframe(e) {
3174
3174
  return this == null ? void 0 : this._metaframes[e];
3175
3175
  }
3176
- addMetaframe(e, n) {
3176
+ addMetaframe(e, s) {
3177
3177
  if (!e)
3178
3178
  throw "addMetaframe missing metaframeId";
3179
- if (!n)
3179
+ if (!s)
3180
3180
  throw "addMetaframe missing definition";
3181
3181
  if (this._metaframes[e])
3182
3182
  throw this.emitErrorMessage(`Existing metaframe for id=${e}`), `Existing metaframe for id=${e}`;
3183
- if (!n.url)
3183
+ if (!s.url)
3184
3184
  throw this.emitErrorMessage(`Metaframe definition missing url id=${e}`), `Metaframe definition missing url id=${e}`;
3185
- var s = new vi(this, n.url, e, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
3185
+ var n = new vi(this, s.url, e, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
3186
3186
  return this._metaframes = C(this._metaframes, (i) => {
3187
- i[e] = s;
3188
- }), s.addListener(x.Error, (i) => {
3187
+ i[e] = n;
3188
+ }), n.addListener(x.Error, (i) => {
3189
3189
  this.emit(x.Error, {
3190
- metaframeId: s.id,
3191
- metaframeUrl: s.url,
3190
+ metaframeId: n.id,
3191
+ metaframeUrl: n.url,
3192
3192
  error: i
3193
3193
  });
3194
- }), n.inputs && n.inputs.forEach((i) => this.addPipe(e, i)), s.setInputs(this._state.metaframes.inputs[e]), s;
3194
+ }), s.inputs && s.inputs.forEach((i) => this.addPipe(e, i)), n.setInputs(this._state.metaframes.inputs[e]), n;
3195
3195
  }
3196
3196
  dispose() {
3197
3197
  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;
3198
3198
  }
3199
- log(e, n, s) {
3200
- this.debug && this.logInternal(e, n, s);
3199
+ log(e, s, n) {
3200
+ this.debug && this.logInternal(e, s, n);
3201
3201
  }
3202
3202
  error(e) {
3203
3203
  this.logInternal(e, "f00", this._consoleBackgroundColor), this.emitErrorMessage(`${e}`);
@@ -3205,39 +3205,39 @@ class ee extends Ns {
3205
3205
  emitErrorMessage(e) {
3206
3206
  this.emit(x.Error, e);
3207
3207
  }
3208
- getInputsFromOutput(e, n) {
3209
- return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap = C(this._cachedInputLookupMap, (s) => {
3210
- s[e] = C({}, (i) => i);
3211
- })), this._cachedInputLookupMap[e][n] || (this._cachedInputLookupMap = C(this._cachedInputLookupMap, (s) => {
3208
+ getInputsFromOutput(e, s) {
3209
+ return this._cachedInputLookupMap[e] || (this._cachedInputLookupMap = C(this._cachedInputLookupMap, (n) => {
3210
+ n[e] = C({}, (i) => i);
3211
+ })), this._cachedInputLookupMap[e][s] || (this._cachedInputLookupMap = C(this._cachedInputLookupMap, (n) => {
3212
3212
  var i = [];
3213
- s[e][n] = i, Object.keys(this._inputMap).forEach((o) => {
3213
+ n[e][s] = i, Object.keys(this._inputMap).forEach((o) => {
3214
3214
  o !== e && this._inputMap[o].forEach((r) => {
3215
- if (r.metaframe === e && Ri(n, r.source)) {
3215
+ if (r.metaframe === e && Oi(s, r.source)) {
3216
3216
  var a = r.target || "";
3217
- !r.target || r.target.startsWith("*") || r.target === "" ? a = n : a && a.endsWith("/") && (a = a + n), i.push({ metaframe: o, pipe: a });
3217
+ !r.target || r.target.startsWith("*") || r.target === "" ? a = s : a && a.endsWith("/") && (a = a + s), i.push({ metaframe: o, pipe: a });
3218
3218
  }
3219
3219
  });
3220
3220
  });
3221
- })), this._cachedInputLookupMap[e][n];
3221
+ })), this._cachedInputLookupMap[e][s];
3222
3222
  }
3223
3223
  isValidJSONRpcMessage(e) {
3224
3224
  if (e.jsonrpc !== "2.0")
3225
3225
  return !1;
3226
3226
  switch (e.method) {
3227
- case q.SetupIframeClientRequest:
3227
+ case X.SetupIframeClientRequest:
3228
3228
  return !0;
3229
3229
  default:
3230
- var s = e.iframeId;
3231
- return s && e.parentId === this._id && !!this._metaframes[s];
3230
+ var n = e.iframeId;
3231
+ return n && e.parentId === this._id && !!this._metaframes[n];
3232
3232
  }
3233
3233
  }
3234
- setInput(e, n, s) {
3234
+ setInput(e, s, n) {
3235
3235
  var i, o;
3236
- 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(x.State) > 0 || this.listenerCount(x.Inputs) > 0) && ge !== this._state && (this.emit(x.State, this._state), this.emit(x.Inputs, (o = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : o.inputs));
3236
+ typeof e == "object" ? this.setInputStateOnlyMetapageInstanceInputs(e) : typeof s == "string" ? this.setInputStateOnlyMetaframeInputValue(e, s, n) : this.setInputStateOnlyMetaframeInputMap(e, s || {}), this.setMetaframeClientInputAndSentClientEvent(e, s, n), (this.listenerCount(x.State) > 0 || this.listenerCount(x.Inputs) > 0) && ge !== this._state && (this.emit(x.State, this._state), this.emit(x.Inputs, (o = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : o.inputs));
3237
3237
  }
3238
- setMetaframeClientInputAndSentClientEvent(e, n, s) {
3238
+ setMetaframeClientInputAndSentClientEvent(e, s, n) {
3239
3239
  if (typeof e == "object") {
3240
- if (n || s)
3240
+ if (s || n)
3241
3241
  throw "bad arguments, see API docs";
3242
3242
  const i = e;
3243
3243
  Object.keys(i).forEach((o) => {
@@ -3249,140 +3249,157 @@ class ee extends Ns {
3249
3249
  });
3250
3250
  } else if (typeof e == "string") {
3251
3251
  const i = this._metaframes[e];
3252
- if (i == null && this.error(`No iframe id=${e}`), typeof n == "string")
3253
- i.setInput(n, s);
3254
- else if (typeof n == "object")
3255
- i.setInputs(n);
3252
+ if (i == null && this.error(`No iframe id=${e}`), typeof s == "string")
3253
+ i.setInput(s, n);
3254
+ else if (typeof s == "object")
3255
+ i.setInputs(s);
3256
3256
  else
3257
3257
  throw "bad arguments, see API docs";
3258
3258
  } else
3259
3259
  throw "bad arguments, see API docs";
3260
3260
  }
3261
- setInputs(e, n, s) {
3262
- this.setInput(e, n, s);
3261
+ setInputs(e, s, n) {
3262
+ this.setInput(e, s, n);
3263
3263
  }
3264
3264
  setOutputStateOnlyMetapageInstanceInputs(e) {
3265
3265
  this._setStateOnlyMetaframes(!1, e);
3266
3266
  }
3267
- setOutputStateOnlyMetaframeInputValue(e, n, s) {
3268
- this._setStateOnlyMetaframeInputValue(!1, e, n, s);
3267
+ setOutputStateOnlyMetaframeInputValue(e, s, n) {
3268
+ this._setStateOnlyMetaframeInputValue(!1, e, s, n);
3269
3269
  }
3270
- setOutputStateOnlyMetaframeInputMap(e, n) {
3271
- this._setStateOnlyMetaframeInputMap(!1, e, n);
3270
+ setOutputStateOnlyMetaframeInputMap(e, s) {
3271
+ this._setStateOnlyMetaframeInputMap(!1, e, s);
3272
3272
  }
3273
3273
  setInputStateOnlyMetapageInstanceInputs(e) {
3274
3274
  this._setStateOnlyMetaframes(!0, e);
3275
3275
  }
3276
- setInputStateOnlyMetaframeInputValue(e, n, s) {
3277
- this._setStateOnlyMetaframeInputValue(!0, e, n, s);
3276
+ setInputStateOnlyMetaframeInputValue(e, s, n) {
3277
+ this._setStateOnlyMetaframeInputValue(!0, e, s, n);
3278
3278
  }
3279
- setInputStateOnlyMetaframeInputMap(e, n) {
3280
- this._setStateOnlyMetaframeInputMap(!0, e, n);
3279
+ setInputStateOnlyMetaframeInputMap(e, s) {
3280
+ this._setStateOnlyMetaframeInputMap(!0, e, s);
3281
3281
  }
3282
- _setStateOnlyMetaframeInputValue(e, n, s, i) {
3282
+ _setStateOnlyMetaframeInputValue(e, s, n, i) {
3283
3283
  this._state = C(this._state, (o) => {
3284
- if (!this._metaframes.hasOwnProperty(n))
3285
- throw `No metaframe: ${n}`;
3284
+ if (!this._metaframes.hasOwnProperty(s))
3285
+ throw `No metaframe: ${s}`;
3286
3286
  o.metaframes || (o.metaframes = { inputs: {}, outputs: {} }), e ? o.metaframes.inputs || (o.metaframes.inputs = {}) : o.metaframes.outputs || (o.metaframes.outputs = {});
3287
3287
  let a = e ? o.metaframes.inputs : o.metaframes.outputs;
3288
- a = a || {}, a[n] = a[n] ? a[n] : {}, i === void 0 ? delete a[n][s] : a[n][s] = i;
3288
+ a = a || {}, a[s] = a[s] ? a[s] : {}, i === void 0 ? delete a[s][n] : a[s][n] = i;
3289
3289
  });
3290
3290
  }
3291
- _setStateOnlyMetaframeInputMap(e, n, s) {
3292
- !s || Object.keys(s).length === 0 || (this._state = C(this._state, (i) => {
3293
- if (!this._metaframes.hasOwnProperty(n))
3294
- throw `No metaframe: ${n}`;
3291
+ _setStateOnlyMetaframeInputMap(e, s, n) {
3292
+ !n || Object.keys(n).length === 0 || (this._state = C(this._state, (i) => {
3293
+ if (!this._metaframes.hasOwnProperty(s))
3294
+ throw `No metaframe: ${s}`;
3295
3295
  let r = e ? i.metaframes.inputs : i.metaframes.outputs;
3296
- r[n] = r[n] ? r[n] : {}, Object.keys(s).forEach((a) => {
3297
- s[a] === void 0 ? delete r[n][a] : r[n][a] = s[a];
3296
+ r[s] = r[s] ? r[s] : {}, Object.keys(n).forEach((a) => {
3297
+ n[a] === void 0 ? delete r[s][a] : r[s][a] = n[a];
3298
3298
  });
3299
3299
  }));
3300
3300
  }
3301
- _setStateOnlyMetaframes(e, n) {
3302
- !n || Object.keys(n).length === 0 || (this._state = C(this._state, (s) => {
3303
- Object.keys(n).forEach((i) => {
3304
- var o = n[i];
3301
+ _setStateOnlyMetaframes(e, s) {
3302
+ !s || Object.keys(s).length === 0 || (this._state = C(this._state, (n) => {
3303
+ Object.keys(s).forEach((i) => {
3304
+ var o = s[i];
3305
3305
  if (typeof o != "object")
3306
3306
  throw "Object values must be objects";
3307
3307
  if (!this._metaframes.hasOwnProperty(i))
3308
3308
  throw "No metaframe: ${metaframeId}";
3309
- const a = e ? s.metaframes.inputs : s.metaframes.outputs;
3309
+ const a = e ? n.metaframes.inputs : n.metaframes.outputs;
3310
3310
  a[i] = a[i] ? a[i] : {}, Object.keys(o).forEach((u) => {
3311
3311
  o[u] === void 0 ? delete a[i][u] : a[i][u] = o[u];
3312
3312
  });
3313
3313
  });
3314
3314
  }));
3315
3315
  }
3316
+ setMetaframeOutputs(e, s) {
3317
+ this.onMessageJsonRpc({
3318
+ iframeId: e,
3319
+ parentId: this._id,
3320
+ jsonrpc: "2.0",
3321
+ method: X.OutputsUpdate,
3322
+ id: "_",
3323
+ params: s
3324
+ });
3325
+ }
3326
+ setOutputs(e) {
3327
+ for (const s in e)
3328
+ this.setMetaframeOutputs(s, e[s]);
3329
+ }
3316
3330
  onMessage(e) {
3317
3331
  if (typeof e.data == "object") {
3318
- const r = e.data;
3319
- if (!this.isValidJSONRpcMessage(r))
3320
- return;
3321
- var n = r.method;
3322
- const a = r.iframeId;
3323
- if (!a || n !== "SetupIframeClientRequest" && r.parentId !== this._id)
3324
- return;
3325
- const u = this.getMetaframe(a);
3326
- if (!u)
3332
+ const s = e.data;
3333
+ if (!this.isValidJSONRpcMessage(s))
3327
3334
  return;
3328
- switch (r._messageCount = ++this._internalReceivedMessageCounter, this.debug && this.log(`processing ${JSON.stringify(r, null, " ").substring(0, 500)}`), n) {
3329
- case q.SetupIframeClientRequest:
3330
- u.register();
3335
+ this.onMessageJsonRpc(s);
3336
+ }
3337
+ }
3338
+ onMessageJsonRpc(e) {
3339
+ var s = e.method;
3340
+ const n = e.iframeId;
3341
+ if (!n || s !== "SetupIframeClientRequest" && e.parentId !== this._id)
3342
+ return;
3343
+ const i = this.getMetaframe(n);
3344
+ if (i) {
3345
+ switch (e._messageCount = ++this._internalReceivedMessageCounter, this.debug && this.log(`processing ${JSON.stringify(e, null, " ").substring(0, 500)}`), s) {
3346
+ case X.SetupIframeClientRequest:
3347
+ i.register();
3331
3348
  break;
3332
- case q.SetupIframeServerResponseAck:
3333
- if (u) {
3334
- const c = r.params;
3335
- u.registered(c.version);
3349
+ case X.SetupIframeServerResponseAck:
3350
+ if (i) {
3351
+ const l = e.params;
3352
+ i.registered(l.version);
3336
3353
  }
3337
3354
  break;
3338
- case q.OutputsUpdate:
3339
- const l = r.params;
3340
- if (!l || Object.keys(l).length === 0)
3355
+ case X.OutputsUpdate:
3356
+ const u = e.params;
3357
+ if (!u || Object.keys(u).length === 0)
3341
3358
  break;
3342
- if (this._metaframes[a]) {
3343
- var s = this._metaframes[a];
3344
- this.setOutputStateOnlyMetaframeInputMap(a, l), s.setOutputs(l);
3345
- var i = !1;
3346
- const c = Object.keys(l), d = {};
3347
- c.forEach((g, v) => {
3348
- const y = this.getInputsFromOutput(a, g);
3349
- y.length > 0 && y.forEach((R) => {
3350
- d[R.metaframe] || (d[R.metaframe] = {}), d[R.metaframe][R.pipe] = l[g], i = !0;
3359
+ if (this._metaframes[n]) {
3360
+ var o = this._metaframes[n];
3361
+ this.setOutputStateOnlyMetaframeInputMap(n, u), o.setOutputs(u);
3362
+ var r = !1;
3363
+ const l = Object.keys(u), c = {};
3364
+ l.forEach((d, _) => {
3365
+ const v = this.getInputsFromOutput(n, d);
3366
+ v.length > 0 && v.forEach((m) => {
3367
+ c[m.metaframe] || (c[m.metaframe] = {}), c[m.metaframe][m.pipe] = u[d], r = !0;
3351
3368
  });
3352
- }), i && (this.setInputStateOnlyMetapageInstanceInputs(d), Object.keys(d).forEach((g) => {
3353
- this._metaframes[g].setInputs(d[g]);
3354
- })), this.listenerCount(x.State) > 0 && ge !== this._state && this.emit(x.State, this._state), this.debug && s.ack({ jsonrpc: r, state: this._state });
3369
+ }), r && (this.setInputStateOnlyMetapageInstanceInputs(c), Object.keys(c).forEach((d) => {
3370
+ this._metaframes[d].setInputs(c[d]);
3371
+ })), this.listenerCount(x.State) > 0 && ge !== this._state && this.emit(x.State, this._state), this.debug && o.ack({ jsonrpc: e, state: this._state });
3355
3372
  } else
3356
- this.error(`missing metaframe=${a}`);
3373
+ this.error(`missing metaframe=${n}`);
3357
3374
  break;
3358
- case q.InputsUpdate:
3359
- var o = r.params;
3360
- this.debug && this.log(`inputs ${JSON.stringify(o)} from ${a}`), this._metaframes[a] ? (this.setInputStateOnlyMetaframeInputMap(a, o), this._metaframes[a].setInputs(o), this.listenerCount(x.State) > 0 && ge !== this._state && this.emit(x.State, this._state), this.debug && this._metaframes[a].ack({
3361
- jsonrpc: r,
3375
+ case X.InputsUpdate:
3376
+ var a = e.params;
3377
+ this.debug && this.log(`inputs ${JSON.stringify(a)} from ${n}`), this._metaframes[n] ? (this.setInputStateOnlyMetaframeInputMap(n, a), this._metaframes[n].setInputs(a), this.listenerCount(x.State) > 0 && ge !== this._state && this.emit(x.State, this._state), this.debug && this._metaframes[n].ack({
3378
+ jsonrpc: e,
3362
3379
  state: this._state
3363
- })) : (console.error(`InputsUpdate failed no metaframe id: "${a}"`), this.error(`InputsUpdate failed no metaframe id: "${a}"`));
3380
+ })) : (console.error(`InputsUpdate failed no metaframe id: "${n}"`), this.error(`InputsUpdate failed no metaframe id: "${n}"`));
3364
3381
  break;
3365
- case q.HashParamsUpdate:
3366
- if (u) {
3367
- const c = r.params, d = new URL(u.url);
3368
- d.hash = c.hash, u.url = d.href, this._definition = C(this._definition, (g) => {
3369
- g.metaframes[c.metaframe].url = d.href;
3382
+ case X.HashParamsUpdate:
3383
+ if (i) {
3384
+ const l = e.params, c = new URL(i.url);
3385
+ c.hash = l.hash, i.url = c.href, this._definition = C(this._definition, (d) => {
3386
+ d.metaframes[l.metaframe].url = c.href;
3370
3387
  }), this._emitDefinitionEvent();
3371
3388
  }
3372
3389
  break;
3373
3390
  default:
3374
- this.debug && this.log(`Unknown RPC method: "${n}"`);
3391
+ this.debug && this.log(`Unknown RPC method: "${s}"`);
3375
3392
  }
3376
- this.listenerCount(x.Message) > 0 && this.emit(x.Message, r);
3393
+ this.listenerCount(x.Message) > 0 && this.emit(x.Message, e);
3377
3394
  }
3378
3395
  }
3379
- logInternal(e, n, s) {
3380
- s = s || this._consoleBackgroundColor;
3396
+ logInternal(e, s, n) {
3397
+ n = n || this._consoleBackgroundColor;
3381
3398
  let i;
3382
- typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), i = this._id ? `Metapage[${this._id}] ${i}` : i, At(i, n, s);
3399
+ typeof e == "string" ? i = e : typeof e == "number" ? i = e + "" : i = JSON.stringify(e), i = this._id ? `Metapage[${this._id}] ${i}` : i, At(i, s, n);
3383
3400
  }
3384
3401
  }
3385
- ee.version = Jt;
3402
+ ee.version = Vt;
3386
3403
  ee.DEFINITION = x.Definition;
3387
3404
  ee.ERROR = x.Error;
3388
3405
  ee.INPUTS = x.Inputs;
@@ -3391,7 +3408,7 @@ ee.OUTPUTS = x.Outputs;
3391
3408
  ee.STATE = x.State;
3392
3409
  ee.deserializeInputs = Ce;
3393
3410
  ee.serializeInputs = Ke;
3394
- function On(t) {
3411
+ function Os(t) {
3395
3412
  return t.startsWith("data:") ? t.includes("type=metapage-divider") : !1;
3396
3413
  }
3397
3414
  function Si(t) {
@@ -3406,73 +3423,76 @@ function Si(t) {
3406
3423
  },
3407
3424
  layout: []
3408
3425
  });
3409
- const n = e.meta.layouts["react-grid-layout"];
3426
+ const s = e.meta.layouts["react-grid-layout"];
3410
3427
  if (e.metaframes) {
3411
3428
  Object.keys(e.metaframes).forEach((i) => {
3412
- if (!n.layout.some((o) => o.i === i)) {
3413
- const o = n.layout.length > 0 ? Math.max(...n.layout.map((r) => (r.y || 0) + (r.h || 2))) : 0;
3414
- n.layout.push({
3429
+ if (!s.layout.some((o) => o.i === i)) {
3430
+ const o = s.layout.length > 0 ? Math.max(...s.layout.map((r) => (r.y || 0) + (r.h || 2))) : 0;
3431
+ s.layout.push({
3415
3432
  i,
3416
3433
  x: 0,
3417
3434
  y: o,
3418
- w: n.props.cols,
3419
- h: On(e.metaframes[i].url) ? 1 : 3
3435
+ w: s.props.cols,
3436
+ h: Os(e.metaframes[i].url) ? 1 : 3
3420
3437
  });
3421
3438
  }
3422
3439
  });
3423
- const s = new Set(Object.keys(e.metaframes));
3424
- n.layout = n.layout.filter((i) => s.has(i.i)), n.layout.forEach((i) => {
3440
+ const n = new Set(Object.keys(e.metaframes));
3441
+ s.layout = s.layout.filter((i) => n.has(i.i)), s.layout.forEach((i) => {
3425
3442
  i.x = i.x || 0, i.y = i.y || 0, i.w = i.w || 1, i.h = i.h || 1;
3426
3443
  });
3427
3444
  }
3428
3445
  return e;
3429
3446
  }
3430
- async function Ji(t) {
3431
- var O, H, S, L, U;
3432
- let { url: e, definition: n, onOutputs: s, rootDiv: i, options: o = {} } = t;
3433
- if (!e && !n)
3447
+ async function Vi(t) {
3448
+ var O, H, R, L, U;
3449
+ let { url: e, definition: s, onOutputs: n, rootDiv: i, options: o = {} } = t;
3450
+ if (!e && !s)
3434
3451
  throw new Error("Either url or definition must be provided");
3435
- if (e && n)
3452
+ if (e && s)
3436
3453
  throw new Error("Either url or definition must be provided, not both");
3437
- if (e && (n = await bi(e)), !n)
3454
+ if (e && (s = await bi(e)), !s)
3438
3455
  throw new Error("Failed to fetch metapage definition");
3439
- n = Si(n), n = await Ei(n), await Xe();
3456
+ s = Si(s), s = await Ei(s), await Xe();
3440
3457
  const r = new ee();
3441
3458
  r.debug = o.debug || !1;
3442
3459
  try {
3443
- await r.setDefinition(JSON.parse(JSON.stringify(n)));
3460
+ await r.setDefinition(JSON.parse(JSON.stringify(s)));
3444
3461
  } catch (f) {
3445
3462
  throw r.dispose(), new Error(`Failed to set metapage definition: ${f}`);
3446
3463
  }
3447
3464
  const a = [];
3448
- s && a.push(r.addListenerReturnDisposer(x.Outputs, s));
3449
- const u = (H = (O = n == null ? void 0 : n.meta) == null ? void 0 : O.layouts) == null ? void 0 : H["react-grid-layout"], l = u == null ? void 0 : u.layout;
3465
+ n && a.push(r.addListenerReturnDisposer(x.Outputs, n));
3466
+ const u = (H = (O = s == null ? void 0 : s.meta) == null ? void 0 : O.layouts) == null ? void 0 : H["react-grid-layout"], l = u == null ? void 0 : u.layout;
3450
3467
  if (!u || !l)
3451
3468
  throw new Error("No valid layout found in metapage definition");
3452
3469
  const c = /* @__PURE__ */ new Set(), d = l.map((f, M) => {
3453
3470
  const I = r.getMetaframes()[f.i];
3454
- return I && On(I.url) ? { index: M, y: f.y, id: f.i } : null;
3471
+ return I && Os(I.url) ? { index: M, y: f.y, id: f.i } : null;
3455
3472
  }).filter((f) => f !== null);
3456
3473
  if (d.length > 0) {
3457
- const f = d.reduce((I, B) => B.y < I.y ? B : I), M = ((S = l.find((I) => I.i === f.id)) == null ? void 0 : S.y) ?? 0;
3474
+ const f = d.reduce((I, B) => B.y < I.y ? B : I), M = ((R = l.find((I) => I.i === f.id)) == null ? void 0 : R.y) ?? 0;
3458
3475
  l.forEach((I) => {
3459
3476
  I.y >= M && c.add(I.i);
3460
3477
  });
3461
3478
  }
3462
- const g = r.getMetaframeIds().filter((f) => !c.has(f));
3463
- let v = l.filter((f) => g.includes(f.i));
3479
+ const _ = r.getMetaframeIds().filter((f) => !c.has(f));
3480
+ let v = l.filter((f) => _.includes(f.i));
3464
3481
  if (v.length === 0)
3465
3482
  return {
3466
3483
  metapage: r,
3467
3484
  setInputs: (f) => {
3468
3485
  r.isDisposed() || r.setInputs(f);
3469
3486
  },
3487
+ setOutputs: (f) => {
3488
+ r.isDisposed() || r.setOutputs(f);
3489
+ },
3470
3490
  dispose: () => {
3471
3491
  a.forEach((f) => f()), r.dispose(), i.innerHTML = "";
3472
3492
  }
3473
3493
  };
3474
3494
  v.sort((f, M) => f.y !== M.y ? f.y - M.y : f.x - M.x);
3475
- const y = {
3495
+ const m = {
3476
3496
  display: "grid",
3477
3497
  gridTemplateColumns: "repeat(1, 1fr)",
3478
3498
  gridAutoRows: "1fr",
@@ -3485,7 +3505,7 @@ async function Ji(t) {
3485
3505
  alignContent: "start",
3486
3506
  alignItems: "start",
3487
3507
  overflow: "hidden"
3488
- }, R = {
3508
+ }, S = {
3489
3509
  width: "100%",
3490
3510
  height: "100%",
3491
3511
  overflow: "hidden",
@@ -3494,11 +3514,11 @@ async function Ji(t) {
3494
3514
  };
3495
3515
  i.innerHTML = "";
3496
3516
  const w = document.createElement("div");
3497
- Object.assign(w.style, R);
3517
+ Object.assign(w.style, S);
3498
3518
  const $ = document.createElement("div");
3499
- Object.assign($.style, y);
3519
+ Object.assign($.style, m);
3500
3520
  const b = [];
3501
- for (const f of g) {
3521
+ for (const f of _) {
3502
3522
  const M = l.find((W) => W.i === f);
3503
3523
  if (!M)
3504
3524
  continue;
@@ -3537,38 +3557,41 @@ async function Ji(t) {
3537
3557
  setInputs: (f) => {
3538
3558
  r.isDisposed() || r.setInputs(f);
3539
3559
  },
3560
+ setOutputs: (f) => {
3561
+ r.isDisposed() || r.setOutputs(f);
3562
+ },
3540
3563
  dispose: () => {
3541
3564
  a.forEach((f) => f()), r.dispose(), i.innerHTML = "";
3542
3565
  }
3543
3566
  };
3544
3567
  }
3545
3568
  const Ai = (t) => {
3546
- var n;
3569
+ var s;
3547
3570
  if (!t)
3548
3571
  return;
3549
3572
  typeof t == "string" && (t.startsWith("/") && (t = "https://metapage.io" + t), t = new URL(t));
3550
- let e = (n = /\/m?f\/([0-9a-zA-Z-]{3,})\/?(metaframe\.json)?.*$/g.exec(t.pathname)) == null ? void 0 : n[1];
3573
+ let e = (s = /\/m?f\/([0-9a-zA-Z-]{3,})\/?(metaframe\.json)?.*$/g.exec(t.pathname)) == null ? void 0 : s[1];
3551
3574
  return e || (t.searchParams.get("mfk") ?? void 0);
3552
3575
  }, Ei = async (t) => {
3553
3576
  if (!(t != null && t.metaframes))
3554
3577
  return t;
3555
- for (const [e, n] of Object.entries(t.metaframes)) {
3556
- if (!(n.url.startsWith("https://metapage.io/mf/") || n.url.startsWith("https://metapage.io/f/")))
3578
+ for (const [e, s] of Object.entries(t.metaframes)) {
3579
+ if (!(s.url.startsWith("https://metapage.io/mf/") || s.url.startsWith("https://metapage.io/f/")))
3557
3580
  continue;
3558
- const s = Ai(n.url);
3559
- if (!s)
3581
+ const n = Ai(s.url);
3582
+ if (!n)
3560
3583
  continue;
3561
- const i = await fetch(`https://metapage.io/f/${s}/definition.json`).then((o) => o.json());
3562
- i != null && i.url && (n.url = i == null ? void 0 : i.url);
3584
+ const i = await fetch(`https://metapage.io/f/${n}/definition.json`).then((o) => o.json());
3585
+ i != null && i.url && (s.url = i == null ? void 0 : i.url);
3563
3586
  }
3564
3587
  return t;
3565
3588
  };
3566
3589
  export {
3567
- pn as INITIAL_NULL_METAPAGE_DEFINITION,
3590
+ fs as INITIAL_NULL_METAPAGE_DEFINITION,
3568
3591
  ki as INTERNAL_ERROR,
3569
3592
  Di as INVALID_PARAMS,
3570
3593
  Ti as INVALID_REQUEST,
3571
- q as JsonRpcMethodsFromChild,
3594
+ X as JsonRpcMethodsFromChild,
3572
3595
  me as JsonRpcMethodsFromParent,
3573
3596
  Mi as METAFRAME_JSON_FILE,
3574
3597
  Ii as METAPAGE_KEY_DEFINITION,
@@ -3583,48 +3606,48 @@ export {
3583
3606
  x as MetapageEvents,
3584
3607
  xe as MetapageHashParams,
3585
3608
  vi as MetapageIFrameRpcClient,
3586
- Ns as MetapageShared,
3609
+ Nn as MetapageShared,
3587
3610
  Le as MetapageVersionCurrent,
3588
3611
  Ct as MetapageVersionsAll,
3589
3612
  Li as PARSE_ERROR,
3590
- En as VERSION_METAFRAME,
3591
- Jt as VERSION_METAPAGE,
3592
- ns as convertMetaframeDefinitionToCurrentVersion,
3593
- nn as convertMetaframeDefinitionToVersion,
3613
+ As as VERSION_METAFRAME,
3614
+ Vt as VERSION_METAPAGE,
3615
+ tn as convertMetaframeDefinitionToCurrentVersion,
3616
+ ss as convertMetaframeDefinitionToVersion,
3594
3617
  pt as convertMetaframeJsonToCurrentVersion,
3595
- Wn as convertMetapageDefinitionToCurrentVersion,
3596
- tn as convertMetapageDefinitionToVersion,
3618
+ Vs as convertMetapageDefinitionToCurrentVersion,
3619
+ ts as convertMetapageDefinitionToVersion,
3597
3620
  Ce as deserializeInputs,
3598
3621
  St as generateId,
3599
3622
  Ui as generateMetaframeId,
3600
- js as generateMetapageId,
3623
+ jn as generateMetapageId,
3601
3624
  Bi as generateNonce,
3602
- Vi as getLibraryVersionMatching,
3625
+ Gi as getLibraryVersionMatching,
3603
3626
  te as getMatchingMetaframeVersion,
3604
3627
  he as getMatchingMetapageVersion,
3605
3628
  wi as getMetaframeDefinitionFromUrl,
3606
3629
  bi as getMetapageDefinitionFromUrl,
3607
3630
  Ni as getUrlParam,
3608
3631
  ji as getUrlParamDebug,
3609
- Us as hashCode,
3610
- Bs as intToRGB,
3632
+ Un as hashCode,
3633
+ Bn as intToRGB,
3611
3634
  ht as isDebugFromUrlsParams,
3612
- Gi as isEmptyMetaframeDefinition,
3613
- Hs as isIframe,
3635
+ Ji as isEmptyMetaframeDefinition,
3636
+ Hn as isIframe,
3614
3637
  Hi as isJsonRpcId,
3615
3638
  tt as isPageLoaded,
3616
3639
  At as log,
3617
- Ri as matchPipe,
3618
- Ge as merge,
3640
+ Oi as matchPipe,
3641
+ Je as merge,
3619
3642
  Fi as metapageAllSha256Hash,
3620
3643
  zi as metapageOnlyEssentailSha256Hash,
3621
3644
  Xe as pageLoaded,
3622
3645
  xi as possiblyDeserializeDatarefToFile,
3623
- sn as possiblyDeserializeDatarefToValue,
3624
- ds as possiblySerializeValueToDataref,
3625
- Ji as renderMetapage,
3646
+ ns as possiblyDeserializeDatarefToValue,
3647
+ dn as possiblySerializeValueToDataref,
3648
+ Vi as renderMetapage,
3626
3649
  Ke as serializeInputs,
3627
- hn as stringToRgb,
3650
+ ps as stringToRgb,
3628
3651
  $i as valueToFile
3629
3652
  };
3630
3653
  //# sourceMappingURL=index.js.map