@metapages/metapage 1.4.6 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -961,12 +961,12 @@ const zn = (e) => {
961
961
  throw it($(x)), R;
962
962
  }) : I(A);
963
963
  };
964
- }, M = zn();
964
+ }, E = zn();
965
965
  Object.prototype.constructor.toString();
966
966
  const Gn = dt(fetch), Zt = async (e, t) => {
967
967
  if (!e)
968
968
  throw "Metapage definition null";
969
- if (e.version || (e = M(e, (s) => {
969
+ if (e.version || (e = E(e, (s) => {
970
970
  s.version = "0.3";
971
971
  })), !t)
972
972
  throw 'Missing "version" argument';
@@ -1018,14 +1018,14 @@ const Gn = dt(fetch), Zt = async (e, t) => {
1018
1018
  throw `Unknow version ${n} to ${t}`;
1019
1019
  }
1020
1020
  return s;
1021
- }, Wn = (e) => M(e, (t) => {
1021
+ }, Wn = (e) => E(e, (t) => {
1022
1022
  t.version = "0.3";
1023
- }), Kn = (e) => M(e, (t) => {
1023
+ }), Kn = (e) => E(e, (t) => {
1024
1024
  t.version = "0.2";
1025
- }), Xn = (e) => M(e, (t) => {
1025
+ }), Xn = (e) => E(e, (t) => {
1026
1026
  const n = t;
1027
1027
  delete n.plugins, n.version = "1";
1028
- }), qn = (e) => M(e, (t) => (t.version = "0.3", t)), Re = (e) => {
1028
+ }), qn = (e) => E(e, (t) => (t.version = "0.3", t)), Re = (e) => {
1029
1029
  if (e === "latest")
1030
1030
  return Je;
1031
1031
  if (V(e, "0.2") < 0)
@@ -1063,7 +1063,7 @@ const Gn = dt(fetch), Zt = async (e, t) => {
1063
1063
  }, Yn = async (e) => en(e, pt), Zn = (e, t) => {
1064
1064
  if (!e)
1065
1065
  throw "Metaframe definition null";
1066
- e.version || (e = M(e, (i) => {
1066
+ e.version || (e = E(e, (i) => {
1067
1067
  i.version = "0.3";
1068
1068
  }));
1069
1069
  let n = ue(e.version);
@@ -1104,11 +1104,11 @@ const Gn = dt(fetch), Zt = async (e, t) => {
1104
1104
  }, es = async (e, t) => {
1105
1105
  if (e)
1106
1106
  return Yn(e);
1107
- }, ts = (e) => M(e, (t) => {
1107
+ }, ts = (e) => E(e, (t) => {
1108
1108
  t.version = "0.3", delete t.allow;
1109
- }), ns = (e) => M(e, (t) => {
1109
+ }), ns = (e) => E(e, (t) => {
1110
1110
  t.version = "0.4";
1111
- }), ss = (e) => M(e, (t) => {
1111
+ }), ss = (e) => E(e, (t) => {
1112
1112
  if (t.version = "0.5", !(t != null && t.metadata))
1113
1113
  return;
1114
1114
  const n = t.metadata.title;
@@ -1117,7 +1117,7 @@ const Gn = dt(fetch), Zt = async (e, t) => {
1117
1117
  delete t.metadata.descriptionUrl, t.metadata.description = s;
1118
1118
  const i = t.metadata.keywords;
1119
1119
  delete t.metadata.keywords, t.metadata.tags = i;
1120
- }), is = (e) => M(e, (t) => {
1120
+ }), is = (e) => E(e, (t) => {
1121
1121
  if (t.version = "0.4", !(t != null && t.metadata))
1122
1122
  return;
1123
1123
  const n = t.metadata.name;
@@ -1126,16 +1126,16 @@ const Gn = dt(fetch), Zt = async (e, t) => {
1126
1126
  delete t.metadata.description, t.metadata.descriptionUrl = s;
1127
1127
  const i = t.metadata.tags;
1128
1128
  delete t.metadata.tags, t.metadata.keywords = i;
1129
- }), rs = (e) => M(e, (t) => {
1129
+ }), rs = (e) => E(e, (t) => {
1130
1130
  var n;
1131
1131
  t.version = "1", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
1132
- }), os = (e) => M(e, (t) => {
1132
+ }), os = (e) => E(e, (t) => {
1133
1133
  var n;
1134
1134
  t.version = "0.6", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
1135
- }), as = (e) => M(e, (t) => {
1135
+ }), as = (e) => E(e, (t) => {
1136
1136
  var n;
1137
1137
  t.version = "0.6", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
1138
- }), us = (e) => M(e, (t) => {
1138
+ }), us = (e) => E(e, (t) => {
1139
1139
  var n;
1140
1140
  t.version = "0.5", (n = t == null ? void 0 : t.metadata) != null && n.operations && delete t.metadata.operations;
1141
1141
  }), ue = (e) => {
@@ -1171,12 +1171,12 @@ var je = function(e) {
1171
1171
  o = Ee[e.charCodeAt(s)], r = Ee[e.charCodeAt(s + 1)], a = Ee[e.charCodeAt(s + 2)], u = Ee[e.charCodeAt(s + 3)], c[i++] = o << 2 | r >> 4, c[i++] = (r & 15) << 4 | a >> 2, c[i++] = (a & 3) << 6 | u & 63;
1172
1172
  return f;
1173
1173
  };
1174
- const We = async (e) => M(e, async (t) => {
1174
+ const We = async (e) => E(e, async (t) => {
1175
1175
  for (const n of Object.keys(e)) {
1176
1176
  const s = await cs(e[n]);
1177
1177
  return t[n] = s, t;
1178
1178
  }
1179
- }), Ce = async (e) => M(e, async (t) => {
1179
+ }), Ce = async (e) => E(e, async (t) => {
1180
1180
  for (const n of Object.keys(e)) {
1181
1181
  const s = await tn(e[n]);
1182
1182
  return t[n] = s, t;
@@ -1300,10 +1300,10 @@ const We = async (e) => M(e, async (t) => {
1300
1300
  } catch {
1301
1301
  }
1302
1302
  };
1303
- var E;
1303
+ var M;
1304
1304
  (function(e) {
1305
1305
  e.Inputs = "inputs", e.Outputs = "outputs", e.State = "state", e.Definition = "definition", e.Error = "error", e.Warning = "warning", e.UrlHashUpdate = "urlhashupdate", e.Message = "Message";
1306
- })(E || (E = {}));
1306
+ })(M || (M = {}));
1307
1307
  var X;
1308
1308
  (function(e) {
1309
1309
  e.InputsUpdate = "InputsUpdate", e.OutputsUpdate = "OutputsUpdate", e.SetupIframeClientRequest = "SetupIframeClientRequest", e.SetupIframeServerResponseAck = "SetupIframeServerResponseAck", e.HashParamsUpdate = "HashParamsUpdate";
@@ -1614,7 +1614,7 @@ class Ps extends vt.EventEmitter {
1614
1614
  return this._definition;
1615
1615
  }
1616
1616
  }
1617
- const ze = (e, t) => t ? M(e, (n) => {
1617
+ const ze = (e, t) => t ? E(e, (n) => {
1618
1618
  Object.keys(t).forEach((s) => {
1619
1619
  t[s] === void 0 ? delete n[s] : n[s] = t[s];
1620
1620
  });
@@ -2850,7 +2850,7 @@ class mi extends vt.EventEmitter {
2850
2850
  return this._definition = s, this._definition;
2851
2851
  }
2852
2852
  } catch (n) {
2853
- this.emit(E.Warning, `Failed to convert metaframe definition from hash params. Error: ${n != null && n.message ? n == null ? void 0 : n.message : "unknown error"}`);
2853
+ this.emit(M.Warning, `Failed to convert metaframe definition from hash params. Error: ${n != null && n.message ? n == null ? void 0 : n.message : "unknown error"}`);
2854
2854
  return;
2855
2855
  }
2856
2856
  var t = this.getDefinitionUrl();
@@ -2859,7 +2859,7 @@ class mi extends vt.EventEmitter {
2859
2859
  if (n)
2860
2860
  return this._definition = n, this._definition;
2861
2861
  } catch (n) {
2862
- this.emit(E.Warning, `Failed to fetch or convert: ${t}
2862
+ this.emit(M.Warning, `Failed to fetch or convert: ${t}
2863
2863
  Error: ${n != null && n.message ? n == null ? void 0 : n.message : n == null ? void 0 : n.toString()}`);
2864
2864
  }
2865
2865
  }
@@ -2873,9 +2873,9 @@ Error: ${n != null && n.message ? n == null ? void 0 : n.message : n == null ? v
2873
2873
  const n = t;
2874
2874
  if (this.inputs = ze(this.inputs, t), this.inputs === n)
2875
2875
  return this;
2876
- if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(t), this.emit(E.Inputs, this.inputs), this._metapage.listenerCount(E.Inputs) > 0) {
2876
+ if (this._loaded || (this._sendInputsAfterRegistration = !0), this._iframe.parentNode && this._loaded && this.sendInputs(t), this.emit(M.Inputs, this.inputs), this._metapage.listenerCount(M.Inputs) > 0) {
2877
2877
  var s = {};
2878
- s[this.id] = t, this._metapage.emit(E.Inputs, s);
2878
+ s[this.id] = t, this._metapage.emit(M.Inputs, s);
2879
2879
  }
2880
2880
  return this;
2881
2881
  }
@@ -2888,28 +2888,28 @@ Error: ${n != null && n.message ? n == null ? void 0 : n.message : n == null ? v
2888
2888
  const n = t;
2889
2889
  if (this.outputs = ze(this.outputs, t), this.outputs === n)
2890
2890
  return this;
2891
- if (this.emit(E.Outputs, t), this._metapage.listenerCount(E.Outputs) > 0) {
2891
+ if (this.emit(M.Outputs, t), this._metapage.listenerCount(M.Outputs) > 0) {
2892
2892
  var s = {};
2893
- s[this.id] = this.outputs, this._metapage.emit(E.Outputs, s);
2893
+ s[this.id] = this.outputs, this._metapage.emit(M.Outputs, s);
2894
2894
  }
2895
2895
  }
2896
2896
  onInputs(t) {
2897
- return this.addListenerReturnDisposer(E.Inputs, t);
2897
+ return this.addListenerReturnDisposer(M.Inputs, t);
2898
2898
  }
2899
2899
  onInput(t, n) {
2900
2900
  var s = function(i) {
2901
2901
  i.hasOwnProperty(t) && n(i[t]);
2902
2902
  };
2903
- return this.addListenerReturnDisposer(E.Inputs, s);
2903
+ return this.addListenerReturnDisposer(M.Inputs, s);
2904
2904
  }
2905
2905
  onOutputs(t) {
2906
- return this.addListenerReturnDisposer(E.Outputs, t);
2906
+ return this.addListenerReturnDisposer(M.Outputs, t);
2907
2907
  }
2908
2908
  onOutput(t, n) {
2909
2909
  var s = function(i) {
2910
2910
  i.hasOwnProperty(t) && n(i[t]);
2911
2911
  };
2912
- return this.addListenerReturnDisposer(E.Outputs, s);
2912
+ return this.addListenerReturnDisposer(M.Outputs, s);
2913
2913
  }
2914
2914
  isDisposed() {
2915
2915
  return this.inputs === void 0;
@@ -3000,7 +3000,7 @@ Error: ${n != null && n.message ? n == null ? void 0 : n.message : n == null ? v
3000
3000
  }
3001
3001
  }
3002
3002
  }
3003
- const ye = M({
3003
+ const ye = E({
3004
3004
  metaframes: {
3005
3005
  inputs: {},
3006
3006
  outputs: {}
@@ -3020,7 +3020,7 @@ class ne extends Ps {
3020
3020
  return s.setDefinition(t);
3021
3021
  }
3022
3022
  constructor(t) {
3023
- super(), this._state = ye, this._metaframes = M({}, (n) => n), this.debug = ft(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = M({}, (n) => n), this._inputMap = {}, this._id = t && t.id ? t.id : Ts(), this._consoleBackgroundColor = t && t.color ? t.color : _i, this.addPipe = this.addPipe.bind(this), this.dispose = this.dispose.bind(this), this.addMetaframe = this.addMetaframe.bind(this), this.getInputsFromOutput = this.getInputsFromOutput.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframeIds = this.getMetaframeIds.bind(this), this.getMetaframe = this.getMetaframe.bind(this), this.getMetaframes = this.getMetaframes.bind(this), this.getState = this.getState.bind(this), this.getStateMetaframes = this.getStateMetaframes.bind(this), this.isValidJSONRpcMessage = this.isValidJSONRpcMessage.bind(this), this.log = this.log.bind(this), this.logInternal = this.logInternal.bind(this), this.metaframeIds = this.metaframeIds.bind(this), this.metaframes = this.metaframes.bind(this), this.onMessage = this.onMessage.bind(this), this.removeAll = this.removeAll.bind(this), this.removeMetaframe = this.removeMetaframe.bind(this), this.setDebugFromUrlParams = this.setDebugFromUrlParams.bind(this), this.setDefinition = this.setDefinition.bind(this), this.setInput = this.setInput.bind(this), this.setInputs = this.setInputs.bind(this), this.setInputStateOnlyMetaframeInputValue = this.setInputStateOnlyMetaframeInputValue.bind(this), this.setInputStateOnlyMetaframeInputMap = this.setInputStateOnlyMetaframeInputMap.bind(this), this.setInputStateOnlyMetapageInstanceInputs = this.setInputStateOnlyMetapageInstanceInputs.bind(this), this.setOutputStateOnlyMetaframeInputValue = this.setOutputStateOnlyMetaframeInputValue.bind(this), this.setOutputStateOnlyMetaframeInputMap = this.setOutputStateOnlyMetaframeInputMap.bind(this), this.setOutputStateOnlyMetapageInstanceInputs = this.setOutputStateOnlyMetapageInstanceInputs.bind(this), this.setMetaframeClientInputAndSentClientEvent = this.setMetaframeClientInputAndSentClientEvent.bind(this), this.setState = this.setState.bind(this), this.isDisposed = this.isDisposed.bind(this), this._emitDefinitionEvent = this._emitDefinitionEvent.bind(this), Ot().then(() => {
3023
+ super(), this._state = ye, this._metaframes = E({}, (n) => n), this.debug = ft(), this._internalReceivedMessageCounter = 0, this._cachedInputLookupMap = E({}, (n) => n), this._inputMap = {}, this._id = t && t.id ? t.id : Ts(), this._consoleBackgroundColor = t && t.color ? t.color : _i, 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), Ot().then(() => {
3024
3024
  this.isDisposed() || (window.addEventListener("message", this.onMessage), this.log("Initialized"));
3025
3025
  });
3026
3026
  }
@@ -3040,9 +3040,9 @@ class ne extends Ps {
3040
3040
  return this._state;
3041
3041
  }
3042
3042
  setState(t) {
3043
- this._state = M(t, (n) => n), this.getMetaframeIds().forEach((n) => {
3043
+ this._state = E(t, (n) => n), this.getMetaframeIds().forEach((n) => {
3044
3044
  this.getMetaframe(n).setInputs(this._state.metaframes.inputs[n]), this.getMetaframe(n).setOutputs(this._state.metaframes.outputs[n]);
3045
- }), this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state);
3045
+ }), this.listenerCount(M.State) > 0 && ye !== this._state && this.emit(M.State, this._state);
3046
3046
  }
3047
3047
  getStateMetaframes() {
3048
3048
  return this._state.metaframes;
@@ -3066,45 +3066,50 @@ class ne extends Ps {
3066
3066
  const i = this._definition;
3067
3067
  return this._definition = s, Object.keys(this._metaframes).forEach((o) => {
3068
3068
  (!s.metaframes || !s.metaframes[o]) && this.removeMetaframe(o);
3069
- }), n && (this._state = M(n, (o) => o)), s.metaframes && Object.keys(s.metaframes).forEach((o) => {
3069
+ }), n && (this._state = E(n, (o) => o)), s.metaframes && Object.keys(s.metaframes).forEach((o) => {
3070
3070
  if (!this._metaframes.hasOwnProperty(o)) {
3071
3071
  const r = s.metaframes[o];
3072
3072
  this.addMetaframe(o, r);
3073
3073
  }
3074
3074
  }), i !== ln && window.setTimeout(() => {
3075
- !this.isDisposed() && s === this._definition && (this._emitDefinitionEvent(), n && this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state));
3075
+ !this.isDisposed() && s === this._definition && (this._emitDefinitionEvent(), n && this.listenerCount(M.State) > 0 && ye !== this._state && this.emit(M.State, this._state));
3076
3076
  }, 0), this;
3077
3077
  }
3078
+ setMetadata(t) {
3079
+ this._definition = E(this._definition, (n) => {
3080
+ n.meta = t;
3081
+ }), this._emitDefinitionEvent();
3082
+ }
3078
3083
  _emitDefinitionEvent() {
3079
- if (this.listenerCount(E.Definition) > 0) {
3084
+ if (this.listenerCount(M.Definition) > 0) {
3080
3085
  const t = {
3081
3086
  definition: this._definition,
3082
3087
  metaframes: this._metaframes
3083
3088
  };
3084
- this.emit(E.Definition, t);
3089
+ this.emit(M.Definition, t);
3085
3090
  }
3086
3091
  }
3087
3092
  addPipe(t, n) {
3088
- this._inputMap = M(this._inputMap, (s) => {
3093
+ this._inputMap = E(this._inputMap, (s) => {
3089
3094
  s[t] || (s[t] = []), s[t].push(n);
3090
3095
  });
3091
3096
  }
3092
3097
  removeMetaframe(t) {
3093
- this._metaframes[t] && (this._metaframes[t].dispose(), this._metaframes = M(this._metaframes, (n) => {
3098
+ this._metaframes[t] && (this._metaframes[t].dispose(), this._metaframes = E(this._metaframes, (n) => {
3094
3099
  delete n[t];
3095
- }), this._state = M(this._state, (n) => {
3100
+ }), this._state = E(this._state, (n) => {
3096
3101
  delete n.metaframes.inputs[t], delete n.metaframes.outputs[t];
3097
- }), this._inputMap = M(this._inputMap, (n) => {
3102
+ }), this._inputMap = E(this._inputMap, (n) => {
3098
3103
  delete n[t], Object.keys(n).forEach((s) => {
3099
3104
  const i = n[s];
3100
3105
  let o = 0;
3101
3106
  for (; o <= i.length; )
3102
3107
  i[o] && i[o].metaframe === t ? i.splice(o, 1) : o++;
3103
3108
  });
3104
- }), this._cachedInputLookupMap = M({}, (n) => n));
3109
+ }), this._cachedInputLookupMap = E({}, (n) => n));
3105
3110
  }
3106
3111
  removeAll() {
3107
- Object.keys(this._metaframes).forEach((t) => this._metaframes[t].dispose()), this._metaframes = M({}, (t) => t), this._state = ye, this._inputMap = M({}, (t) => t), this._cachedInputLookupMap = M({}, (t) => t);
3112
+ Object.keys(this._metaframes).forEach((t) => this._metaframes[t].dispose()), this._metaframes = E({}, (t) => t), this._state = ye, this._inputMap = E({}, (t) => t), this._cachedInputLookupMap = E({}, (t) => t);
3108
3113
  }
3109
3114
  metaframes() {
3110
3115
  return this.getMetaframes();
@@ -3131,10 +3136,10 @@ class ne extends Ps {
3131
3136
  if (!n.url)
3132
3137
  throw this.emitErrorMessage(`Metaframe definition missing url id=${t}`), `Metaframe definition missing url id=${t}`;
3133
3138
  var s = new mi(this, n.url, t, this._id, this._consoleBackgroundColor, this.debug).setMetapage(this);
3134
- return this._metaframes = M(this._metaframes, (i) => {
3139
+ return this._metaframes = E(this._metaframes, (i) => {
3135
3140
  i[t] = s;
3136
- }), s.addListener(E.Error, (i) => {
3137
- this.emit(E.Error, {
3141
+ }), s.addListener(M.Error, (i) => {
3142
+ this.emit(M.Error, {
3138
3143
  metaframeId: s.id,
3139
3144
  metaframeUrl: s.url,
3140
3145
  error: i
@@ -3151,12 +3156,12 @@ class ne extends Ps {
3151
3156
  this.logInternal(t, "f00", this._consoleBackgroundColor), this.emitErrorMessage(`${t}`);
3152
3157
  }
3153
3158
  emitErrorMessage(t) {
3154
- this.emit(E.Error, t);
3159
+ this.emit(M.Error, t);
3155
3160
  }
3156
3161
  getInputsFromOutput(t, n) {
3157
- return this._cachedInputLookupMap[t] || (this._cachedInputLookupMap = M(this._cachedInputLookupMap, (s) => {
3158
- s[t] = M({}, (i) => i);
3159
- })), this._cachedInputLookupMap[t][n] || (this._cachedInputLookupMap = M(this._cachedInputLookupMap, (s) => {
3162
+ return this._cachedInputLookupMap[t] || (this._cachedInputLookupMap = E(this._cachedInputLookupMap, (s) => {
3163
+ s[t] = E({}, (i) => i);
3164
+ })), this._cachedInputLookupMap[t][n] || (this._cachedInputLookupMap = E(this._cachedInputLookupMap, (s) => {
3160
3165
  var i = [];
3161
3166
  s[t][n] = i, Object.keys(this._inputMap).forEach((o) => {
3162
3167
  o !== t && this._inputMap[o].forEach((r) => {
@@ -3181,7 +3186,7 @@ class ne extends Ps {
3181
3186
  }
3182
3187
  setInput(t, n, s) {
3183
3188
  var i, o;
3184
- typeof t == "object" ? this.setInputStateOnlyMetapageInstanceInputs(t) : typeof n == "string" ? this.setInputStateOnlyMetaframeInputValue(t, n, s) : this.setInputStateOnlyMetaframeInputMap(t, n || {}), this.setMetaframeClientInputAndSentClientEvent(t, n, s), (this.listenerCount(E.State) > 0 || this.listenerCount(E.Inputs) > 0) && ye !== this._state && (this.emit(E.State, this._state), this.emit(E.Inputs, (o = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : o.inputs));
3189
+ typeof t == "object" ? this.setInputStateOnlyMetapageInstanceInputs(t) : typeof n == "string" ? this.setInputStateOnlyMetaframeInputValue(t, n, s) : this.setInputStateOnlyMetaframeInputMap(t, n || {}), this.setMetaframeClientInputAndSentClientEvent(t, n, s), (this.listenerCount(M.State) > 0 || this.listenerCount(M.Inputs) > 0) && ye !== this._state && (this.emit(M.State, this._state), this.emit(M.Inputs, (o = (i = this._state) == null ? void 0 : i.metaframes) == null ? void 0 : o.inputs));
3185
3190
  }
3186
3191
  setMetaframeClientInputAndSentClientEvent(t, n, s) {
3187
3192
  if (typeof t == "object") {
@@ -3228,7 +3233,7 @@ class ne extends Ps {
3228
3233
  this._setStateOnlyMetaframeInputMap(!0, t, n);
3229
3234
  }
3230
3235
  _setStateOnlyMetaframeInputValue(t, n, s, i) {
3231
- this._state = M(this._state, (o) => {
3236
+ this._state = E(this._state, (o) => {
3232
3237
  if (!this._metaframes.hasOwnProperty(n))
3233
3238
  throw `No metaframe: ${n}`;
3234
3239
  o.metaframes || (o.metaframes = { inputs: {}, outputs: {} }), t ? o.metaframes.inputs || (o.metaframes.inputs = {}) : o.metaframes.outputs || (o.metaframes.outputs = {});
@@ -3237,7 +3242,7 @@ class ne extends Ps {
3237
3242
  });
3238
3243
  }
3239
3244
  _setStateOnlyMetaframeInputMap(t, n, s) {
3240
- !s || Object.keys(s).length === 0 || (this._state = M(this._state, (i) => {
3245
+ !s || Object.keys(s).length === 0 || (this._state = E(this._state, (i) => {
3241
3246
  if (!this._metaframes.hasOwnProperty(n))
3242
3247
  throw `No metaframe: ${n}`;
3243
3248
  let r = t ? i.metaframes.inputs : i.metaframes.outputs;
@@ -3247,7 +3252,7 @@ class ne extends Ps {
3247
3252
  }));
3248
3253
  }
3249
3254
  _setStateOnlyMetaframes(t, n) {
3250
- !n || Object.keys(n).length === 0 || (this._state = M(this._state, (s) => {
3255
+ !n || Object.keys(n).length === 0 || (this._state = E(this._state, (s) => {
3251
3256
  Object.keys(n).forEach((i) => {
3252
3257
  var o = n[i];
3253
3258
  if (typeof o != "object")
@@ -3301,13 +3306,13 @@ class ne extends Ps {
3301
3306
  });
3302
3307
  }), i && (this.setInputStateOnlyMetapageInstanceInputs(d), Object.keys(d).forEach((y) => {
3303
3308
  this._metaframes[y].setInputs(d[y]);
3304
- })), this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state), this.debug && s.ack({ jsonrpc: r, state: this._state });
3309
+ })), this.listenerCount(M.State) > 0 && ye !== this._state && this.emit(M.State, this._state), this.debug && s.ack({ jsonrpc: r, state: this._state });
3305
3310
  } else
3306
3311
  this.error(`missing metaframe=${a}`);
3307
3312
  break;
3308
3313
  case X.InputsUpdate:
3309
3314
  var o = r.params;
3310
- this.debug && this.log(`inputs ${JSON.stringify(o)} from ${a}`), this._metaframes[a] ? (this.setInputStateOnlyMetaframeInputMap(a, o), this._metaframes[a].setInputs(o), this.listenerCount(E.State) > 0 && ye !== this._state && this.emit(E.State, this._state), this.debug && this._metaframes[a].ack({
3315
+ this.debug && this.log(`inputs ${JSON.stringify(o)} from ${a}`), this._metaframes[a] ? (this.setInputStateOnlyMetaframeInputMap(a, o), this._metaframes[a].setInputs(o), this.listenerCount(M.State) > 0 && ye !== this._state && this.emit(M.State, this._state), this.debug && this._metaframes[a].ack({
3311
3316
  jsonrpc: r,
3312
3317
  state: this._state
3313
3318
  })) : (console.error(`InputsUpdate failed no metaframe id: "${a}"`), this.error(`InputsUpdate failed no metaframe id: "${a}"`));
@@ -3315,7 +3320,7 @@ class ne extends Ps {
3315
3320
  case X.HashParamsUpdate:
3316
3321
  if (u) {
3317
3322
  const c = r.params, d = new URL(u.url);
3318
- d.hash = c.hash, u.url = d.href, this._definition = M(this._definition, (y) => {
3323
+ d.hash = c.hash, u.url = d.href, this._definition = E(this._definition, (y) => {
3319
3324
  y.metaframes[c.metaframe].url = d.href;
3320
3325
  }), this._emitDefinitionEvent();
3321
3326
  }
@@ -3323,7 +3328,7 @@ class ne extends Ps {
3323
3328
  default:
3324
3329
  this.debug && this.log(`Unknown RPC method: "${n}"`);
3325
3330
  }
3326
- this.listenerCount(E.Message) > 0 && this.emit(E.Message, r);
3331
+ this.listenerCount(M.Message) > 0 && this.emit(M.Message, r);
3327
3332
  }
3328
3333
  }
3329
3334
  logInternal(t, n, s) {
@@ -3333,12 +3338,12 @@ class ne extends Ps {
3333
3338
  }
3334
3339
  }
3335
3340
  ne.version = Gt;
3336
- ne.DEFINITION = E.Definition;
3337
- ne.ERROR = E.Error;
3338
- ne.INPUTS = E.Inputs;
3339
- ne.MESSAGE = E.Message;
3340
- ne.OUTPUTS = E.Outputs;
3341
- ne.STATE = E.State;
3341
+ ne.DEFINITION = M.Definition;
3342
+ ne.ERROR = M.Error;
3343
+ ne.INPUTS = M.Inputs;
3344
+ ne.MESSAGE = M.Message;
3345
+ ne.OUTPUTS = M.Outputs;
3346
+ ne.STATE = M.State;
3342
3347
  ne.deserializeInputs = Ce;
3343
3348
  ne.serializeInputs = We;
3344
3349
  export {
@@ -3358,7 +3363,7 @@ export {
3358
3363
  pt as MetaframeVersionCurrent,
3359
3364
  Et as MetaframeVersionsAll,
3360
3365
  ne as Metapage,
3361
- E as MetapageEvents,
3366
+ M as MetapageEvents,
3362
3367
  xe as MetapageHashParams,
3363
3368
  mi as MetapageIFrameRpcClient,
3364
3369
  Ps as MetapageShared,