@metapages/metapage 1.4.0 → 1.4.2

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
@@ -452,7 +452,7 @@ function Dn({ original: e, copy: t, assignedMap: n }, s, i, o, r) {
452
452
  i.push(d === B.Remove ? { op: d, path: w } : { op: d, path: w, value: c }), o.push(d === B.Add ? { op: B.Remove, path: w } : d === B.Remove ? { op: B.Add, path: w, value: f } : { op: B.Replace, path: w, value: f });
453
453
  });
454
454
  }
455
- function Hn({ original: e, copy: t }, n, s, i, o) {
455
+ function kn({ original: e, copy: t }, n, s, i, o) {
456
456
  let r = 0;
457
457
  e.forEach((a) => {
458
458
  if (!t.has(a)) {
@@ -493,12 +493,12 @@ function $e(e, t, n, s) {
493
493
  case 1:
494
494
  return Tn(e, t, n, s, i);
495
495
  case 3:
496
- return Hn(e, t, n, s, i);
496
+ return kn(e, t, n, s, i);
497
497
  }
498
498
  }
499
- let kn = !1;
499
+ let Hn = !1;
500
500
  const Fe = (e, t, n = !1) => {
501
- if (typeof e == "object" && e !== null && (!ee(e, t) || n) && !kn)
501
+ if (typeof e == "object" && e !== null && (!ee(e, t) || n) && !Hn)
502
502
  throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.");
503
503
  }, at = {
504
504
  get size() {
@@ -1620,9 +1620,9 @@ const ze = (e, t) => t ? C(e, (n) => {
1620
1620
  }) : e, Ii = (e) => window.location.search ? new URLSearchParams(window.location.search).get(e) : null, Ci = () => new URLSearchParams(window.location.search).has(xe.mp_debug), ft = () => {
1621
1621
  const e = new URLSearchParams(window.location.search).get(xe.mp_debug);
1622
1622
  return e === "true" || e === "1";
1623
- }, $i = (e = 8) => wt(e), Ts = (e = 8) => wt(e), xi = (e = 8) => wt(e), Ht = "abcdefghijklmnopqrstuvwxyz0123456789", wt = (e = 8) => {
1624
- for (var t = "", n = Ht.length, s = 0; s < e; s++)
1625
- t += Ht.charAt(Math.floor(Math.random() * n));
1623
+ }, $i = (e = 8) => wt(e), Ts = (e = 8) => wt(e), xi = (e = 8) => wt(e), kt = "abcdefghijklmnopqrstuvwxyz0123456789", wt = (e = 8) => {
1624
+ for (var t = "", n = kt.length, s = 0; s < e; s++)
1625
+ t += kt.charAt(Math.floor(Math.random() * n));
1626
1626
  return t;
1627
1627
  }, Rt = (e, t, n) => {
1628
1628
  t = t || "000", t && t.trim() == "" && (t = void 0);
@@ -1632,12 +1632,12 @@ const ze = (e, t) => t ? C(e, (n) => {
1632
1632
  n && (i = `${i}; background: #${n}`), s = `%c${s}`, window.console.log(s, i);
1633
1633
  } else
1634
1634
  window.console.log(s);
1635
- }, ln = (e) => Hs(Ds(e)), Ds = (e) => {
1635
+ }, ln = (e) => ks(Ds(e)), Ds = (e) => {
1636
1636
  var t = 0;
1637
1637
  for (let n = 0; n < e.length; n++)
1638
1638
  t = e.charCodeAt(n) + ((t << 5) - t);
1639
1639
  return t;
1640
- }, Hs = (e) => {
1640
+ }, ks = (e) => {
1641
1641
  var t = (e & 16777215).toString(16).toUpperCase();
1642
1642
  return "00000".substring(0, 6 - t.length) + t;
1643
1643
  }, Ze = () => document.readyState == "complete" || document.readyState == "interactive", Ot = async () => Ze() ? Promise.resolve() : new Promise((e) => {
@@ -1885,9 +1885,9 @@ te.MESSAGE = U.Message;
1885
1885
  te.deserializeInputs = Ce;
1886
1886
  te.serializeInputs = We;
1887
1887
  var Ke = {};
1888
- const ie = "\\\\/", kt = `[^${ie}]`, ce = "\\.", ks = "\\+", Ns = "\\?", Xe = "\\/", js = "(?=.)", hn = "[^/]", At = `(?:${Xe}|$)`, dn = `(?:^|${Xe})`, St = `${ce}{1,2}${At}`, Us = `(?!${ce})`, Bs = `(?!${dn}${St})`, Fs = `(?!${ce}{0,1}${At})`, zs = `(?!${St})`, Gs = `[^.${Xe}]`, Vs = `${hn}*?`, Js = "/", mn = {
1888
+ const ie = "\\\\/", Ht = `[^${ie}]`, ce = "\\.", Hs = "\\+", Ns = "\\?", Xe = "\\/", js = "(?=.)", hn = "[^/]", At = `(?:${Xe}|$)`, dn = `(?:^|${Xe})`, St = `${ce}{1,2}${At}`, Us = `(?!${ce})`, Bs = `(?!${dn}${St})`, Fs = `(?!${ce}{0,1}${At})`, zs = `(?!${St})`, Gs = `[^.${Xe}]`, Vs = `${hn}*?`, Js = "/", mn = {
1889
1889
  DOT_LITERAL: ce,
1890
- PLUS_LITERAL: ks,
1890
+ PLUS_LITERAL: Hs,
1891
1891
  QMARK_LITERAL: Ns,
1892
1892
  SLASH_LITERAL: Xe,
1893
1893
  ONE_CHAR: js,
@@ -1905,8 +1905,8 @@ const ie = "\\\\/", kt = `[^${ie}]`, ce = "\\.", ks = "\\+", Ns = "\\?", Xe = "\
1905
1905
  }, Ws = {
1906
1906
  ...mn,
1907
1907
  SLASH_LITERAL: `[${ie}]`,
1908
- QMARK: kt,
1909
- STAR: `${kt}*?`,
1908
+ QMARK: Ht,
1909
+ STAR: `${Ht}*?`,
1910
1910
  DOTS_SLASH: `${ce}{1,2}(?:[${ie}]|$)`,
1911
1911
  NO_DOT: `(?!${ce})`,
1912
1912
  NO_DOTS: `(?!(?:^|[${ie}])${ce}{1,2}(?:[${ie}]|$))`,
@@ -2114,25 +2114,25 @@ const Nt = Ke, {
2114
2114
  }, ti = (e, t) => {
2115
2115
  const n = t || {}, s = e.length - 1, i = n.parts === !0 || n.scanToEnd === !0, o = [], r = [], a = [];
2116
2116
  let u = e, f = -1, c = 0, d = 0, y = !1, w = !1, _ = !1, S = !1, v = !1, x = !1, b = !1, A = !1, M = !1, R = 0, D, O, L = { value: "", depth: 0, isGlob: !1 };
2117
- const z = () => f >= s, h = () => u.charCodeAt(f + 1), k = () => (D = O, u.charCodeAt(++f));
2117
+ const z = () => f >= s, h = () => u.charCodeAt(f + 1), H = () => (D = O, u.charCodeAt(++f));
2118
2118
  for (; f < s; ) {
2119
- O = k();
2119
+ O = H();
2120
2120
  let J;
2121
2121
  if (O === Me) {
2122
- b = L.backslashes = !0, O = k(), O === nt && (x = !0);
2122
+ b = L.backslashes = !0, O = H(), O === nt && (x = !0);
2123
2123
  continue;
2124
2124
  }
2125
2125
  if (x === !0 || O === nt) {
2126
- for (R++; z() !== !0 && (O = k()); ) {
2126
+ for (R++; z() !== !0 && (O = H()); ) {
2127
2127
  if (O === Me) {
2128
- b = L.backslashes = !0, k();
2128
+ b = L.backslashes = !0, H();
2129
2129
  continue;
2130
2130
  }
2131
2131
  if (O === nt) {
2132
2132
  R++;
2133
2133
  continue;
2134
2134
  }
2135
- if (x !== !0 && O === tt && (O = k()) === tt) {
2135
+ if (x !== !0 && O === tt && (O = H()) === tt) {
2136
2136
  if (y = L.isBrace = !0, _ = L.isGlob = !0, M = !0, i === !0)
2137
2137
  continue;
2138
2138
  break;
@@ -2163,9 +2163,9 @@ const Nt = Ke, {
2163
2163
  }
2164
2164
  if (n.noext !== !0 && (O === Ys || O === Xs || O === et || O === Ut || O === jt) === !0 && h() === st) {
2165
2165
  if (_ = L.isGlob = !0, S = L.isExtglob = !0, M = !0, i === !0) {
2166
- for (; z() !== !0 && (O = k()); ) {
2166
+ for (; z() !== !0 && (O = H()); ) {
2167
2167
  if (O === Me) {
2168
- b = L.backslashes = !0, O = k();
2168
+ b = L.backslashes = !0, O = H();
2169
2169
  continue;
2170
2170
  }
2171
2171
  if (O === Bt) {
@@ -2188,9 +2188,9 @@ const Nt = Ke, {
2188
2188
  break;
2189
2189
  }
2190
2190
  if (O === Qs)
2191
- for (; z() !== !0 && (J = k()); ) {
2191
+ for (; z() !== !0 && (J = H()); ) {
2192
2192
  if (J === Me) {
2193
- b = L.backslashes = !0, k();
2193
+ b = L.backslashes = !0, H();
2194
2194
  continue;
2195
2195
  }
2196
2196
  if (J === ei) {
@@ -2205,9 +2205,9 @@ const Nt = Ke, {
2205
2205
  }
2206
2206
  if (n.noparen !== !0 && O === st) {
2207
2207
  if (_ = L.isGlob = !0, i === !0) {
2208
- for (; z() !== !0 && (O = k()); ) {
2208
+ for (; z() !== !0 && (O = H()); ) {
2209
2209
  if (O === st) {
2210
- b = L.backslashes = !0, O = k();
2210
+ b = L.backslashes = !0, O = H();
2211
2211
  continue;
2212
2212
  }
2213
2213
  if (O === Bt) {
@@ -2226,13 +2226,13 @@ const Nt = Ke, {
2226
2226
  }
2227
2227
  }
2228
2228
  n.noext === !0 && (S = !1, _ = !1);
2229
- let H = u, he = "", l = "";
2230
- c > 0 && (he = u.slice(0, c), u = u.slice(c), d -= c), H && _ === !0 && d > 0 ? (H = u.slice(0, d), l = u.slice(d)) : _ === !0 ? (H = "", l = u) : H = u, H && H !== "" && H !== "/" && H !== u && Ft(H.charCodeAt(H.length - 1)) && (H = H.slice(0, -1)), n.unescape === !0 && (l && (l = Nt.removeBackslashes(l)), H && b === !0 && (H = Nt.removeBackslashes(H)));
2229
+ let k = u, he = "", l = "";
2230
+ c > 0 && (he = u.slice(0, c), u = u.slice(c), d -= c), k && _ === !0 && d > 0 ? (k = u.slice(0, d), l = u.slice(d)) : _ === !0 ? (k = "", l = u) : k = u, k && k !== "" && k !== "/" && k !== u && Ft(k.charCodeAt(k.length - 1)) && (k = k.slice(0, -1)), n.unescape === !0 && (l && (l = Nt.removeBackslashes(l)), k && b === !0 && (k = Nt.removeBackslashes(k)));
2231
2231
  const p = {
2232
2232
  prefix: he,
2233
2233
  input: e,
2234
2234
  start: c,
2235
- base: H,
2235
+ base: k,
2236
2236
  glob: l,
2237
2237
  isBrace: y,
2238
2238
  isBracket: w,
@@ -2315,7 +2315,7 @@ const Ge = qe, Z = Ke, {
2315
2315
  tokens: r
2316
2316
  };
2317
2317
  e = Z.removePrefix(e, h), i = e.length;
2318
- const k = [], H = [], he = [];
2318
+ const H = [], k = [], he = [];
2319
2319
  let l = o, p;
2320
2320
  const J = () => h.index === i - 1, T = h.peek = (g = 1) => e[h.index + g], se = h.advance = () => e[++h.index], ae = () => e.slice(h.index + 1), q = (g = "", N = 0) => {
2321
2321
  h.consumed += g, h.index += N;
@@ -2332,19 +2332,19 @@ const Ge = qe, Z = Ke, {
2332
2332
  h[g]--, he.pop();
2333
2333
  }, I = (g) => {
2334
2334
  if (l.type === "globstar") {
2335
- const N = h.braces > 0 && (g.type === "comma" || g.type === "brace"), m = g.extglob === !0 || k.length && (g.type === "pipe" || g.type === "paren");
2335
+ const N = h.braces > 0 && (g.type === "comma" || g.type === "brace"), m = g.extglob === !0 || H.length && (g.type === "pipe" || g.type === "paren");
2336
2336
  g.type !== "slash" && g.type !== "paren" && !N && !m && (h.output = h.output.slice(0, -l.output.length), l.type = "star", l.value = "*", l.output = z, h.output += l.output);
2337
2337
  }
2338
- if (k.length && g.type !== "paren" && !f[g.value] && (k[k.length - 1].inner += g.value), (g.value || g.output) && Te(g), l && l.type === "text" && g.type === "text") {
2338
+ if (H.length && g.type !== "paren" && !f[g.value] && (H[H.length - 1].inner += g.value), (g.value || g.output) && Te(g), l && l.type === "text" && g.type === "text") {
2339
2339
  l.value += g.value, l.output = (l.output || "") + g.value;
2340
2340
  return;
2341
2341
  }
2342
2342
  g.prev = l, r.push(g), l = g;
2343
- }, He = (g, N) => {
2343
+ }, ke = (g, N) => {
2344
2344
  const m = { ...f[N], conditions: 1, inner: "" };
2345
2345
  m.prev = l, m.parens = h.parens, m.output = h.output;
2346
2346
  const P = (n.capture ? "(" : "") + m.open;
2347
- De("parens"), I({ type: g, value: N, output: h.output ? "" : w }), I({ type: "paren", extglob: !0, value: se(), output: P }), k.push(m);
2347
+ De("parens"), I({ type: g, value: N, output: h.output ? "" : w }), I({ type: "paren", extglob: !0, value: se(), output: P }), H.push(m);
2348
2348
  }, Rn = (g) => {
2349
2349
  let N = g.close + (n.capture ? ")" : "");
2350
2350
  if (g.type === "negate") {
@@ -2404,9 +2404,9 @@ const Ge = qe, Z = Ke, {
2404
2404
  if (p === ")") {
2405
2405
  if (h.parens === 0 && n.strictBrackets === !0)
2406
2406
  throw new SyntaxError(ve("opening", "("));
2407
- const m = k[k.length - 1];
2407
+ const m = H[H.length - 1];
2408
2408
  if (m && h.parens === m.parens + 1) {
2409
- Rn(k.pop());
2409
+ Rn(H.pop());
2410
2410
  continue;
2411
2411
  }
2412
2412
  I({ type: "paren", value: p, output: h.parens ? ")" : "\\)" }), me("parens");
@@ -2454,11 +2454,11 @@ const Ge = qe, Z = Ke, {
2454
2454
  outputIndex: h.output.length,
2455
2455
  tokensIndex: h.tokens.length
2456
2456
  };
2457
- H.push(m), I(m);
2457
+ k.push(m), I(m);
2458
2458
  continue;
2459
2459
  }
2460
2460
  if (p === "}") {
2461
- const m = H[H.length - 1];
2461
+ const m = k[k.length - 1];
2462
2462
  if (n.nobrace === !0 || !m) {
2463
2463
  I({ type: "text", value: p, output: p });
2464
2464
  continue;
@@ -2476,16 +2476,16 @@ const Ge = qe, Z = Ke, {
2476
2476
  for (const G of W)
2477
2477
  h.output += G.output || G.value;
2478
2478
  }
2479
- I({ type: "brace", value: p, output: P }), me("braces"), H.pop();
2479
+ I({ type: "brace", value: p, output: P }), me("braces"), k.pop();
2480
2480
  continue;
2481
2481
  }
2482
2482
  if (p === "|") {
2483
- k.length > 0 && k[k.length - 1].conditions++, I({ type: "text", value: p });
2483
+ H.length > 0 && H[H.length - 1].conditions++, I({ type: "text", value: p });
2484
2484
  continue;
2485
2485
  }
2486
2486
  if (p === ",") {
2487
2487
  let m = p;
2488
- const P = H[H.length - 1];
2488
+ const P = k[k.length - 1];
2489
2489
  P && he[he.length - 1] === "braces" && (P.comma = !0, m = "|"), I({ type: "comma", value: p, output: m });
2490
2490
  continue;
2491
2491
  }
@@ -2500,7 +2500,7 @@ const Ge = qe, Z = Ke, {
2500
2500
  if (p === ".") {
2501
2501
  if (h.braces > 0 && l.type === "dot") {
2502
2502
  l.value === "." && (l.output = c);
2503
- const m = H[H.length - 1];
2503
+ const m = k[k.length - 1];
2504
2504
  l.type = "dots", l.output += p, l.value += p, m.dots = !0;
2505
2505
  continue;
2506
2506
  }
@@ -2513,7 +2513,7 @@ const Ge = qe, Z = Ke, {
2513
2513
  }
2514
2514
  if (p === "?") {
2515
2515
  if (!(l && l.value === "(") && n.noextglob !== !0 && T() === "(" && T(2) !== "?") {
2516
- He("qmark", p);
2516
+ ke("qmark", p);
2517
2517
  continue;
2518
2518
  }
2519
2519
  if (l && l.type === "paren") {
@@ -2533,7 +2533,7 @@ const Ge = qe, Z = Ke, {
2533
2533
  }
2534
2534
  if (p === "!") {
2535
2535
  if (n.noextglob !== !0 && T() === "(" && (T(2) !== "?" || !/[!=<:]/.test(T(3)))) {
2536
- He("negate", p);
2536
+ ke("negate", p);
2537
2537
  continue;
2538
2538
  }
2539
2539
  if (n.nonegate !== !0 && h.index === 0) {
@@ -2543,7 +2543,7 @@ const Ge = qe, Z = Ke, {
2543
2543
  }
2544
2544
  if (p === "+") {
2545
2545
  if (n.noextglob !== !0 && T() === "(" && T(2) !== "?") {
2546
- He("plus", p);
2546
+ ke("plus", p);
2547
2547
  continue;
2548
2548
  }
2549
2549
  if (l && l.value === "(" || n.regex === !1) {
@@ -2577,7 +2577,7 @@ const Ge = qe, Z = Ke, {
2577
2577
  }
2578
2578
  let g = ae();
2579
2579
  if (n.noextglob !== !0 && /^\([^?]/.test(g)) {
2580
- He("star", p);
2580
+ ke("star", p);
2581
2581
  continue;
2582
2582
  }
2583
2583
  if (l.type === "star") {
@@ -2590,14 +2590,14 @@ const Ge = qe, Z = Ke, {
2590
2590
  I({ type: "star", value: p, output: "" });
2591
2591
  continue;
2592
2592
  }
2593
- const G = h.braces > 0 && (m.type === "comma" || m.type === "brace"), Qe = k.length && (m.type === "pipe" || m.type === "paren");
2593
+ const G = h.braces > 0 && (m.type === "comma" || m.type === "brace"), Qe = H.length && (m.type === "pipe" || m.type === "paren");
2594
2594
  if (!j && m.type !== "paren" && !G && !Qe) {
2595
2595
  I({ type: "star", value: p, output: "" });
2596
2596
  continue;
2597
2597
  }
2598
2598
  for (; g.slice(0, 3) === "/**"; ) {
2599
- const ke = e[h.index + 4];
2600
- if (ke && ke !== "/")
2599
+ const He = e[h.index + 4];
2600
+ if (He && He !== "/")
2601
2601
  break;
2602
2602
  g = g.slice(3), q("/**", 3);
2603
2603
  }
@@ -2610,8 +2610,8 @@ const Ge = qe, Z = Ke, {
2610
2610
  continue;
2611
2611
  }
2612
2612
  if (m.type === "slash" && m.prev.type !== "bos" && g[0] === "/") {
2613
- const ke = g[1] !== void 0 ? "|$" : "";
2614
- h.output = h.output.slice(0, -(m.output + l.output).length), m.output = `(?:${m.output}`, l.type = "globstar", l.output = `${D(n)}${y}|${y}${ke})`, l.value += p, h.output += m.output + l.output, h.globstar = !0, q(p + se()), I({ type: "slash", value: "/", output: "" });
2613
+ const He = g[1] !== void 0 ? "|$" : "";
2614
+ h.output = h.output.slice(0, -(m.output + l.output).length), m.output = `(?:${m.output}`, l.type = "globstar", l.output = `${D(n)}${y}|${y}${He})`, l.value += p, h.output += m.output + l.output, h.globstar = !0, q(p + se()), I({ type: "slash", value: "/", output: "" });
2615
2615
  continue;
2616
2616
  }
2617
2617
  if (m.type === "bos" && g[0] === "/") {
@@ -3328,7 +3328,7 @@ const vn = dt(fetch), Di = async (e, t) => {
3328
3328
  retryDelay: 1e3
3329
3329
  })).json();
3330
3330
  return await Zt(i, t || "1");
3331
- }, Hi = async (e, t) => {
3331
+ }, ki = async (e, t) => {
3332
3332
  const n = new URL(e);
3333
3333
  n.pathname = n.pathname + (n.pathname.endsWith("/") ? "metaframe.json" : "/metaframe.json");
3334
3334
  const i = await (await vn(n.href, {
@@ -3337,7 +3337,7 @@ const vn = dt(fetch), Di = async (e, t) => {
3337
3337
  retryDelay: 1e3
3338
3338
  })).json();
3339
3339
  return await en(i, t || "1");
3340
- };
3340
+ }, Hi = (e) => e ? !(e != null && e.inputs && Object.keys(e.inputs).length > 0 || e != null && e.outputs && Object.keys(e.outputs).length > 0 || e != null && e.allow || e != null && e.metadata && Object.keys(e.metadata).length > 0) : !0;
3341
3341
  export {
3342
3342
  fn as INITIAL_NULL_METAPAGE_DEFINITION,
3343
3343
  Ei as INTERNAL_ERROR,
@@ -3377,13 +3377,14 @@ export {
3377
3377
  Ti as getLibraryVersionMatching,
3378
3378
  ue as getMatchingMetaframeVersion,
3379
3379
  Re as getMatchingMetapageVersion,
3380
- Hi as getMetaframeDefinitionFromUrl,
3380
+ ki as getMetaframeDefinitionFromUrl,
3381
3381
  Di as getMetapageDefinitionFromUrl,
3382
3382
  Ii as getUrlParam,
3383
3383
  Ci as getUrlParamDebug,
3384
3384
  Ds as hashCode,
3385
- Hs as intToRGB,
3385
+ ks as intToRGB,
3386
3386
  ft as isDebugFromUrlsParams,
3387
+ Hi as isEmptyMetaframeDefinition,
3387
3388
  Ls as isIframe,
3388
3389
  Mi as isJsonRpcId,
3389
3390
  Ze as isPageLoaded,