@metapages/metapage 0.14.3 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -155,14 +155,14 @@ function tn(e) {
155
155
  function _e(e, t) {
156
156
  t.unfinalizedDrafts_ = t.drafts_.length;
157
157
  const n = t.drafts_[0];
158
- return e !== void 0 && e !== n ? (n[nt].modified_ && (Qt(t), et(4)), gt(e) && (e = Bt(t, e), t.parent_ || jt(t, e)), t.patches_ && mt("Patches").generateReplacementPatches_(
158
+ return e !== void 0 && e !== n ? (n[nt].modified_ && (Qt(t), et(4)), gt(e) && (e = jt(t, e), t.parent_ || Bt(t, e)), t.patches_ && mt("Patches").generateReplacementPatches_(
159
159
  n[nt].base_,
160
160
  e,
161
161
  t.patches_,
162
162
  t.inversePatches_
163
- )) : e = Bt(t, n, []), Qt(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== De ? e : void 0;
163
+ )) : e = jt(t, n, []), Qt(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== De ? e : void 0;
164
164
  }
165
- function Bt(e, t, n) {
165
+ function jt(e, t, n) {
166
166
  if (Vt(t))
167
167
  return t;
168
168
  const r = t[nt];
@@ -174,7 +174,7 @@ function Bt(e, t, n) {
174
174
  if (r.scope_ !== e)
175
175
  return t;
176
176
  if (!r.modified_)
177
- return jt(e, r.base_, !0), r.base_;
177
+ return Bt(e, r.base_, !0), r.base_;
178
178
  if (!r.finalized_) {
179
179
  r.finalized_ = !0, r.scope_.unfinalizedDrafts_--;
180
180
  const f = r.copy_;
@@ -182,7 +182,7 @@ function Bt(e, t, n) {
182
182
  r.type_ === 3 && (d = new Set(f), f.clear(), g = !0), Ot(
183
183
  d,
184
184
  (y, w) => be(e, r, f, y, w, n, g)
185
- ), jt(e, f, !1), n && e.patches_ && mt("Patches").generatePatches_(
185
+ ), Bt(e, f, !1), n && e.patches_ && mt("Patches").generatePatches_(
186
186
  r,
187
187
  n,
188
188
  e.patches_,
@@ -194,7 +194,7 @@ function Bt(e, t, n) {
194
194
  function be(e, t, n, r, f, d, g) {
195
195
  if (process.env.NODE_ENV !== "production" && f === n && et(5), vt(f)) {
196
196
  const y = d && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
197
- !Kt(t.assigned_, r) ? d.concat(r) : void 0, w = Bt(e, f, y);
197
+ !Kt(t.assigned_, r) ? d.concat(r) : void 0, w = jt(e, f, y);
198
198
  if (ke(n, r, w), vt(w))
199
199
  e.canAutoFreeze_ = !1;
200
200
  else
@@ -204,10 +204,10 @@ function be(e, t, n, r, f, d, g) {
204
204
  if (gt(f) && !Vt(f)) {
205
205
  if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1)
206
206
  return;
207
- Bt(e, f), (!t || !t.scope_.parent_) && jt(e, f);
207
+ jt(e, f), (!t || !t.scope_.parent_) && Bt(e, f);
208
208
  }
209
209
  }
210
- function jt(e, t, n = !1) {
210
+ function Bt(e, t, n = !1) {
211
211
  !e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && se(t, n);
212
212
  }
213
213
  function en(e, t) {
@@ -426,9 +426,9 @@ function ee(e, t) {
426
426
  return (t ? t.scope_ : Ue()).drafts_.push(n), n;
427
427
  }
428
428
  function sn(e) {
429
- return vt(e) || et(10, e), Be(e);
429
+ return vt(e) || et(10, e), je(e);
430
430
  }
431
- function Be(e) {
431
+ function je(e) {
432
432
  if (!gt(e) || Vt(e))
433
433
  return e;
434
434
  const t = e[nt];
@@ -440,7 +440,7 @@ function Be(e) {
440
440
  } else
441
441
  n = Xt(e, !0);
442
442
  return Ot(n, (r, f) => {
443
- ke(n, r, Be(f));
443
+ ke(n, r, je(f));
444
444
  }), t && (t.finalized_ = !1), n;
445
445
  }
446
446
  var it = new rn(), X = it.produce;
@@ -458,7 +458,7 @@ function on(e) {
458
458
  function Dt(e) {
459
459
  throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
460
460
  }
461
- var je = { exports: {} };
461
+ var Be = { exports: {} };
462
462
  (function(e, t) {
463
463
  (function(n) {
464
464
  e.exports = n();
@@ -474,9 +474,9 @@ var je = { exports: {} };
474
474
  return y(A, !0);
475
475
  throw new Error("Cannot find module '" + A + "'");
476
476
  }
477
- v = f[A] = { exports: {} }, r[A][0].call(v.exports, function(j) {
478
- var x = r[A][1][j];
479
- return g(x || j);
477
+ v = f[A] = { exports: {} }, r[A][0].call(v.exports, function(B) {
478
+ var x = r[A][1][B];
479
+ return g(x || B);
480
480
  }, v, v.exports, n, r, f, d);
481
481
  }
482
482
  return f[A].exports;
@@ -485,7 +485,7 @@ var je = { exports: {} };
485
485
  g(d[w]);
486
486
  return g;
487
487
  }({ 1: [function(n, r, f) {
488
- (function(d, g, y, w, A, v, L, j, x) {
488
+ (function(d, g, y, w, A, v, L, B, x) {
489
489
  var b = n("crypto");
490
490
  function k(l, _) {
491
491
  _ = P(l, _);
@@ -666,7 +666,7 @@ Use "options.replacer" or "options.ignoreUnknown"
666
666
  };
667
667
  }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/fake_9a5aa49d.js", "/");
668
668
  }, { buffer: 3, crypto: 5, lYpoI2: 11 }], 2: [function(n, r, f) {
669
- (function(d, g, y, w, A, v, L, j, x) {
669
+ (function(d, g, y, w, A, v, L, B, x) {
670
670
  (function(b) {
671
671
  var k = typeof Uint8Array < "u" ? Uint8Array : Array, c = "+".charCodeAt(0), E = "/".charCodeAt(0), P = "0".charCodeAt(0), I = "a".charCodeAt(0), M = "A".charCodeAt(0), R = "-".charCodeAt(0), l = "_".charCodeAt(0);
672
672
  function _(o) {
@@ -702,7 +702,7 @@ Use "options.replacer" or "options.ignoreUnknown"
702
702
  })(f === void 0 ? this.base64js = {} : f);
703
703
  }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js", "/node_modules/gulp-browserify/node_modules/base64-js/lib");
704
704
  }, { buffer: 3, lYpoI2: 11 }], 3: [function(n, r, f) {
705
- (function(d, g, c, w, A, v, L, j, x) {
705
+ (function(d, g, c, w, A, v, L, B, x) {
706
706
  var b = n("base64-js"), k = n("ieee754");
707
707
  function c(i, a, h) {
708
708
  if (!(this instanceof c))
@@ -1115,7 +1115,7 @@ list should be an Array.`), i.length === 0)
1115
1115
  };
1116
1116
  }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/buffer/index.js", "/node_modules/gulp-browserify/node_modules/buffer");
1117
1117
  }, { "base64-js": 2, buffer: 3, ieee754: 10, lYpoI2: 11 }], 4: [function(n, r, f) {
1118
- (function(d, g, b, w, A, v, L, j, x) {
1118
+ (function(d, g, b, w, A, v, L, B, x) {
1119
1119
  var b = n("buffer").Buffer, k = 4, c = new b(k);
1120
1120
  c.fill(0), r.exports = { hash: function(E, P, I, M) {
1121
1121
  for (var R = P(function(s, p) {
@@ -1129,7 +1129,7 @@ list should be an Array.`), i.length === 0)
1129
1129
  } };
1130
1130
  }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1131
1131
  }, { buffer: 3, lYpoI2: 11 }], 5: [function(n, r, f) {
1132
- (function(d, g, b, w, A, v, L, j, x) {
1132
+ (function(d, g, b, w, A, v, L, B, x) {
1133
1133
  var b = n("buffer").Buffer, k = n("./sha"), c = n("./sha256"), E = n("./rng"), P = { sha1: k, sha256: c, md5: n("./md5") }, I = 64, M = new b(I);
1134
1134
  function R(s, p) {
1135
1135
  var m = P[s = s || "sha1"], T = [];
@@ -1170,7 +1170,7 @@ list should be an Array.`), i.length === 0)
1170
1170
  u(o[_]);
1171
1171
  }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1172
1172
  }, { "./md5": 6, "./rng": 7, "./sha": 8, "./sha256": 9, buffer: 3, lYpoI2: 11 }], 6: [function(n, r, f) {
1173
- (function(d, g, y, w, A, v, L, j, x) {
1173
+ (function(d, g, y, w, A, v, L, B, x) {
1174
1174
  var b = n("./helpers");
1175
1175
  function k(l, _) {
1176
1176
  l[_ >> 5] |= 128 << _ % 32, l[14 + (_ + 64 >>> 9 << 4)] = _;
@@ -1204,7 +1204,7 @@ list should be an Array.`), i.length === 0)
1204
1204
  };
1205
1205
  }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1206
1206
  }, { "./helpers": 4, buffer: 3, lYpoI2: 11 }], 7: [function(n, r, f) {
1207
- (function(d, g, y, w, A, v, L, j, x) {
1207
+ (function(d, g, y, w, A, v, L, B, x) {
1208
1208
  r.exports = function(b) {
1209
1209
  for (var k, c = new Array(b), E = 0; E < b; E++)
1210
1210
  !(3 & E) && (k = 4294967296 * Math.random()), c[E] = k >>> ((3 & E) << 3) & 255;
@@ -1212,7 +1212,7 @@ list should be an Array.`), i.length === 0)
1212
1212
  };
1213
1213
  }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1214
1214
  }, { buffer: 3, lYpoI2: 11 }], 8: [function(n, r, f) {
1215
- (function(d, g, y, w, A, v, L, j, x) {
1215
+ (function(d, g, y, w, A, v, L, B, x) {
1216
1216
  var b = n("./helpers");
1217
1217
  function k(P, I) {
1218
1218
  P[I >> 5] |= 128 << 24 - I % 32, P[15 + (I + 64 >> 9 << 4)] = I;
@@ -1237,7 +1237,7 @@ list should be an Array.`), i.length === 0)
1237
1237
  };
1238
1238
  }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1239
1239
  }, { "./helpers": 4, buffer: 3, lYpoI2: 11 }], 9: [function(n, r, f) {
1240
- (function(d, g, y, w, A, v, L, j, x) {
1240
+ (function(d, g, y, w, A, v, L, B, x) {
1241
1241
  function b(I, M) {
1242
1242
  var R = (65535 & I) + (65535 & M);
1243
1243
  return (I >> 16) + (M >> 16) + (R >> 16) << 16 | 65535 & R;
@@ -1262,7 +1262,7 @@ list should be an Array.`), i.length === 0)
1262
1262
  };
1263
1263
  }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify");
1264
1264
  }, { "./helpers": 4, buffer: 3, lYpoI2: 11 }], 10: [function(n, r, f) {
1265
- (function(d, g, y, w, A, v, L, j, x) {
1265
+ (function(d, g, y, w, A, v, L, B, x) {
1266
1266
  f.read = function(b, k, c, E, p) {
1267
1267
  var I, M, R = 8 * p - E - 1, l = (1 << R) - 1, _ = l >> 1, o = -7, u = c ? p - 1 : 0, s = c ? -1 : 1, p = b[k + u];
1268
1268
  for (u += s, I = p & (1 << -o) - 1, p >>= -o, o += R; 0 < o; I = 256 * I + b[k + u], u += s, o -= 8)
@@ -1287,7 +1287,7 @@ list should be an Array.`), i.length === 0)
1287
1287
  };
1288
1288
  }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/ieee754/index.js", "/node_modules/gulp-browserify/node_modules/ieee754");
1289
1289
  }, { buffer: 3, lYpoI2: 11 }], 11: [function(n, r, f) {
1290
- (function(d, g, y, w, A, v, L, j, x) {
1290
+ (function(d, g, y, w, A, v, L, B, x) {
1291
1291
  var b, k, c;
1292
1292
  function E() {
1293
1293
  }
@@ -1310,8 +1310,8 @@ list should be an Array.`), i.length === 0)
1310
1310
  }).call(this, n("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, n("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/process/browser.js", "/node_modules/gulp-browserify/node_modules/process");
1311
1311
  }, { buffer: 3, lYpoI2: 11 }] }, {}, [1])(1);
1312
1312
  });
1313
- })(je);
1314
- var we = je.exports, at;
1313
+ })(Be);
1314
+ var we = Be.exports, at;
1315
1315
  (function(e) {
1316
1316
  e.V0_3 = "0.3", e.V0_4 = "0.4", e.V0_5 = "0.5", e.V0_6 = "0.6";
1317
1317
  })(at || (at = {}));
@@ -1320,10 +1320,10 @@ var ut;
1320
1320
  e.V0_2 = "0.2", e.V0_3 = "0.3";
1321
1321
  })(ut || (ut = {}));
1322
1322
  const ve = Object.keys(at), Cn = at.V0_6, Ie = Object.keys(ut), St = ut.V0_3;
1323
- var B;
1323
+ var j;
1324
1324
  (function(e) {
1325
1325
  e.Inputs = "inputs", e.Outputs = "outputs", e.State = "state", e.Definition = "definition", e.DefinitionUpdateRequest = "definitionupdaterequest", e.Error = "error", e.UrlHashUpdate = "urlhashupdate", e.Message = "Message";
1326
- })(B || (B = {}));
1326
+ })(j || (j = {}));
1327
1327
  var Q;
1328
1328
  (function(e) {
1329
1329
  e.InputsUpdate = "InputsUpdate", e.OutputsUpdate = "OutputsUpdate", e.SetupIframeClientRequest = "SetupIframeClientRequest", e.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", e.PluginRequest = "SetupIframeServerPluginRequestResponseAck", e.HashParamsUpdate = "HashParamsUpdate";
@@ -1439,10 +1439,10 @@ var xe = { exports: {} };
1439
1439
  function f(w, A, v) {
1440
1440
  this.fn = w, this.context = A, this.once = v || !1;
1441
1441
  }
1442
- function d(w, A, v, L, j) {
1442
+ function d(w, A, v, L, B) {
1443
1443
  if (typeof v != "function")
1444
1444
  throw new TypeError("The listener must be a function");
1445
- var x = new f(v, L || w, j), b = n ? n + A : A;
1445
+ var x = new f(v, L || w, B), b = n ? n + A : A;
1446
1446
  return w._events[b] ? w._events[b].fn ? w._events[b] = [w._events[b], x] : w._events[b].push(x) : (w._events[b] = x, w._eventsCount++), w;
1447
1447
  }
1448
1448
  function g(w, A) {
@@ -1464,13 +1464,13 @@ var xe = { exports: {} };
1464
1464
  return [];
1465
1465
  if (L.fn)
1466
1466
  return [L.fn];
1467
- for (var j = 0, x = L.length, b = new Array(x); j < x; j++)
1468
- b[j] = L[j].fn;
1467
+ for (var B = 0, x = L.length, b = new Array(x); B < x; B++)
1468
+ b[B] = L[B].fn;
1469
1469
  return b;
1470
1470
  }, y.prototype.listenerCount = function(A) {
1471
1471
  var v = n ? n + A : A, L = this._events[v];
1472
1472
  return L ? L.fn ? 1 : L.length : 0;
1473
- }, y.prototype.emit = function(A, v, L, j, x, b) {
1473
+ }, y.prototype.emit = function(A, v, L, B, x, b) {
1474
1474
  var k = n ? n + A : A;
1475
1475
  if (!this._events[k])
1476
1476
  return !1;
@@ -1484,11 +1484,11 @@ var xe = { exports: {} };
1484
1484
  case 3:
1485
1485
  return c.fn.call(c.context, v, L), !0;
1486
1486
  case 4:
1487
- return c.fn.call(c.context, v, L, j), !0;
1487
+ return c.fn.call(c.context, v, L, B), !0;
1488
1488
  case 5:
1489
- return c.fn.call(c.context, v, L, j, x), !0;
1489
+ return c.fn.call(c.context, v, L, B, x), !0;
1490
1490
  case 6:
1491
- return c.fn.call(c.context, v, L, j, x, b), !0;
1491
+ return c.fn.call(c.context, v, L, B, x, b), !0;
1492
1492
  }
1493
1493
  for (I = 1, P = new Array(E - 1); I < E; I++)
1494
1494
  P[I - 1] = arguments[I];
@@ -1507,7 +1507,7 @@ var xe = { exports: {} };
1507
1507
  c[I].fn.call(c[I].context, v, L);
1508
1508
  break;
1509
1509
  case 4:
1510
- c[I].fn.call(c[I].context, v, L, j);
1510
+ c[I].fn.call(c[I].context, v, L, B);
1511
1511
  break;
1512
1512
  default:
1513
1513
  if (!P)
@@ -1521,7 +1521,7 @@ var xe = { exports: {} };
1521
1521
  return d(this, A, v, L, !1);
1522
1522
  }, y.prototype.once = function(A, v, L) {
1523
1523
  return d(this, A, v, L, !0);
1524
- }, y.prototype.removeListener = function(A, v, L, j) {
1524
+ }, y.prototype.removeListener = function(A, v, L, B) {
1525
1525
  var x = n ? n + A : A;
1526
1526
  if (!this._events[x])
1527
1527
  return this;
@@ -1529,10 +1529,10 @@ var xe = { exports: {} };
1529
1529
  return g(this, x), this;
1530
1530
  var b = this._events[x];
1531
1531
  if (b.fn)
1532
- b.fn === v && (!j || b.once) && (!L || b.context === L) && g(this, x);
1532
+ b.fn === v && (!B || b.once) && (!L || b.context === L) && g(this, x);
1533
1533
  else {
1534
1534
  for (var k = 0, c = [], E = b.length; k < E; k++)
1535
- (b[k].fn !== v || j && !b[k].once || L && b[k].context !== L) && c.push(b[k]);
1535
+ (b[k].fn !== v || B && !b[k].once || L && b[k].context !== L) && c.push(b[k]);
1536
1536
  c.length ? this._events[x] = c.length === 1 ? c[0] : c : g(this, x);
1537
1537
  }
1538
1538
  return this;
@@ -1629,8 +1629,8 @@ var pn = function(e, t) {
1629
1629
  }
1630
1630
  var A = f.push(g) - 1, v = Object.keys(g).sort(r && r(g));
1631
1631
  for (w = "", y = 0; y < v.length; y++) {
1632
- var L = v[y], j = d(g[L]);
1633
- j && (w && (w += ","), w += JSON.stringify(L) + ":" + j);
1632
+ var L = v[y], B = d(g[L]);
1633
+ B && (w && (w += ","), w += JSON.stringify(L) + ":" + B);
1634
1634
  }
1635
1635
  return f.splice(A, 1), "{" + w + "}";
1636
1636
  }
@@ -1710,12 +1710,12 @@ ${window.location.href}`;
1710
1710
  ${window.location.href}`), e;
1711
1711
  }
1712
1712
  }, yn = (e) => {
1713
- const { version: t, inputs: n, outputs: r, allow: f, metadata: d, ...g } = e, y = d, { title: w, author: A, image: v, descriptionUrl: L, keywords: j, iconUrl: x, ...b } = y, k = {
1713
+ const { version: t, inputs: n, outputs: r, allow: f, metadata: d, ...g } = e, y = d, { title: w, author: A, image: v, descriptionUrl: L, keywords: B, iconUrl: x, ...b } = y, k = {
1714
1714
  name: w,
1715
1715
  author: A,
1716
1716
  description: L,
1717
1717
  image: v,
1718
- tags: j,
1718
+ tags: B,
1719
1719
  ...b
1720
1720
  };
1721
1721
  return {
@@ -1810,7 +1810,7 @@ ${window.location.href}`), e;
1810
1810
  }), Rn = async (e) => {
1811
1811
  const t = Fe(e);
1812
1812
  return await Ye(t);
1813
- }, Bn = async (e) => {
1813
+ }, jn = async (e) => {
1814
1814
  const t = Fe({
1815
1815
  version: e.version,
1816
1816
  metaframes: e.metaframes,
@@ -1835,17 +1835,24 @@ class Me extends ae.EventEmitter {
1835
1835
  n = n.substring(1);
1836
1836
  n = window.location.protocol + "//" + window.location.hostname + (window.location.port && window.location.port != "" ? ":" + window.location.port : "") + "/" + n;
1837
1837
  }
1838
- this.url = n, this._metapage = t;
1839
- var y = new URL(this.url);
1840
- g && y.searchParams.set(Pt.mp_debug, "true"), this.url = y.href, this.id = r, this._debug = g, this._parentId = f, this._color = qe(this.id), this._consoleBackgroundColor = d, this._iframe = document.createElement("iframe"), this._iframe.name = this.id;
1838
+ if (this.url = n, this._metapage = t, this._debug = g, g) {
1839
+ var y = new URL(this.url);
1840
+ y.searchParams.set(Pt.mp_debug, "true"), this.url = y.href;
1841
+ }
1842
+ this.id = r, this._parentId = f, this._color = qe(this.id), this._consoleBackgroundColor = d, this._iframe = document.createElement("iframe"), this._iframe.name = this.id;
1841
1843
  const w = this;
1842
1844
  this.iframe = new Promise((A) => {
1843
1845
  he().then(async () => {
1844
1846
  if (w._iframe) {
1845
- const v = await w.getDefinition();
1846
- if (!w._iframe)
1847
- return;
1848
- v && v.allow && (w._iframe.allow = v.allow), w._iframe.src = this.url, A(w._iframe);
1847
+ if (this._metapage?._definition?.metaframes?.[this.id]?.allow)
1848
+ w._iframe.allow = this._metapage._definition.metaframes[this.id].allow;
1849
+ else {
1850
+ const v = await w.getDefinition();
1851
+ if (!w._iframe)
1852
+ return;
1853
+ v && v.allow && (w._iframe.allow = v.allow);
1854
+ }
1855
+ w._iframe.src = this.url, A(w._iframe);
1849
1856
  }
1850
1857
  });
1851
1858
  }), 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.setPlugin = this.setPlugin.bind(this), this.hasPermissionsDefinition = this.hasPermissionsDefinition.bind(this), this.hasPermissionsState = this.hasPermissionsState.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.setPlugin = this.setPlugin.bind(this), this.addListenerReturnDisposer = this.addListenerReturnDisposer.bind(this), this.isDisposed = this.isDisposed.bind(this);
@@ -1885,11 +1892,11 @@ class Me extends ae.EventEmitter {
1885
1892
  const r = await n.json(), f = Je(r);
1886
1893
  return this._definition = f, this._definition;
1887
1894
  } else
1888
- this.emit(B.Error, `Failed to fetch: ${t}
1895
+ this.emit(j.Error, `Failed to fetch: ${t}
1889
1896
  Status: ${n.status}
1890
1897
  Status text: ${n.statusText}`);
1891
1898
  } catch (n) {
1892
- this.emit(B.Error, `Failed to fetch or convert: ${t}
1899
+ this.emit(j.Error, `Failed to fetch or convert: ${t}
1893
1900
  Error: ${n}`);
1894
1901
  }
1895
1902
  }
@@ -1901,9 +1908,9 @@ Error: ${n}`);
1901
1908
  setInputs(t) {
1902
1909
  if (this.log({ m: "MetapageIFrameRpcClient", inputs: t }), !xt(this.inputs, t))
1903
1910
  return this;
1904
- if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(t), this.emit(B.Inputs, this.inputs), this._metapage.listenerCount(B.Inputs) > 0) {
1911
+ if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(t), this.emit(j.Inputs, this.inputs), this._metapage.listenerCount(j.Inputs) > 0) {
1905
1912
  var n = {};
1906
- n[this.id] = t, this._metapage.emit(B.Inputs, n);
1913
+ n[this.id] = t, this._metapage.emit(j.Inputs, n);
1907
1914
  }
1908
1915
  return this;
1909
1916
  }
@@ -1913,28 +1920,28 @@ Error: ${n}`);
1913
1920
  r[t] = n, this.setOutputs(r);
1914
1921
  }
1915
1922
  setOutputs(t) {
1916
- if (xt(this.outputs, t) && (this.emit(B.Outputs, t), this._metapage.listenerCount(B.Outputs) > 0)) {
1923
+ if (xt(this.outputs, t) && (this.emit(j.Outputs, t), this._metapage.listenerCount(j.Outputs) > 0)) {
1917
1924
  var n = {};
1918
- n[this.id] = this.outputs, this._metapage.emit(B.Outputs, n);
1925
+ n[this.id] = this.outputs, this._metapage.emit(j.Outputs, n);
1919
1926
  }
1920
1927
  }
1921
1928
  onInputs(t) {
1922
- return this.addListenerReturnDisposer(B.Inputs, t);
1929
+ return this.addListenerReturnDisposer(j.Inputs, t);
1923
1930
  }
1924
1931
  onInput(t, n) {
1925
1932
  var r = function(f) {
1926
1933
  f.hasOwnProperty(t) && n(f[t]);
1927
1934
  };
1928
- return this.addListenerReturnDisposer(B.Inputs, r);
1935
+ return this.addListenerReturnDisposer(j.Inputs, r);
1929
1936
  }
1930
1937
  onOutputs(t) {
1931
- return this.addListenerReturnDisposer(B.Outputs, t);
1938
+ return this.addListenerReturnDisposer(j.Outputs, t);
1932
1939
  }
1933
1940
  onOutput(t, n) {
1934
1941
  var r = function(f) {
1935
1942
  f.hasOwnProperty(t) && n(f[t]);
1936
1943
  };
1937
- return this.addListenerReturnDisposer(B.Outputs, r);
1944
+ return this.addListenerReturnDisposer(j.Outputs, r);
1938
1945
  }
1939
1946
  isDisposed() {
1940
1947
  return this.inputs === void 0;
@@ -2039,7 +2046,7 @@ const Ce = () => ({
2039
2046
  inputs: {},
2040
2047
  outputs: {}
2041
2048
  }
2042
- }), jn = (e) => We(e), En = (e, t) => !t || t === "*" || e === t ? !0 : t.endsWith("*") ? e.startsWith(t.slice(0, -1)) : t.startsWith("*") ? e.endsWith(t.slice(1)) : !1, On = "bcbcbc";
2049
+ }), Bn = (e) => We(e), En = (e, t) => !t || t === "*" || e === t ? !0 : t.endsWith("*") ? e.startsWith(t.slice(0, -1)) : t.startsWith("*") ? e.endsWith(t.slice(1)) : !1, On = "bcbcbc";
2043
2050
  class rt extends mn {
2044
2051
  static from(t, n) {
2045
2052
  if (t == null)
@@ -2077,10 +2084,10 @@ class rt extends mn {
2077
2084
  this.getMetaframe(n).setInputs(this._state.metaframes.inputs[n]), this.getMetaframe(n).setOutputs(this._state.metaframes.outputs[n]);
2078
2085
  }), this.getPluginIds().forEach((n) => {
2079
2086
  this.getPlugin(n).setInputs(this._state.plugins.inputs[n]), this.getPlugin(n).setOutputs(this._state.plugins.outputs[n]);
2080
- }), this.listenerCount(B.State) > 0) {
2087
+ }), this.listenerCount(j.State) > 0) {
2081
2088
  const n = X(this._state, (r) => {
2082
2089
  });
2083
- this.emit(B.State, n);
2090
+ this.emit(j.State, n);
2084
2091
  }
2085
2092
  }
2086
2093
  getStateMetaframes() {
@@ -2115,16 +2122,17 @@ class rt extends mn {
2115
2122
  }), r.plugins && r.plugins.forEach((d) => {
2116
2123
  this._plugins.hasOwnProperty(d) || this.addPlugin(d);
2117
2124
  }), f !== Ve && window.setTimeout(() => {
2118
- if (!this.isDisposed() && r === this._definition && (this._emitDefinitionEvent(), n && this.listenerCount(B.State) > 0)) {
2125
+ if (!this.isDisposed() && r === this._definition && (this._emitDefinitionEvent(), n && this.listenerCount(j.State) > 0)) {
2119
2126
  const d = X(this._state, (g) => {
2120
2127
  });
2121
- this.emit(B.State, d);
2128
+ this.emit(j.State, d);
2122
2129
  }
2123
2130
  }, 0), this;
2124
2131
  }
2125
2132
  _emitDefinitionEvent() {
2126
- if (this.listenerCount(B.Definition) > 0) {
2133
+ if (this.listenerCount(j.Definition) > 0) {
2127
2134
  const t = X(this._definition, (d) => {
2135
+ d.meta && delete d.meta.sha256;
2128
2136
  }), n = X(this._metaframes, (d) => {
2129
2137
  }), r = X(this._plugins, (d) => {
2130
2138
  }), f = {
@@ -2132,7 +2140,7 @@ class rt extends mn {
2132
2140
  metaframes: n,
2133
2141
  plugins: r
2134
2142
  };
2135
- this.emit(B.Definition, f);
2143
+ this.emit(j.Definition, f);
2136
2144
  }
2137
2145
  }
2138
2146
  addPipe(t, n) {
@@ -2189,8 +2197,8 @@ class rt extends mn {
2189
2197
  if (!n.url)
2190
2198
  throw this.emitErrorMessage(`Metaframe definition missing url id=${t}`), `Metaframe definition missing url id=${t}`;
2191
2199
  var r = new Me(this, n.url, t, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
2192
- return this._metaframes[t] = r, r.addListener(B.Error, (f) => {
2193
- this.emit(B.Error, {
2200
+ return this._metaframes[t] = r, r.addListener(j.Error, (f) => {
2201
+ this.emit(j.Error, {
2194
2202
  metaframeId: r.id,
2195
2203
  metaframeUrl: r.url,
2196
2204
  error: f
@@ -2213,7 +2221,7 @@ class rt extends mn {
2213
2221
  this.logInternal(t, "f00", this._consoleBackgroundColor), this.emitErrorMessage(`${t}`);
2214
2222
  }
2215
2223
  emitErrorMessage(t) {
2216
- this.emit(B.Error, t);
2224
+ this.emit(j.Error, t);
2217
2225
  }
2218
2226
  getInputsFromOutput(t, n) {
2219
2227
  if (this._cachedInputLookupMap[t] || (this._cachedInputLookupMap[t] = {}), !this._cachedInputLookupMap[t][n]) {
@@ -2241,10 +2249,10 @@ class rt extends mn {
2241
2249
  }
2242
2250
  }
2243
2251
  setInput(t, n, r) {
2244
- if (this.setInputStateOnly(t, n, r), this.setMetaframeClientInputAndSentClientEvent(t, n, r), this.listenerCount(B.State) > 0 || this.listenerCount(B.Inputs) > 0) {
2252
+ if (this.setInputStateOnly(t, n, r), this.setMetaframeClientInputAndSentClientEvent(t, n, r), this.listenerCount(j.State) > 0 || this.listenerCount(j.Inputs) > 0) {
2245
2253
  const f = X(this._state, (d) => {
2246
2254
  });
2247
- this.emit(B.State, f), this.emit(B.Inputs, f);
2255
+ this.emit(j.State, f), this.emit(j.Inputs, f);
2248
2256
  }
2249
2257
  }
2250
2258
  setMetaframeClientInputAndSentClientEvent(t, n, r) {
@@ -2338,32 +2346,32 @@ class rt extends mn {
2338
2346
  break;
2339
2347
  case Q.SetupIframeServerResponseAck:
2340
2348
  if (w) {
2341
- const j = g.params;
2342
- w.registered(j.version);
2349
+ const B = g.params;
2350
+ w.registered(B.version);
2343
2351
  }
2344
2352
  break;
2345
2353
  case Q.OutputsUpdate:
2346
2354
  const L = g.params;
2347
2355
  if (this._metaframes[y]) {
2348
2356
  var r = this._metaframes[y];
2349
- this.setOutputStateOnly(y, L), r.setOutputs(L), this.listenerCount(B.State) > 0 && (v || (v = X(this._state, (b) => {
2350
- })), this.emit(B.State, v));
2357
+ this.setOutputStateOnly(y, L), r.setOutputs(L), this.listenerCount(j.State) > 0 && (v || (v = X(this._state, (b) => {
2358
+ })), this.emit(j.State, v));
2351
2359
  var f = !1;
2352
- const j = Object.keys(L), x = {};
2353
- j.forEach((b, k) => {
2360
+ const B = Object.keys(L), x = {};
2361
+ B.forEach((b, k) => {
2354
2362
  const c = this.getInputsFromOutput(y, b);
2355
2363
  c.length > 0 && c.forEach((E) => {
2356
2364
  x[E.metaframe] || (x[E.metaframe] = {}), x[E.metaframe][E.pipe] = L[b], this.setInputStateOnly(E.metaframe, E.pipe, L[b]), f = !0;
2357
2365
  });
2358
2366
  }), Object.keys(x).forEach((b) => {
2359
2367
  this._metaframes[b].setInputs(x[b]);
2360
- }), f && this.listenerCount(B.State) > 0 && (v || (v = X(this._state, (b) => {
2361
- })), this.emit(B.State, v)), this.debug && (v || (v = X(this._state, (b) => {
2368
+ }), f && this.listenerCount(j.State) > 0 && (v || (v = X(this._state, (b) => {
2369
+ })), this.emit(j.State, v)), this.debug && (v || (v = X(this._state, (b) => {
2362
2370
  })), r.ack({ jsonrpc: g, state: v }));
2363
2371
  } else if (this._plugins[y]) {
2364
- const j = !L[dt] && !L[ft];
2365
- j && this.setOutputStateOnly(y, L), this._plugins[y].setOutputs(L), j && this.listenerCount(B.State) > 0 && (v || (v = X(this._state, (x) => {
2366
- })), this.emit(B.State, v)), this.debug && (v || (v = X(this._state, (x) => {
2372
+ const B = !L[dt] && !L[ft];
2373
+ B && this.setOutputStateOnly(y, L), this._plugins[y].setOutputs(L), B && this.listenerCount(j.State) > 0 && (v || (v = X(this._state, (x) => {
2374
+ })), this.emit(j.State, v)), this.debug && (v || (v = X(this._state, (x) => {
2367
2375
  })), this._plugins[y].ack({
2368
2376
  jsonrpc: g,
2369
2377
  state: v
@@ -2374,16 +2382,16 @@ class rt extends mn {
2374
2382
  case Q.InputsUpdate:
2375
2383
  var d = g.params;
2376
2384
  if (this.debug && this.log(`inputs ${JSON.stringify(d)} from ${y}`), this._metaframes[y])
2377
- this.setInputStateOnly(y, d), this._metaframes[y].setInputs(d), this.listenerCount(B.State) > 0 && (v || (v = X(this._state, (j) => {
2378
- })), this.emit(B.State, v)), this.debug && (v || (v = X(this._state, (j) => {
2385
+ this.setInputStateOnly(y, d), this._metaframes[y].setInputs(d), this.listenerCount(j.State) > 0 && (v || (v = X(this._state, (B) => {
2386
+ })), this.emit(j.State, v)), this.debug && (v || (v = X(this._state, (B) => {
2379
2387
  })), this._metaframes[y].ack({
2380
2388
  jsonrpc: g,
2381
2389
  state: v
2382
2390
  }));
2383
2391
  else if (this._plugins[y]) {
2384
- const j = !d[dt] && !d[ft];
2385
- j && this.setInputStateOnly(y, d), this._plugins[y].setInputs(d), j && this.listenerCount(B.State) > 0 && (v || (v = X(this._state, (x) => {
2386
- })), this.emit(B.State, v)), this.debug && (v || (v = X(this._state, (x) => {
2392
+ const B = !d[dt] && !d[ft];
2393
+ B && this.setInputStateOnly(y, d), this._plugins[y].setInputs(d), B && this.listenerCount(j.State) > 0 && (v || (v = X(this._state, (x) => {
2394
+ })), this.emit(j.State, v)), this.debug && (v || (v = X(this._state, (x) => {
2387
2395
  })), this._plugins[y].ack({
2388
2396
  jsonrpc: g,
2389
2397
  state: v
@@ -2396,20 +2404,20 @@ class rt extends mn {
2396
2404
  break;
2397
2405
  case Q.HashParamsUpdate:
2398
2406
  if (!A && w) {
2399
- const j = g.params, x = new URL(w.url);
2400
- x.hash = j.hash, w.url = x.href, this._definition = X(this._definition, (b) => {
2401
- b.metaframes[j.metaframe].url = x.href;
2407
+ const B = g.params, x = new URL(w.url);
2408
+ x.hash = B.hash, w.url = x.href, this._definition = X(this._definition, (b) => {
2409
+ b.metaframes[B.metaframe].url = x.href;
2402
2410
  }), this._emitDefinitionEvent();
2403
2411
  }
2404
2412
  break;
2405
2413
  default:
2406
2414
  this.debug && this.log(`Unknown RPC method: "${n}"`);
2407
2415
  }
2408
- this.listenerCount(B.Message) > 0 && this.emit(B.Message, g);
2416
+ this.listenerCount(j.Message) > 0 && this.emit(j.Message, g);
2409
2417
  }
2410
2418
  }
2411
2419
  updatePluginsWithDefinition() {
2412
- this.getDefinition(), Object.values(this._plugins).forEach((t) => {
2420
+ Object.values(this._plugins).forEach((t) => {
2413
2421
  t.hasPermissionsDefinition() && Mn(t);
2414
2422
  });
2415
2423
  }
@@ -2420,13 +2428,13 @@ class rt extends mn {
2420
2428
  }
2421
2429
  }
2422
2430
  rt.version = Ne;
2423
- rt.DEFINITION = B.Definition;
2424
- rt.DEFINITION_UPDATE_REQUEST = B.DefinitionUpdateRequest;
2425
- rt.ERROR = B.Error;
2426
- rt.INPUTS = B.Inputs;
2427
- rt.MESSAGE = B.Message;
2428
- rt.OUTPUTS = B.Outputs;
2429
- rt.STATE = B.State;
2431
+ rt.DEFINITION = j.Definition;
2432
+ rt.DEFINITION_UPDATE_REQUEST = j.DefinitionUpdateRequest;
2433
+ rt.ERROR = j.Error;
2434
+ rt.INPUTS = j.Inputs;
2435
+ rt.MESSAGE = j.Message;
2436
+ rt.OUTPUTS = j.Outputs;
2437
+ rt.STATE = j.State;
2430
2438
  rt.deserializeInputs = Et;
2431
2439
  rt.serializeInputs = zt;
2432
2440
  const An = async (e, t) => {
@@ -2437,14 +2445,14 @@ const An = async (e, t) => {
2437
2445
  if (t.isDisposed())
2438
2446
  return;
2439
2447
  if (t.hasPermissionsDefinition()) {
2440
- var n = e.addListenerReturnDisposer(B.Definition, (d) => {
2448
+ var n = e.addListenerReturnDisposer(j.Definition, (d) => {
2441
2449
  t.setInput(ft, d.definition);
2442
2450
  });
2443
2451
  t._disposables.push(n);
2444
2452
  var r = e.getDefinition();
2445
2453
  if (r && (t.setInput(ft, r), f.outputs)) {
2446
2454
  var n = t.onOutput(ft, (g) => {
2447
- e.listenerCount(B.DefinitionUpdateRequest) > 0 && we.sha1(g) !== we.sha1(r) && e.emit(B.DefinitionUpdateRequest, g);
2455
+ e.listenerCount(j.DefinitionUpdateRequest) > 0 && we.sha1(g) !== we.sha1(r) && e.emit(j.DefinitionUpdateRequest, g);
2448
2456
  });
2449
2457
  t._disposables.push(n);
2450
2458
  }
@@ -2456,7 +2464,7 @@ const An = async (e, t) => {
2456
2464
  t._disposables.push(n);
2457
2465
  }
2458
2466
  } catch (f) {
2459
- console.error(f), e.emit(B.Error, `Failed to get plugin definition from "${t.getDefinitionUrl()}", error=${f}`);
2467
+ console.error(f), e.emit(j.Error, `Failed to get plugin definition from "${t.getDefinitionUrl()}", error=${f}`);
2460
2468
  }
2461
2469
  }, Mn = (e) => {
2462
2470
  const t = e._metapage.getDefinition();
@@ -2676,7 +2684,7 @@ export {
2676
2684
  ve as MetaframeVersionsAll,
2677
2685
  rt as Metapage,
2678
2686
  Pe as MetapageEventStateType,
2679
- B as MetapageEvents,
2687
+ j as MetapageEvents,
2680
2688
  Pt as MetapageHashParams,
2681
2689
  Me as MetapageIFrameRpcClient,
2682
2690
  mn as MetapageShared,
@@ -2692,7 +2700,7 @@ export {
2692
2700
  kn as generateMetaframeId,
2693
2701
  vn as generateMetapageId,
2694
2702
  Un as generateNonce,
2695
- jn as getLibraryVersionMatching,
2703
+ Bn as getLibraryVersionMatching,
2696
2704
  We as getMatchingVersion,
2697
2705
  Dn as getUrlParam,
2698
2706
  Ln as getUrlParamDebug,
@@ -2705,7 +2713,7 @@ export {
2705
2713
  En as matchPipe,
2706
2714
  xt as merge,
2707
2715
  Rn as metapageAllSha256Hash,
2708
- Bn as metapageOnlyEssentailSha256Hash,
2716
+ jn as metapageOnlyEssentailSha256Hash,
2709
2717
  he as pageLoaded,
2710
2718
  fn as possiblyDeserializeDatarefToValue,
2711
2719
  un as possiblySerializeValueToDataref,