@metapages/metapage 0.13.8 → 0.13.10-alpha1

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.
Files changed (62) hide show
  1. package/dist/index.mjs +2157 -0
  2. package/dist/index.mjs.map +1 -0
  3. package/dist/metapage/Metaframe.d.ts +2 -2
  4. package/dist/metapage/Metaframe.d.ts.map +1 -1
  5. package/dist/metapage/MetapageIFrameRpcClient.d.ts +5 -5
  6. package/dist/metapage/MetapageIFrameRpcClient.d.ts.map +1 -1
  7. package/dist/metapage/data.d.ts.map +1 -1
  8. package/package.json +13 -15
  9. package/src/metapage/Metaframe.ts +30 -21
  10. package/src/metapage/MetapageIFrameRpcClient.ts +46 -30
  11. package/src/metapage/data.ts +12 -14
  12. package/src/metapage/types/definitions.d.ts +0 -1
  13. package/dist/browser/metaframe/index.js +0 -31
  14. package/dist/browser/metaframe/index.js.map +0 -1
  15. package/dist/browser/metapage/index.js +0 -37
  16. package/dist/browser/metapage/index.js.map +0 -1
  17. package/dist/index.js +0 -8
  18. package/dist/index.js.map +0 -1
  19. package/dist/metapage/Constants.js +0 -7
  20. package/dist/metapage/Constants.js.map +0 -1
  21. package/dist/metapage/Metaframe.js +0 -346
  22. package/dist/metapage/Metaframe.js.map +0 -1
  23. package/dist/metapage/Metapage.js +0 -797
  24. package/dist/metapage/Metapage.js.map +0 -1
  25. package/dist/metapage/MetapageIFrameRpcClient.js +0 -363
  26. package/dist/metapage/MetapageIFrameRpcClient.js.map +0 -1
  27. package/dist/metapage/MetapageTools.js +0 -273
  28. package/dist/metapage/MetapageTools.js.map +0 -1
  29. package/dist/metapage/Shared.js +0 -32
  30. package/dist/metapage/Shared.js.map +0 -1
  31. package/dist/metapage/data.js +0 -112
  32. package/dist/metapage/data.js.map +0 -1
  33. package/dist/metapage/errors/MissingMetaframeJson.js +0 -7
  34. package/dist/metapage/errors/MissingMetaframeJson.js.map +0 -1
  35. package/dist/metapage/errors/RootMetapageError.js +0 -7
  36. package/dist/metapage/errors/RootMetapageError.js.map +0 -1
  37. package/dist/metapage/jsonrpc2.js +0 -25
  38. package/dist/metapage/jsonrpc2.js.map +0 -1
  39. package/dist/metapage/v0_0_1/all.js +0 -16
  40. package/dist/metapage/v0_0_1/all.js.map +0 -1
  41. package/dist/metapage/v0_1_0/all.js +0 -16
  42. package/dist/metapage/v0_1_0/all.js.map +0 -1
  43. package/dist/metapage/v0_2/all.js +0 -3
  44. package/dist/metapage/v0_2/all.js.map +0 -1
  45. package/dist/metapage/v0_3/JsonRpcMethods.js +0 -20
  46. package/dist/metapage/v0_3/JsonRpcMethods.js.map +0 -1
  47. package/dist/metapage/v0_3/all.js +0 -2
  48. package/dist/metapage/v0_3/all.js.map +0 -1
  49. package/dist/metapage/v0_4/core.js +0 -2
  50. package/dist/metapage/v0_4/core.js.map +0 -1
  51. package/dist/metapage/v0_4/events.js +0 -12
  52. package/dist/metapage/v0_4/events.js.map +0 -1
  53. package/dist/metapage/v0_4/index.js +0 -7
  54. package/dist/metapage/v0_4/index.js.map +0 -1
  55. package/dist/metapage/v0_4/jsonrpc.js +0 -20
  56. package/dist/metapage/v0_4/jsonrpc.js.map +0 -1
  57. package/dist/metapage/v0_4/metaframe.js +0 -2
  58. package/dist/metapage/v0_4/metaframe.js.map +0 -1
  59. package/dist/metapage/v0_4/metapage.js +0 -2
  60. package/dist/metapage/v0_4/metapage.js.map +0 -1
  61. package/dist/metapage/v0_4/versions.js +0 -17
  62. package/dist/metapage/v0_4/versions.js.map +0 -1
@@ -1,37 +0,0 @@
1
- parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"J0Ce":[function(require,module,exports) {
2
- var define;
3
- var global = arguments[3];
4
- var e,t=arguments[3];!function(n){var r;"object"==typeof exports?module.exports=n():"function"==typeof e&&e.amd?e(n):("undefined"!=typeof window?r=window:void 0!==t?r=t:"undefined"!=typeof self&&(r=self),r.objectHash=n())}(function(){return function e(t,n,r){function o(u,s){if(!n[u]){if(!t[u]){var a="function"==typeof require&&require;if(!s&&a)return a(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}s=n[u]={exports:{}},t[u][0].call(s.exports,function(e){return o(t[u][1][e]||e)},s,s.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,n){(function(r,o,i,u,s,a,f,l,c){"use strict";var d=e("crypto");function h(e,t){var n;return void 0===(n="passthrough"!==(t=y(e,t)).algorithm?d.createHash(t.algorithm):new m).write&&(n.write=n.update,n.end=n.update),b(t,n).dispatch(e),n.update||n.end(""),n.digest?n.digest("buffer"===t.encoding?void 0:t.encoding):(e=n.read(),"buffer"!==t.encoding?e.toString(t.encoding):e)}(n=t.exports=h).sha1=function(e){return h(e)},n.keys=function(e){return h(e,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},n.MD5=function(e){return h(e,{algorithm:"md5",encoding:"hex"})},n.keysMD5=function(e){return h(e,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var p=d.getHashes?d.getHashes().slice():["sha1","md5"],g=(p.push("passthrough"),["buffer","hex","binary","base64"]);function y(e,t){var n={};if(n.algorithm=(t=t||{}).algorithm||"sha1",n.encoding=t.encoding||"hex",n.excludeValues=!!t.excludeValues,n.algorithm=n.algorithm.toLowerCase(),n.encoding=n.encoding.toLowerCase(),n.ignoreUnknown=!0===t.ignoreUnknown,n.respectType=!1!==t.respectType,n.respectFunctionNames=!1!==t.respectFunctionNames,n.respectFunctionProperties=!1!==t.respectFunctionProperties,n.unorderedArrays=!0===t.unorderedArrays,n.unorderedSets=!1!==t.unorderedSets,n.unorderedObjects=!1!==t.unorderedObjects,n.replacer=t.replacer||void 0,n.excludeKeys=t.excludeKeys||void 0,void 0===e)throw new Error("Object argument required.");for(var r=0;r<p.length;++r)p[r].toLowerCase()===n.algorithm.toLowerCase()&&(n.algorithm=p[r]);if(-1===p.indexOf(n.algorithm))throw new Error('Algorithm "'+n.algorithm+'" not supported. supported values: '+p.join(", "));if(-1===g.indexOf(n.encoding)&&"passthrough"!==n.algorithm)throw new Error('Encoding "'+n.encoding+'" not supported. supported values: '+g.join(", "));return n}function w(e){if("function"==typeof e)return null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(e))}function b(e,t,n){function r(e){return t.update?t.update(e,"utf8"):t.write(e,"utf8")}return n=n||[],{dispatch:function(t){return this["_"+(null===(t=e.replacer?e.replacer(t):t)?"null":typeof t)](t)},_object:function(t){var o,u=Object.prototype.toString.call(t),s=/\[object (.*)\]/i.exec(u);if(s=(s=s?s[1]:"unknown:["+u+"]").toLowerCase(),0<=(u=n.indexOf(t)))return this.dispatch("[CIRCULAR:"+u+"]");if(n.push(t),void 0!==i&&i.isBuffer&&i.isBuffer(t))return r("buffer:"),r(t);if("object"===s||"function"===s||"asyncfunction"===s)return u=Object.keys(t),e.unorderedObjects&&(u=u.sort()),!1===e.respectType||w(t)||u.splice(0,0,"prototype","__proto__","constructor"),e.excludeKeys&&(u=u.filter(function(t){return!e.excludeKeys(t)})),r("object:"+u.length+":"),o=this,u.forEach(function(n){o.dispatch(n),r(":"),e.excludeValues||o.dispatch(t[n]),r(",")});if(!this["_"+s]){if(e.ignoreUnknown)return r("["+s+"]");throw new Error('Unknown object type "'+s+'"')}this["_"+s](t)},_array:function(t,o){o=void 0!==o?o:!1!==e.unorderedArrays;var i=this;if(r("array:"+t.length+":"),!o||t.length<=1)return t.forEach(function(e){return i.dispatch(e)});var u=[];o=t.map(function(t){var r=new m,o=n.slice();return b(e,r,o).dispatch(t),u=u.concat(o.slice(n.length)),r.read().toString()});return n=n.concat(u),o.sort(),this._array(o,!1)},_date:function(e){return r("date:"+e.toJSON())},_symbol:function(e){return r("symbol:"+e.toString())},_error:function(e){return r("error:"+e.toString())},_boolean:function(e){return r("bool:"+e.toString())},_string:function(e){r("string:"+e.length+":"),r(e.toString())},_function:function(t){r("fn:"),w(t)?this.dispatch("[native]"):this.dispatch(t.toString()),!1!==e.respectFunctionNames&&this.dispatch("function-name:"+String(t.name)),e.respectFunctionProperties&&this._object(t)},_number:function(e){return r("number:"+e.toString())},_xml:function(e){return r("xml:"+e.toString())},_null:function(){return r("Null")},_undefined:function(){return r("Undefined")},_regexp:function(e){return r("regex:"+e.toString())},_uint8array:function(e){return r("uint8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint8clampedarray:function(e){return r("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(e))},_int8array:function(e){return r("int8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint16array:function(e){return r("uint16array:"),this.dispatch(Array.prototype.slice.call(e))},_int16array:function(e){return r("int16array:"),this.dispatch(Array.prototype.slice.call(e))},_uint32array:function(e){return r("uint32array:"),this.dispatch(Array.prototype.slice.call(e))},_int32array:function(e){return r("int32array:"),this.dispatch(Array.prototype.slice.call(e))},_float32array:function(e){return r("float32array:"),this.dispatch(Array.prototype.slice.call(e))},_float64array:function(e){return r("float64array:"),this.dispatch(Array.prototype.slice.call(e))},_arraybuffer:function(e){return r("arraybuffer:"),this.dispatch(new Uint8Array(e))},_url:function(e){return r("url:"+e.toString())},_map:function(t){return r("map:"),t=Array.from(t),this._array(t,!1!==e.unorderedSets)},_set:function(t){return r("set:"),t=Array.from(t),this._array(t,!1!==e.unorderedSets)},_file:function(e){return r("file:"),this.dispatch([e.name,e.size,e.type,e.lastModfied])},_blob:function(){if(e.ignoreUnknown)return r("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return r("domwindow")},_bigint:function(e){return r("bigint:"+e.toString())},_process:function(){return r("process")},_timer:function(){return r("timer")},_pipe:function(){return r("pipe")},_tcp:function(){return r("tcp")},_udp:function(){return r("udp")},_tty:function(){return r("tty")},_statwatcher:function(){return r("statwatcher")},_securecontext:function(){return r("securecontext")},_connection:function(){return r("connection")},_zlib:function(){return r("zlib")},_context:function(){return r("context")},_nodescript:function(){return r("nodescript")},_httpparser:function(){return r("httpparser")},_dataview:function(){return r("dataview")},_signal:function(){return r("signal")},_fsevent:function(){return r("fsevent")},_tlswrap:function(){return r("tlswrap")}}}function m(){return{buf:"",write:function(e){this.buf+=e},end:function(e){this.buf+=e},read:function(){return this.buf}}}n.writeToStream=function(e,t,n){return void 0===n&&(n=t,t={}),b(t=y(e,t),n).dispatch(e)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(e,t,n){(function(e,t,r,o,i,u,s,a,f){!function(e){"use strict";var t="undefined"!=typeof Uint8Array?Uint8Array:Array,n="+".charCodeAt(0),r="/".charCodeAt(0),o="0".charCodeAt(0),i="a".charCodeAt(0),u="A".charCodeAt(0),s="-".charCodeAt(0),a="_".charCodeAt(0);function f(e){return(e=e.charCodeAt(0))===n||e===s?62:e===r||e===a?63:e<o?-1:e<o+10?e-o+26+26:e<u+26?e-u:e<i+26?e-i+26:void 0}e.toByteArray=function(e){var n,r;if(0<e.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var o=e.length,i=(o="="===e.charAt(o-2)?2:"="===e.charAt(o-1)?1:0,new t(3*e.length/4-o)),u=0<o?e.length-4:e.length,s=0;function a(e){i[s++]=e}for(n=0;n<u;n+=4,0)a((16711680&(r=f(e.charAt(n))<<18|f(e.charAt(n+1))<<12|f(e.charAt(n+2))<<6|f(e.charAt(n+3))))>>16),a((65280&r)>>8),a(255&r);return 2==o?a(255&(r=f(e.charAt(n))<<2|f(e.charAt(n+1))>>4)):1==o&&(a((r=f(e.charAt(n))<<10|f(e.charAt(n+1))<<4|f(e.charAt(n+2))>>2)>>8&255),a(255&r)),i},e.fromByteArray=function(e){var t,n,r,o,i=e.length%3,u="";function s(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-i;t<r;t+=3)u+=s((o=n=(e[t]<<16)+(e[t+1]<<8)+e[t+2])>>18&63)+s(o>>12&63)+s(o>>6&63)+s(63&o);switch(i){case 1:u=(u+=s((n=e[e.length-1])>>2))+s(n<<4&63)+"==";break;case 2:u=(u=(u+=s((n=(e[e.length-2]<<8)+e[e.length-1])>>10))+s(n>>4&63))+s(n<<2&63)+"="}return u}}(void 0===n?this.base64js={}:n)}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("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")},{buffer:3,lYpoI2:11}],3:[function(e,t,n){(function(t,r,o,i,u,s,a,f,l){var c=e("base64-js"),d=e("ieee754");function o(e,t,n){if(!(this instanceof o))return new o(e,t,n);var r,i,u,s,a=typeof e;if("base64"===t&&"string"==a)for(e=(s=e).trim?s.trim():s.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==a)r=U(e);else if("string"==a)r=o.byteLength(e,t);else{if("object"!=a)throw new Error("First argument needs to be a number, array or string.");r=U(e.length)}if(o._useTypedArrays?i=o._augment(new Uint8Array(r)):((i=this).length=r,i._isBuffer=!0),o._useTypedArrays&&"number"==typeof e.byteLength)i._set(e);else if(x(s=e)||o.isBuffer(s)||s&&"object"==typeof s&&"number"==typeof s.length)for(u=0;u<r;u++)o.isBuffer(e)?i[u]=e.readUInt8(u):i[u]=e[u];else if("string"==a)i.write(e,0,t);else if("number"==a&&!o._useTypedArrays&&!n)for(u=0;u<r;u++)i[u]=0;return i}function h(e,t,n,r){var o;if(r||(F("boolean"==typeof n,"missing or invalid endian"),F(null!=t,"missing offset"),F(t+1<e.length,"Trying to read beyond buffer length")),!((r=e.length)<=t))return n?(o=e[t],t+1<r&&(o|=e[t+1]<<8)):(o=e[t]<<8,t+1<r&&(o|=e[t+1])),o}function p(e,t,n,r){var o;if(r||(F("boolean"==typeof n,"missing or invalid endian"),F(null!=t,"missing offset"),F(t+3<e.length,"Trying to read beyond buffer length")),!((r=e.length)<=t))return n?(t+2<r&&(o=e[t+2]<<16),t+1<r&&(o|=e[t+1]<<8),o|=e[t],t+3<r&&(o+=e[t+3]<<24>>>0)):(t+1<r&&(o=e[t+1]<<16),t+2<r&&(o|=e[t+2]<<8),t+3<r&&(o|=e[t+3]),o+=e[t]<<24>>>0),o}function g(e,t,n,r){if(r||(F("boolean"==typeof n,"missing or invalid endian"),F(null!=t,"missing offset"),F(t+1<e.length,"Trying to read beyond buffer length")),!(e.length<=t))return 32768&(r=h(e,t,n,!0))?-1*(65535-r+1):r}function y(e,t,n,r){if(r||(F("boolean"==typeof n,"missing or invalid endian"),F(null!=t,"missing offset"),F(t+3<e.length,"Trying to read beyond buffer length")),!(e.length<=t))return 2147483648&(r=p(e,t,n,!0))?-1*(4294967295-r+1):r}function w(e,t,n,r){return r||(F("boolean"==typeof n,"missing or invalid endian"),F(t+3<e.length,"Trying to read beyond buffer length")),d.read(e,t,n,23,4)}function b(e,t,n,r){return r||(F("boolean"==typeof n,"missing or invalid endian"),F(t+7<e.length,"Trying to read beyond buffer length")),d.read(e,t,n,52,8)}function m(e,t,n,r,o){if(o||(F(null!=t,"missing value"),F("boolean"==typeof r,"missing or invalid endian"),F(null!=n,"missing offset"),F(n+1<e.length,"trying to write beyond buffer length"),M(t,65535)),!((o=e.length)<=n))for(var i=0,u=Math.min(o-n,2);i<u;i++)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function v(e,t,n,r,o){if(o||(F(null!=t,"missing value"),F("boolean"==typeof r,"missing or invalid endian"),F(null!=n,"missing offset"),F(n+3<e.length,"trying to write beyond buffer length"),M(t,4294967295)),!((o=e.length)<=n))for(var i=0,u=Math.min(o-n,4);i<u;i++)e[n+i]=t>>>8*(r?i:3-i)&255}function _(e,t,n,r,o){o||(F(null!=t,"missing value"),F("boolean"==typeof r,"missing or invalid endian"),F(null!=n,"missing offset"),F(n+1<e.length,"Trying to write beyond buffer length"),N(t,32767,-32768)),e.length<=n||m(e,0<=t?t:65535+t+1,n,r,o)}function E(e,t,n,r,o){o||(F(null!=t,"missing value"),F("boolean"==typeof r,"missing or invalid endian"),F(null!=n,"missing offset"),F(n+3<e.length,"Trying to write beyond buffer length"),N(t,2147483647,-2147483648)),e.length<=n||v(e,0<=t?t:4294967295+t+1,n,r,o)}function I(e,t,n,r,o){o||(F(null!=t,"missing value"),F("boolean"==typeof r,"missing or invalid endian"),F(null!=n,"missing offset"),F(n+3<e.length,"Trying to write beyond buffer length"),Y(t,3.4028234663852886e38,-3.4028234663852886e38)),e.length<=n||d.write(e,t,n,r,23,4)}function A(e,t,n,r,o){o||(F(null!=t,"missing value"),F("boolean"==typeof r,"missing or invalid endian"),F(null!=n,"missing offset"),F(n+7<e.length,"Trying to write beyond buffer length"),Y(t,1.7976931348623157e308,-1.7976931348623157e308)),e.length<=n||d.write(e,t,n,r,52,8)}n.Buffer=o,n.SlowBuffer=o,n.INSPECT_MAX_BYTES=50,o.poolSize=8192,o._useTypedArrays=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray}catch(e){return!1}}(),o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.byteLength=function(e,t){var n;switch(e+="",t||"utf8"){case"hex":n=e.length/2;break;case"utf8":case"utf-8":n=j(e).length;break;case"ascii":case"binary":case"raw":n=e.length;break;case"base64":n=C(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;default:throw new Error("Unknown encoding")}return n},o.concat=function(e,t){if(F(x(e),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===e.length)return new o(0);if(1===e.length)return e[0];if("number"!=typeof t)for(i=t=0;i<e.length;i++)t+=e[i].length;for(var n=new o(t),r=0,i=0;i<e.length;i++){var u=e[i];u.copy(n,r),r+=u.length}return n},o.prototype.write=function(e,t,n,r){isFinite(t)?isFinite(n)||(r=n,n=void 0):(f=r,r=t,t=n,n=f),t=Number(t)||0;var i,u,s,a,f=this.length-t;switch((!n||f<(n=Number(n)))&&(n=f),r=String(r||"utf8").toLowerCase()){case"hex":i=function(e,t,n,r){n=Number(n)||0;var i=e.length-n;(!r||i<(r=Number(r)))&&(r=i),F((i=t.length)%2==0,"Invalid hex string"),i/2<r&&(r=i/2);for(var u=0;u<r;u++){var s=parseInt(t.substr(2*u,2),16);F(!isNaN(s),"Invalid hex string"),e[n+u]=s}return o._charsWritten=2*u,u}(this,e,t,n);break;case"utf8":case"utf-8":u=this,s=t,a=n,i=o._charsWritten=k(j(e),u,s,a);break;case"ascii":case"binary":i=function(e,t,n,r){return o._charsWritten=k(function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}(this,e,t,n);break;case"base64":u=this,s=t,a=n,i=o._charsWritten=k(C(e),u,s,a);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":i=function(e,t,n,r){return o._charsWritten=k(function(e){for(var t,n,r=[],o=0;o<e.length;o++)t=(n=e.charCodeAt(o))>>8,n%=256,r.push(n),r.push(t);return r}(t),e,n,r)}(this,e,t,n);break;default:throw new Error("Unknown encoding")}return i},o.prototype.toString=function(e,t,n){var r,o,i,u,s=this;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,(n=void 0!==n?Number(n):s.length)===t)return"";switch(e){case"hex":r=function(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||r<n)&&(n=r);for(var o="",i=t;i<n;i++)o+=S(e[i]);return o}(s,t,n);break;case"utf8":case"utf-8":r=function(e,t,n){var r="",o="";n=Math.min(e.length,n);for(var i=t;i<n;i++)e[i]<=127?(r+=T(o)+String.fromCharCode(e[i]),o=""):o+="%"+e[i].toString(16);return r+T(o)}(s,t,n);break;case"ascii":case"binary":r=function(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;o++)r+=String.fromCharCode(e[o]);return r}(s,t,n);break;case"base64":o=s,u=n,r=0===(i=t)&&u===o.length?c.fromByteArray(o):c.fromByteArray(o.slice(i,u));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=function(e,t,n){for(var r=s.slice(t,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}(0,t,n);break;default:throw new Error("Unknown encoding")}return r},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.copy=function(e,t,n,r){if(t=t||0,(r=r||0===r?r:this.length)!==(n=n||0)&&0!==e.length&&0!==this.length){F(n<=r,"sourceEnd < sourceStart"),F(0<=t&&t<e.length,"targetStart out of bounds"),F(0<=n&&n<this.length,"sourceStart out of bounds"),F(0<=r&&r<=this.length,"sourceEnd out of bounds"),r>this.length&&(r=this.length);var i=(r=e.length-t<r-n?e.length-t+n:r)-n;if(i<100||!o._useTypedArrays)for(var u=0;u<i;u++)e[u+t]=this[u+n];else e._set(this.subarray(n,n+i),t)}},o.prototype.slice=function(e,t){var n=this.length;if(e=L(e,n,0),t=L(t,n,n),o._useTypedArrays)return o._augment(this.subarray(e,t));for(var r=t-e,i=new o(r,void 0,!0),u=0;u<r;u++)i[u]=this[u+e];return i},o.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},o.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},o.prototype.readUInt8=function(e,t){if(t||(F(null!=e,"missing offset"),F(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return this[e]},o.prototype.readUInt16LE=function(e,t){return h(this,e,!0,t)},o.prototype.readUInt16BE=function(e,t){return h(this,e,!1,t)},o.prototype.readUInt32LE=function(e,t){return p(this,e,!0,t)},o.prototype.readUInt32BE=function(e,t){return p(this,e,!1,t)},o.prototype.readInt8=function(e,t){if(t||(F(null!=e,"missing offset"),F(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){return g(this,e,!0,t)},o.prototype.readInt16BE=function(e,t){return g(this,e,!1,t)},o.prototype.readInt32LE=function(e,t){return y(this,e,!0,t)},o.prototype.readInt32BE=function(e,t){return y(this,e,!1,t)},o.prototype.readFloatLE=function(e,t){return w(this,e,!0,t)},o.prototype.readFloatBE=function(e,t){return w(this,e,!1,t)},o.prototype.readDoubleLE=function(e,t){return b(this,e,!0,t)},o.prototype.readDoubleBE=function(e,t){return b(this,e,!1,t)},o.prototype.writeUInt8=function(e,t,n){n||(F(null!=e,"missing value"),F(null!=t,"missing offset"),F(t<this.length,"trying to write beyond buffer length"),M(e,255)),t>=this.length||(this[t]=e)},o.prototype.writeUInt16LE=function(e,t,n){m(this,e,t,!0,n)},o.prototype.writeUInt16BE=function(e,t,n){m(this,e,t,!1,n)},o.prototype.writeUInt32LE=function(e,t,n){v(this,e,t,!0,n)},o.prototype.writeUInt32BE=function(e,t,n){v(this,e,t,!1,n)},o.prototype.writeInt8=function(e,t,n){n||(F(null!=e,"missing value"),F(null!=t,"missing offset"),F(t<this.length,"Trying to write beyond buffer length"),N(e,127,-128)),t>=this.length||(0<=e?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},o.prototype.writeInt16LE=function(e,t,n){_(this,e,t,!0,n)},o.prototype.writeInt16BE=function(e,t,n){_(this,e,t,!1,n)},o.prototype.writeInt32LE=function(e,t,n){E(this,e,t,!0,n)},o.prototype.writeInt32BE=function(e,t,n){E(this,e,t,!1,n)},o.prototype.writeFloatLE=function(e,t,n){I(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){I(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){A(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){A(this,e,t,!1,n)},o.prototype.fill=function(e,t,n){if(t=t||0,n=n||this.length,F("number"==typeof(e="string"==typeof(e=e||0)?e.charCodeAt(0):e)&&!isNaN(e),"value is not a number"),F(t<=n,"end < start"),n!==t&&0!==this.length){F(0<=t&&t<this.length,"start out of bounds"),F(0<=n&&n<=this.length,"end out of bounds");for(var r=t;r<n;r++)this[r]=e}},o.prototype.inspect=function(){for(var e=[],t=this.length,r=0;r<t;r++)if(e[r]=S(this[r]),r===n.INSPECT_MAX_BYTES){e[r+1]="...";break}return"<Buffer "+e.join(" ")+">"},o.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(o._useTypedArrays)return new o(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;t<n;t+=1)e[t]=this[t];return e.buffer};var B=o.prototype;function L(e,t,n){return"number"!=typeof e?n:t<=(e=~~e)?t:0<=e||0<=(e+=t)?e:0}function U(e){return(e=~~Math.ceil(+e))<0?0:e}function x(e){return(Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)})(e)}function S(e){return e<16?"0"+e.toString(16):e.toString(16)}function j(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<=127)t.push(e.charCodeAt(n));else for(var o=n,i=(55296<=r&&r<=57343&&n++,encodeURIComponent(e.slice(o,n+1)).substr(1).split("%")),u=0;u<i.length;u++)t.push(parseInt(i[u],16))}return t}function C(e){return c.toByteArray(e)}function k(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function T(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function M(e,t){F("number"==typeof e,"cannot write a non-number as a number"),F(0<=e,"specified a negative value for writing an unsigned value"),F(e<=t,"value is larger than maximum value for type"),F(Math.floor(e)===e,"value has a fractional component")}function N(e,t,n){F("number"==typeof e,"cannot write a non-number as a number"),F(e<=t,"value larger than maximum allowed value"),F(n<=e,"value smaller than minimum allowed value"),F(Math.floor(e)===e,"value has a fractional component")}function Y(e,t,n){F("number"==typeof e,"cannot write a non-number as a number"),F(e<=t,"value larger than maximum allowed value"),F(n<=e,"value smaller than minimum allowed value")}function F(e,t){if(!e)throw new Error(t||"Failed assertion")}o._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=B.get,e.set=B.set,e.write=B.write,e.toString=B.toString,e.toLocaleString=B.toString,e.toJSON=B.toJSON,e.copy=B.copy,e.slice=B.slice,e.readUInt8=B.readUInt8,e.readUInt16LE=B.readUInt16LE,e.readUInt16BE=B.readUInt16BE,e.readUInt32LE=B.readUInt32LE,e.readUInt32BE=B.readUInt32BE,e.readInt8=B.readInt8,e.readInt16LE=B.readInt16LE,e.readInt16BE=B.readInt16BE,e.readInt32LE=B.readInt32LE,e.readInt32BE=B.readInt32BE,e.readFloatLE=B.readFloatLE,e.readFloatBE=B.readFloatBE,e.readDoubleLE=B.readDoubleLE,e.readDoubleBE=B.readDoubleBE,e.writeUInt8=B.writeUInt8,e.writeUInt16LE=B.writeUInt16LE,e.writeUInt16BE=B.writeUInt16BE,e.writeUInt32LE=B.writeUInt32LE,e.writeUInt32BE=B.writeUInt32BE,e.writeInt8=B.writeInt8,e.writeInt16LE=B.writeInt16LE,e.writeInt16BE=B.writeInt16BE,e.writeInt32LE=B.writeInt32LE,e.writeInt32BE=B.writeInt32BE,e.writeFloatLE=B.writeFloatLE,e.writeFloatBE=B.writeFloatBE,e.writeDoubleLE=B.writeDoubleLE,e.writeDoubleBE=B.writeDoubleBE,e.fill=B.fill,e.inspect=B.inspect,e.toArrayBuffer=B.toArrayBuffer,e}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("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")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(e,t,n){(function(n,r,o,i,u,s,a,f,l){o=e("buffer").Buffer;var c=new o(4);c.fill(0),t.exports={hash:function(e,t,n,r){for(var i=t(function(e,t){e.length%4!=0&&(n=e.length+(4-e.length%4),e=o.concat([e,c],n));for(var n,r=[],i=t?e.readInt32BE:e.readInt32LE,u=0;u<e.length;u+=4)r.push(i.call(e,u));return r}(e=o.isBuffer(e)?e:new o(e),r),8*e.length),u=(t=r,new o(n)),s=t?u.writeInt32BE:u.writeInt32LE,a=0;a<i.length;a++)s.call(u,i[a],4*a,!0);return u}}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("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")},{buffer:3,lYpoI2:11}],5:[function(e,t,n){(function(t,r,o,i,u,s,a,f,l){o=e("buffer").Buffer;var c=e("./sha"),d=e("./sha256"),h=e("./rng"),p={sha1:c,sha256:d,md5:e("./md5")},g=64,y=new o(g);function w(e,t){var n=p[e=e||"sha1"],r=[];return n||b("algorithm:",e,"is not yet supported"),{update:function(e){return o.isBuffer(e)||(e=new o(e)),r.push(e),e.length,this},digest:function(e){var i=o.concat(r);i=t?function(e,t,n){o.isBuffer(t)||(t=new o(t)),o.isBuffer(n)||(n=new o(n)),t.length>g?t=e(t):t.length<g&&(t=o.concat([t,y],g));for(var r=new o(g),i=new o(g),u=0;u<g;u++)r[u]=54^t[u],i[u]=92^t[u];return n=e(o.concat([r,n])),e(o.concat([i,n]))}(n,t,i):n(i);return r=null,e?i.toString(e):i}}}function b(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}y.fill(0),n.createHash=function(e){return w(e)},n.createHmac=w,n.randomBytes=function(e,t){if(!t||!t.call)return new o(h(e));try{t.call(this,void 0,new o(h(e)))}catch(e){t(e)}};var m,v=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],_=function(e){n[e]=function(){b("sorry,",e,"is not implemented yet")}};for(m in v)_(v[m])}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("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")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(e,t,n){(function(n,r,o,i,u,s,a,f,l){var c=e("./helpers");function d(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,u=0;u<e.length;u+=16){var s=n,a=r,f=o,l=i;n=p(n,r,o,i,e[u+0],7,-680876936),i=p(i,n,r,o,e[u+1],12,-389564586),o=p(o,i,n,r,e[u+2],17,606105819),r=p(r,o,i,n,e[u+3],22,-1044525330);n=p(n,r,o,i,e[u+4],7,-176418897),i=p(i,n,r,o,e[u+5],12,1200080426),o=p(o,i,n,r,e[u+6],17,-1473231341),r=p(r,o,i,n,e[u+7],22,-45705983),n=p(n,r,o,i,e[u+8],7,1770035416),i=p(i,n,r,o,e[u+9],12,-1958414417),o=p(o,i,n,r,e[u+10],17,-42063),r=p(r,o,i,n,e[u+11],22,-1990404162),n=p(n,r,o,i,e[u+12],7,1804603682),i=p(i,n,r,o,e[u+13],12,-40341101),o=p(o,i,n,r,e[u+14],17,-1502002290),n=g(n,r=p(r,o,i,n,e[u+15],22,1236535329),o,i,e[u+1],5,-165796510),i=g(i,n,r,o,e[u+6],9,-1069501632),o=g(o,i,n,r,e[u+11],14,643717713),r=g(r,o,i,n,e[u+0],20,-373897302),n=g(n,r,o,i,e[u+5],5,-701558691),i=g(i,n,r,o,e[u+10],9,38016083),o=g(o,i,n,r,e[u+15],14,-660478335),r=g(r,o,i,n,e[u+4],20,-405537848),n=g(n,r,o,i,e[u+9],5,568446438),i=g(i,n,r,o,e[u+14],9,-1019803690),o=g(o,i,n,r,e[u+3],14,-187363961),r=g(r,o,i,n,e[u+8],20,1163531501),n=g(n,r,o,i,e[u+13],5,-1444681467),i=g(i,n,r,o,e[u+2],9,-51403784),o=g(o,i,n,r,e[u+7],14,1735328473),n=y(n,r=g(r,o,i,n,e[u+12],20,-1926607734),o,i,e[u+5],4,-378558),i=y(i,n,r,o,e[u+8],11,-2022574463),o=y(o,i,n,r,e[u+11],16,1839030562),r=y(r,o,i,n,e[u+14],23,-35309556),n=y(n,r,o,i,e[u+1],4,-1530992060),i=y(i,n,r,o,e[u+4],11,1272893353),o=y(o,i,n,r,e[u+7],16,-155497632),r=y(r,o,i,n,e[u+10],23,-1094730640),n=y(n,r,o,i,e[u+13],4,681279174),i=y(i,n,r,o,e[u+0],11,-358537222),o=y(o,i,n,r,e[u+3],16,-722521979),r=y(r,o,i,n,e[u+6],23,76029189),n=y(n,r,o,i,e[u+9],4,-640364487),i=y(i,n,r,o,e[u+12],11,-421815835),o=y(o,i,n,r,e[u+15],16,530742520),n=w(n,r=y(r,o,i,n,e[u+2],23,-995338651),o,i,e[u+0],6,-198630844),i=w(i,n,r,o,e[u+7],10,1126891415),o=w(o,i,n,r,e[u+14],15,-1416354905),r=w(r,o,i,n,e[u+5],21,-57434055),n=w(n,r,o,i,e[u+12],6,1700485571),i=w(i,n,r,o,e[u+3],10,-1894986606),o=w(o,i,n,r,e[u+10],15,-1051523),r=w(r,o,i,n,e[u+1],21,-2054922799),n=w(n,r,o,i,e[u+8],6,1873313359),i=w(i,n,r,o,e[u+15],10,-30611744),o=w(o,i,n,r,e[u+6],15,-1560198380),r=w(r,o,i,n,e[u+13],21,1309151649),n=w(n,r,o,i,e[u+4],6,-145523070),i=w(i,n,r,o,e[u+11],10,-1120210379),o=w(o,i,n,r,e[u+2],15,718787259),r=w(r,o,i,n,e[u+9],21,-343485551),n=b(n,s),r=b(r,a),o=b(o,f),i=b(i,l)}return Array(n,r,o,i)}function h(e,t,n,r,o,i){return b((t=b(b(t,e),b(r,i)))<<o|t>>>32-o,n)}function p(e,t,n,r,o,i,u){return h(t&n|~t&r,e,t,o,i,u)}function g(e,t,n,r,o,i,u){return h(t&r|n&~r,e,t,o,i,u)}function y(e,t,n,r,o,i,u){return h(t^n^r,e,t,o,i,u)}function w(e,t,n,r,o,i,u){return h(n^(t|~r),e,t,o,i,u)}function b(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}t.exports=function(e){return c.hash(e,d,16)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("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")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e,t,n){(function(e,n,r,o,i,u,s,a,f){t.exports=function(e){for(var t,n=new Array(e),r=0;r<e;r++)0==(3&r)&&(t=4294967296*Math.random()),n[r]=t>>>((3&r)<<3)&255;return n}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("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")},{buffer:3,lYpoI2:11}],8:[function(e,t,n){(function(n,r,o,i,u,s,a,f,l){var c=e("./helpers");function d(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var n,r,o,i=Array(80),u=1732584193,s=-271733879,a=-1732584194,f=271733878,l=-1009589776,c=0;c<e.length;c+=16){for(var d=u,g=s,y=a,w=f,b=l,m=0;m<80;m++){i[m]=m<16?e[c+m]:p(i[m-3]^i[m-8]^i[m-14]^i[m-16],1);var v=h(h(p(u,5),(v=s,r=a,o=f,(n=m)<20?v&r|~v&o:!(n<40)&&n<60?v&r|v&o|r&o:v^r^o)),h(h(l,i[m]),(n=m)<20?1518500249:n<40?1859775393:n<60?-1894007588:-899497514));l=f,f=a,a=p(s,30),s=u,u=v}u=h(u,d),s=h(s,g),a=h(a,y),f=h(f,w),l=h(l,b)}return Array(u,s,a,f,l)}function h(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function p(e,t){return e<<t|e>>>32-t}t.exports=function(e){return c.hash(e,d,20,!0)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("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")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(e,t,n){(function(n,r,o,i,u,s,a,f,l){function c(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function d(e,t){var n,r=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),o=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),i=new Array(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var u,s,a=0;a<e.length;a+=16){for(var f=o[0],l=o[1],d=o[2],h=o[3],y=o[4],w=o[5],b=o[6],m=o[7],v=0;v<64;v++)i[v]=v<16?e[v+a]:c(c(c((s=i[v-2],p(s,17)^p(s,19)^g(s,10)),i[v-7]),(s=i[v-15],p(s,7)^p(s,18)^g(s,3))),i[v-16]),n=c(c(c(c(m,p(s=y,6)^p(s,11)^p(s,25)),y&w^~y&b),r[v]),i[v]),u=c(p(u=f,2)^p(u,13)^p(u,22),f&l^f&d^l&d),m=b,b=w,w=y,y=c(h,n),h=d,d=l,l=f,f=c(n,u);o[0]=c(f,o[0]),o[1]=c(l,o[1]),o[2]=c(d,o[2]),o[3]=c(h,o[3]),o[4]=c(y,o[4]),o[5]=c(w,o[5]),o[6]=c(b,o[6]),o[7]=c(m,o[7])}return o}var h=e("./helpers"),p=function(e,t){return e>>>t|e<<32-t},g=function(e,t){return e>>>t};t.exports=function(e){return h.hash(e,d,32,!0)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("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")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e,t,n){(function(e,t,r,o,i,u,s,a,f){n.read=function(e,t,n,r,o){var i,u,s=8*o-r-1,a=(1<<s)-1,f=a>>1,l=-7,c=n?o-1:0,d=n?-1:1;o=e[t+c];for(c+=d,i=o&(1<<-l)-1,o>>=-l,l+=s;0<l;i=256*i+e[t+c],c+=d,l-=8);for(u=i&(1<<-l)-1,i>>=-l,l+=r;0<l;u=256*u+e[t+c],c+=d,l-=8);if(0===i)i=1-f;else{if(i===a)return u?NaN:1/0*(o?-1:1);u+=Math.pow(2,r),i-=f}return(o?-1:1)*u*Math.pow(2,i-r)},n.write=function(e,t,n,r,o,i){var u,s,a=8*i-o-1,f=(1<<a)-1,l=f>>1,c=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,h=r?1:-1;i=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,u=f):(u=Math.floor(Math.log(t)/Math.LN2),t*(r=Math.pow(2,-u))<1&&(u--,r*=2),2<=(t+=1<=u+l?c/r:c*Math.pow(2,1-l))*r&&(u++,r/=2),f<=u+l?(s=0,u=f):1<=u+l?(s=(t*r-1)*Math.pow(2,o),u+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,o),u=0));8<=o;e[n+d]=255&s,d+=h,s/=256,o-=8);for(u=u<<o|s,a+=o;0<a;e[n+d]=255&u,d+=h,u/=256,a-=8);e[n+d-h]|=128*i}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("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")},{buffer:3,lYpoI2:11}],11:[function(e,t,n){(function(e,n,r,o,i,u,s,a,f){var l,c,d;function h(){}(e=t.exports={}).nextTick=(c="undefined"!=typeof window&&window.setImmediate,d="undefined"!=typeof window&&window.postMessage&&window.addEventListener,c?function(e){return window.setImmediate(e)}:d?(l=[],window.addEventListener("message",function(e){var t=e.source;t!==window&&null!==t||"process-tick"!==e.data||(e.stopPropagation(),0<l.length&&l.shift()())},!0),function(e){l.push(e),window.postMessage("process-tick","*")}):function(e){setTimeout(e,0)}),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.on=h,e.addListener=h,e.once=h,e.off=h,e.removeListener=h,e.removeAllListeners=h,e.emit=h,e.binding=function(e){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(e){throw new Error("process.chdir is not supported")}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("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")},{buffer:3,lYpoI2:11}]},{},[1])(1)});
5
- },{}],"GPLR":[function(require,module,exports) {
6
- "use strict";var e,r;Object.defineProperty(exports,"__esModule",{value:!0}),exports.VersionsMetapage=exports.VersionsMetaframe=exports.MetapageVersionsAll=exports.MetapageVersionCurrent=exports.MetaframeVersionsAll=exports.MetaframeVersionCurrent=void 0,exports.VersionsMetaframe=e,function(e){e.V0_3="0.3",e.V0_4="0.4",e.V0_5="0.5",e.V0_6="0.6"}(e||(exports.VersionsMetaframe=e={})),exports.VersionsMetapage=r,function(e){e.V0_2="0.2",e.V0_3="0.3"}(r||(exports.VersionsMetapage=r={}));const s=Object.keys(e);exports.MetaframeVersionsAll=s;const t=e.V0_6;exports.MetaframeVersionCurrent=t;const o=Object.keys(r);exports.MetapageVersionsAll=o;const a=r.V0_3;exports.MetapageVersionCurrent=a;
7
- },{}],"s3GQ":[function(require,module,exports) {
8
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"MetaframeVersionCurrent",{enumerable:!0,get:function(){return e.MetaframeVersionCurrent}}),Object.defineProperty(exports,"MetaframeVersionsAll",{enumerable:!0,get:function(){return e.MetaframeVersionsAll}}),Object.defineProperty(exports,"MetapageVersionCurrent",{enumerable:!0,get:function(){return e.MetapageVersionCurrent}}),Object.defineProperty(exports,"MetapageVersionsAll",{enumerable:!0,get:function(){return e.MetapageVersionsAll}});var e=require("./versions");
9
- },{"./versions":"GPLR"}],"jX2q":[function(require,module,exports) {
10
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.MetapageEvents=void 0,exports.MetapageEvents=e,function(e){e.Inputs="inputs",e.Outputs="outputs",e.State="state",e.Definition="definition",e.DefinitionUpdateRequest="definitionupdaterequest",e.Error="error",e.UrlHashUpdate="urlhashupdate",e.Message="Message"}(e||(exports.MetapageEvents=e={}));
11
- },{}],"TmGQ":[function(require,module,exports) {
12
- "use strict";var e,t,s;Object.defineProperty(exports,"__esModule",{value:!0}),exports.JsonRpcMethodsFromParent=exports.JsonRpcMethodsFromChild=exports.ApiPayloadPluginRequestMethod=void 0,exports.JsonRpcMethodsFromChild=e,function(e){e.InputsUpdate="InputsUpdate",e.OutputsUpdate="OutputsUpdate",e.SetupIframeClientRequest="SetupIframeClientRequest",e.SetupIframeServerResponseAck="SetupIframeServerResponseAck",e.PluginRequest="SetupIframeServerPluginRequestResponseAck",e.HashParamsUpdate="HashParamsUpdate"}(e||(exports.JsonRpcMethodsFromChild=e={})),exports.JsonRpcMethodsFromParent=t,function(e){e.InputsUpdate="InputsUpdate",e.MessageAck="MessageAck",e.SetupIframeServerResponse="SetupIframeServerResponse"}(t||(exports.JsonRpcMethodsFromParent=t={})),exports.ApiPayloadPluginRequestMethod=s,function(e){e.State="metapage/state"}(s||(exports.ApiPayloadPluginRequestMethod=s={}));
13
- },{}],"D/Lb":[function(require,module,exports) {
14
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
15
- },{}],"1svx":[function(require,module,exports) {
16
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./core");Object.keys(e).forEach(function(r){"default"!==r&&"__esModule"!==r&&(r in exports&&exports[r]===e[r]||Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}}))});var r=require("./events");Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&(e in exports&&exports[e]===r[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}}))});var t=require("./jsonrpc");Object.keys(t).forEach(function(e){"default"!==e&&"__esModule"!==e&&(e in exports&&exports[e]===t[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}}))});var o=require("./metaframe");Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&(e in exports&&exports[e]===o[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return o[e]}}))});var n=require("./metapage");Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&(e in exports&&exports[e]===n[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}}))});var u=require("./versions");Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&(e in exports&&exports[e]===u[e]||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return u[e]}}))});
17
- },{"./core":"s3GQ","./events":"jX2q","./jsonrpc":"TmGQ","./metaframe":"D/Lb","./metapage":"D/Lb","./versions":"GPLR"}],"Xnuv":[function(require,module,exports) {
18
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VERSION_METAPAGE=exports.VERSION_METAFRAME=exports.METAPAGE_KEY_STATE=exports.METAPAGE_KEY_DEFINITION=exports.METAFRAME_JSON_FILE=void 0;var e=require("./v0_4");const t="metaframe.json";exports.METAFRAME_JSON_FILE="metaframe.json";const E="metapage/definition";exports.METAPAGE_KEY_DEFINITION="metapage/definition";const s="metapage/state";exports.METAPAGE_KEY_STATE="metapage/state";const o=e.MetapageVersionsAll[e.MetapageVersionsAll.length-1];exports.VERSION_METAPAGE=o;const A=e.MetaframeVersionsAll[e.MetaframeVersionsAll.length-1];exports.VERSION_METAFRAME=A;
19
- },{"./v0_4":"1svx"}],"p8iL":[function(require,module,exports) {
20
- "use strict";function t(t,e){const r=s(t),o=s(e),n=r.pop(),i=o.pop(),a=c(r,o);return 0!==a?a:n&&i?c(n.split("."),i.split(".")):n||i?n?-1:1:0}Object.defineProperty(exports,"__esModule",{value:!0}),exports.compare=void 0,exports.default=t,exports.validate=exports.satisfies=void 0;const e=t=>"string"==typeof t&&/^[v\d]/.test(t)&&n.test(t);exports.validate=e;const r=(e,r,o)=>{l(o);const n=t(e,r);return f[o].includes(n)};exports.compare=r;const o=(t,e)=>{const o=e.match(/^([<>=~^]+)/),n=o?o[1]:"=";if("^"!==n&&"~"!==n)return r(t,e,n);const[i,a,p]=s(t),[f,u,l]=s(e);return 0===d(i,f)&&("^"===n?c([a,p],[u,l])>=0:0===d(a,u)&&d(p,l)>=0)};exports.satisfies=o,t.validate=e,t.compare=r,t.satisfies=o;const n=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,s=t=>{if("string"!=typeof t)throw new TypeError("Invalid argument expected string");const e=t.match(n);if(!e)throw new Error(`Invalid argument not valid semver ('${t}' received)`);return e.shift(),e},i=t=>"*"===t||"x"===t||"X"===t,a=t=>{const e=parseInt(t,10);return isNaN(e)?t:e},p=(t,e)=>typeof t!=typeof e?[String(t),String(e)]:[t,e],d=(t,e)=>{if(i(t)||i(e))return 0;const[r,o]=p(a(t),a(e));return r>o?1:r<o?-1:0},c=(t,e)=>{for(let r=0;r<Math.max(t.length,e.length);r++){const o=d(t[r]||0,e[r]||0);if(0!==o)return o}return 0},f={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]},u=Object.keys(f),l=t=>{if("string"!=typeof t)throw new TypeError(`Invalid operator type, expected string but got ${typeof t}`);if(-1===u.indexOf(t))throw new Error(`Invalid operator, expected one of ${u.join("|")}`)};
21
- },{}],"UASB":[function(require,module,exports) {
22
- "use strict";var e=Object.prototype.hasOwnProperty,t="~";function n(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,n,o,s,i){if("function"!=typeof o)throw new TypeError("The listener must be a function");var c=new r(o,s||e,i),f=t?t+n:n;return e._events[f]?e._events[f].fn?e._events[f]=[e._events[f],c]:e._events[f].push(c):(e._events[f]=c,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function i(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(t=!1)),i.prototype.eventNames=function(){var n,r,o=[];if(0===this._eventsCount)return o;for(r in n=this._events)e.call(n,r)&&o.push(t?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(n)):o},i.prototype.listeners=function(e){var n=t?t+e:e,r=this._events[n];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,s=r.length,i=new Array(s);o<s;o++)i[o]=r[o].fn;return i},i.prototype.listenerCount=function(e){var n=t?t+e:e,r=this._events[n];return r?r.fn?1:r.length:0},i.prototype.emit=function(e,n,r,o,s,i){var c=t?t+e:e;if(!this._events[c])return!1;var f,u,a=this._events[c],l=arguments.length;if(a.fn){switch(a.once&&this.removeListener(e,a.fn,void 0,!0),l){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,n),!0;case 3:return a.fn.call(a.context,n,r),!0;case 4:return a.fn.call(a.context,n,r,o),!0;case 5:return a.fn.call(a.context,n,r,o,s),!0;case 6:return a.fn.call(a.context,n,r,o,s,i),!0}for(u=1,f=new Array(l-1);u<l;u++)f[u-1]=arguments[u];a.fn.apply(a.context,f)}else{var v,h=a.length;for(u=0;u<h;u++)switch(a[u].once&&this.removeListener(e,a[u].fn,void 0,!0),l){case 1:a[u].fn.call(a[u].context);break;case 2:a[u].fn.call(a[u].context,n);break;case 3:a[u].fn.call(a[u].context,n,r);break;case 4:a[u].fn.call(a[u].context,n,r,o);break;default:if(!f)for(v=1,f=new Array(l-1);v<l;v++)f[v-1]=arguments[v];a[u].fn.apply(a[u].context,f)}}return!0},i.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},i.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},i.prototype.removeListener=function(e,n,r,o){var i=t?t+e:e;if(!this._events[i])return this;if(!n)return s(this,i),this;var c=this._events[i];if(c.fn)c.fn!==n||o&&!c.once||r&&c.context!==r||s(this,i);else{for(var f=0,u=[],a=c.length;f<a;f++)(c[f].fn!==n||o&&!c[f].once||r&&c[f].context!==r)&&u.push(c[f]);u.length?this._events[i]=1===u.length?u[0]:u:s(this,i)}return this},i.prototype.removeAllListeners=function(e){var r;return e?(r=t?t+e:e,this._events[r]&&s(this,r)):(this._events=new n,this._eventsCount=0),this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prefixed=t,i.EventEmitter=i,"undefined"!=typeof module&&(module.exports=i);
23
- },{}],"Q9lO":[function(require,module,exports) {
24
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isIframe=exports.MetapageShared=exports.MetapageHashParams=exports.INITIAL_NULL_METAPAGE_DEFINITION=void 0;var e,t=require("eventemitter3"),r=require("./v0_4");exports.MetapageHashParams=e,function(e){e.mp_debug="mp_debug"}(e||(exports.MetapageHashParams=e={}));const s=()=>{try{return window!==window.top}catch(e){return!1}};exports.isIframe=s;const i={version:r.MetapageVersionCurrent,metaframes:{}};exports.INITIAL_NULL_METAPAGE_DEFINITION=i;class a extends t.EventEmitter{constructor(){super(),this._definition=i,this.getDefinition=this.getDefinition.bind(this)}error(e){throw"Subclass should implement"}getDefinition(){return this._definition}}exports.MetapageShared=a;
25
- },{"eventemitter3":"UASB","./v0_4":"1svx"}],"f0H1":[function(require,module,exports) {
26
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.stringToRgb=exports.pageLoaded=exports.merge=exports.log=exports.isPageLoaded=exports.isDebugFromUrlsParams=exports.intToRGB=exports.hashCode=exports.getUrlParamDebug=exports.getUrlParam=exports.getMatchingVersion=exports.generateNonce=exports.generateMetapageId=exports.generateMetaframeId=exports.generateId=exports.existsAnyUrlParam=exports.convertMetapageDefinitionToCurrentVersion=exports.convertMetaframeJsonToCurrentVersion=void 0;var e=require("compare-versions"),t=require("./Shared"),r=require("./v0_4");const o=e=>{if(null===e)throw"Metapage definition cannot be null";if("string"==typeof e)try{e=JSON.parse(e)}catch(a){throw`Cannot parse into JSON:\n${e}`}if(!e.version)throw'Missing "version" key in metapage definition';let t;switch(c(e.version)){case r.VersionsMetapage.V0_2:t=o(i(e));break;case r.VersionsMetapage.V0_3:t=e;break;default:console.warn(`Metapage definition version=${e.version} but we only know up to version ${r.MetapageVersionCurrent}. Assuming the definition is compatible, but it's the future!`),t=e}return t};exports.convertMetapageDefinitionToCurrentVersion=o;const a=(e,t)=>{if(e)switch(e.version){case void 0:case r.VersionsMetaframe.V0_3:case r.VersionsMetaframe.V0_4:return a(n(e));case r.VersionsMetaframe.V0_5:return s(e);case r.VersionsMetaframe.V0_6:return e;default:if(t&&t.errorIfUnknownVersion)throw`Unsupported metaframe version. Please upgrade to a new version: npm i @metapages/metapage@latest\n ${JSON.stringify(e)}\n${window.location.href}`;return console.error(`Unsupported metaframe version. Not throwing an error because you might not be able to upgrade. Please upgrade to a new version: npm i @metapages/metapage@latest\n ${JSON.stringify(e)}\n${window.location.href}`),e}};exports.convertMetaframeJsonToCurrentVersion=a;const n=e=>{const{version:t,inputs:o,outputs:a,allow:n,metadata:s,...i}=e,p=s,{title:c,author:g,image:m,descriptionUrl:u,keywords:d,iconUrl:l,...f}=p,h={name:c,author:g,description:u,image:m,tags:d,...f};return{version:r.VersionsMetaframe.V0_5,inputs:o,outputs:a,allow:n,metadata:h,...i}},s=e=>{const{metadata:t,...o}=e,a={...o,version:r.VersionsMetaframe.V0_6};if(t){const{edit:e,...r}=t,o={...r};if(a.metadata=o,e&&!(o&&o.operations&&o.operations.edit))switch(o.operations||(o.operations={}),e.type){case"metapage":const r=e.value,a={type:"metapage",metapage:r.definition,metaframe:r.key||"edit"};o.operations.edit=a;break;case"metaframe":const n=e.value,s={type:"url",url:n.url,params:n.params?n.params.map(e=>({to:e.to,from:e.from,toType:"path"===e.toType?void 0:e.toType})):void 0};o.operations.edit=s;break;default:throw`Unsupported edit type: ${e.type} in metadata for metaframe ${JSON.stringify(t)}`}}return a},i=e=>(e.version=r.VersionsMetapage.V0_3,e),p=(e,t)=>{if(!t)return!1;let r=!1;return Object.keys(t).forEach(o=>{r=!0,void 0===t[o]?delete e[o]:e[o]=t[o]}),r};exports.merge=p;const c=t=>{if("latest"===t)return r.MetapageVersionCurrent;if((0,e.compare)(t,"0.2","<"))throw`Unknown version: ${t}`;return(0,e.compare)(t,"0.2",">=")&&(0,e.compare)(t,r.VersionsMetapage.V0_3,"<")?r.VersionsMetapage.V0_2:(0,e.compare)(t,"0.3",">=")?r.VersionsMetapage.V0_3:(console.log(`Could not match version=${t} to any known version, assuming ${r.MetapageVersionCurrent}`),r.MetapageVersionCurrent)};exports.getMatchingVersion=c;const g=e=>window.location.search?new URLSearchParams(window.location.search).get(e):null;exports.getUrlParam=g;const m=()=>new URLSearchParams(window.location.search).has(t.MetapageHashParams.mp_debug);exports.getUrlParamDebug=m;const u=()=>{const e=new URLSearchParams(window.location.search).get(t.MetapageHashParams.mp_debug);return"true"===e||"1"===e};exports.isDebugFromUrlsParams=u;const d=e=>{return e.filter(e=>new URLSearchParams(window.location.search).has(e)).length>0};exports.existsAnyUrlParam=d;const l=(e=8)=>v(e);exports.generateMetaframeId=l;const f=(e=8)=>v(e);exports.generateMetapageId=f;const h=(e=8)=>v(e);exports.generateNonce=h;const w="abcdefghijklmnopqrstuvwxyz0123456789",v=(e=8)=>{for(var t="",r=w.length,o=0;o<e;o++)t+=w.charAt(Math.floor(Math.random()*r));return t};exports.generateId=v;const x=(e,t,r)=>{let o;if((t=t||"000")&&""==t.trim()&&(t=void 0),o="string"==typeof e?e:"number"==typeof e?e+"":JSON.stringify(e,null," "),t&&""!=t.trim()){var a=`color: #${t}`;r&&(a=`${a}; background: #${r}`),o=`%c${o}`,window.console.log(o,a)}else window.console.log(o)};exports.log=x;const V=e=>y(M(e));exports.stringToRgb=V;const M=e=>{var t=0;for(let r=0;r<e.length;r++)t=e.charCodeAt(r)+((t<<5)-t);return t};exports.hashCode=M;const y=e=>{var t=(16777215&e).toString(16).toUpperCase();return"00000".substring(0,6-t.length)+t};exports.intToRGB=y;const b=()=>"complete"==document.readyState||"interactive"==document.readyState;exports.isPageLoaded=b;const P=async()=>b()?Promise.resolve():new Promise(e=>{if(b())return void e();let t=!1;window.addEventListener("load",()=>{t||(t=!0,e())});setTimeout(()=>{!t&&b()&&(t=!0,e())},200)});exports.pageLoaded=P;
27
- },{"compare-versions":"p8iL","./Shared":"Q9lO","./v0_4":"1svx"}],"X0XV":[function(require,module,exports) {
28
- var global = arguments[3];
29
- var r=arguments[3];!function(r){"use strict";function n(r){return encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,function(r,n){return String.fromCharCode(parseInt(n,16))})}function t(r){return a(n(r))}function e(r){var n=r.replace(/(.)/g,function(r,n){var t=n.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t});return decodeURIComponent(n)}function o(r){return e(f(r))}function f(r){return Array.prototype.map.call(r,function(r){return String.fromCharCode(r)}).join("")}function u(r){var n=f(r);return btoa(n)}function a(r){var n;return n="undefined"!=typeof Uint8Array?new Uint8Array(r.length):[],Array.prototype.forEach.call(r,function(r,t){n[t]=r.charCodeAt(0)}),n}function i(r){return a(atob(r))}r.Unibabel={utf8ToBinaryString:n,utf8ToBuffer:t,utf8ToBase64:function(r){var t=n(r);return btoa(t)},binaryStringToUtf8:e,bufferToUtf8:o,base64ToUtf8:function(r){return e(atob(r))},bufferToBinaryString:f,bufferToBase64:u,binaryStringToBuffer:a,base64ToBuffer:i,strToUtf8Arr:t,utf8ArrToStr:o,arrToBase64:u,base64ToArr:i}}("undefined"!=typeof exports&&exports||"undefined"!=typeof window&&window||r);
30
- },{}],"+Kmw":[function(require,module,exports) {
31
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.serializeInputs=exports.possiblySerializeValueToDataref=exports.possiblyDeserializeDatarefToValue=exports.deserializeInputs=void 0;var e=require("unibabel");const r=async e=>{for(const r of Object.keys(e)){const t=await a(e[r]);e[r]=t}return e};exports.serializeInputs=r;const t=async e=>{for(const r of Object.keys(e)){const t=await n(e[r]);e[r]=t}return e};exports.deserializeInputs=t;const a=async r=>{if(r instanceof Int8Array||r instanceof Uint8Array||r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array){const t=r,a={_s:!0,_c:r.constructor.name,value:e.Unibabel.bufferToBase64(new Uint8Array(t.buffer)),byteLength:t.byteLength,byteOffset:t.byteOffset,size:t.byteLength};return Promise.resolve(a)}if(r instanceof File){const t=r,a=await t.arrayBuffer();return{_s:!0,_c:File.name,value:e.Unibabel.bufferToBase64(new Uint8Array(a)),name:t.name,fileType:t.type,lastModified:t.lastModified,size:a.byteLength}}if(r instanceof Blob){const t=r,a=await t.arrayBuffer();return{_s:!0,_c:Blob.name,value:e.Unibabel.bufferToBase64(new Uint8Array(a)),fileType:t.type,size:a.byteLength}}if(r instanceof ArrayBuffer){const t=r,a={_s:!0,_c:ArrayBuffer.name,value:e.Unibabel.bufferToBase64(new Uint8Array(t)),size:t.byteLength};return Promise.resolve(a)}return Promise.resolve(r)};exports.possiblySerializeValueToDataref=a;const n=r=>{if(!r||"object"!=typeof r||!0!==r._s)return r;const t=r,a=t._c;if(a===Blob.name){const a=r;return new Blob([e.Unibabel.base64ToBuffer(t.value)],{type:a.fileType})}if(a===File.name){const a=r;return new File([e.Unibabel.base64ToBuffer(t.value)],a.name,{type:a.fileType,lastModified:a.lastModified})}if(a===ArrayBuffer.name){return e.Unibabel.base64ToBuffer(t.value).buffer}const n=r,s=e.Unibabel.base64ToBuffer(n.value),i=n._c;try{return new globalThis[i](s,n.byteOffset,n.byteLength)}catch(o){}return r};exports.possiblyDeserializeDatarefToValue=n;
32
- },{"unibabel":"X0XV"}],"nlP8":[function(require,module,exports) {
33
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MetapageIFrameRpcClient=void 0;var t=require("eventemitter3"),s=require("./Constants"),e=require("./v0_4"),i=require("./MetapageTools"),n=require("./Shared"),r=require("./v0_4/events"),a=require("./data");class o extends t.EventEmitter{constructor(t,s,e,r,a,o=!1){if(super(),this.inputs={},this.outputs={},this._disposables=[],this._rpcListeners=[],this._loaded=!1,this._onLoaded=[],this._sendInputsAfterRegistration=!1,this._plugin=!1,this._cachedEventInputsUpdate={iframeId:void 0,inputs:void 0},this._cachedEventOutputsUpdate={iframeId:null,inputs:null},!s.startsWith("http")){for(;s.startsWith("/");)s=s.substring(1);s=window.location.protocol+"//"+window.location.hostname+(window.location.port&&""!=window.location.port?":"+window.location.port:"")+"/"+s}this.url=s,this._metapage=t;var h=new URL(this.url);o&&h.searchParams.set(n.MetapageHashParams.mp_debug,"true"),this.url=h.href,this.id=e,this._debug=o,this._parentId=r,this._color=(0,i.stringToRgb)(this.id),this._consoleBackgroundColor=a,this._iframe=document.createElement("iframe"),this._iframe.name=this.id;const d=this;this.iframe=new Promise(t=>{(0,i.pageLoaded)().then(async()=>{if(d._iframe){const s=await d.getDefinition();if(!d._iframe)return;s&&s.allow&&(d._iframe.allow=s.allow),d._iframe.src=this.url,t(d._iframe)}})}),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)}addListenerReturnDisposer(t,s){super.addListener(t,s);return()=>{super.removeListener(t,s)}}setPlugin(){if(this._loaded)throw"Cannot setPlugin after MetapageIFrameRpcClient already loaded";return this._plugin=!0,this}setMetapage(t){return this._metapage=t,this}hasPermissionsState(){return void 0!==this._definition&&void 0!==this._definition.inputs&&void 0!==this._definition.inputs[s.METAPAGE_KEY_STATE]}hasPermissionsDefinition(){return void 0!==this._definition&&void 0!==this._definition.inputs&&void 0!==this._definition.inputs[s.METAPAGE_KEY_DEFINITION]}getDefinitionUrl(){var t=new URL(this.url);return t.pathname=t.pathname+(t.pathname.endsWith("/")?"metaframe.json":"/metaframe.json"),t.href}async getDefinition(){if(this._definition)return this._definition;var t=this.getDefinitionUrl();try{const e=await window.fetch(t);if(e.ok){const t=await e.json(),s=(0,i.convertMetaframeJsonToCurrentVersion)(t);return this._definition=s,this._definition}this.emit(r.MetapageEvents.Error,`Failed to fetch: ${t}\nStatus: ${e.status}\nStatus text: ${e.statusText}`)}catch(s){this.emit(r.MetapageEvents.Error,`Failed to fetch or convert: ${t}\nError: ${s}`)}}setInput(t,s){console.assert(!!t);var e={};e[t]=s,this.setInputs(e)}setInputs(t){if(this.log({m:"MetapageIFrameRpcClient",inputs:t}),!(0,i.merge)(this.inputs,t))return this;if(this._loaded||(this._sendInputsAfterRegistration=!0),this._iframe.parentNode&&this._loaded&&this.sendInputs(t),this.emit(r.MetapageEvents.Inputs,this.inputs),this._metapage.listenerCount(r.MetapageEvents.Inputs)>0){var s={};s[this.id]=t,this._metapage.emit(r.MetapageEvents.Inputs,s)}return this}setOutput(t,s){console.assert(!!t);var e={};e[t]=s,this.setOutputs(e)}setOutputs(t){if((0,i.merge)(this.outputs,t)&&(this.emit(r.MetapageEvents.Outputs,t),this._metapage.listenerCount(r.MetapageEvents.Outputs)>0)){var s={};s[this.id]=this.outputs,this._metapage.emit(r.MetapageEvents.Outputs,s)}}onInputs(t){return this.addListenerReturnDisposer(r.MetapageEvents.Inputs,t)}onInput(t,s){return this.addListenerReturnDisposer(r.MetapageEvents.Inputs,function(e){e.hasOwnProperty(t)&&s(e[t])})}onOutputs(t){return this.addListenerReturnDisposer(r.MetapageEvents.Outputs,t)}onOutput(t,s){return this.addListenerReturnDisposer(r.MetapageEvents.Outputs,function(e){e.hasOwnProperty(t)&&s(e[t])})}isDisposed(){return void 0===this.inputs}dispose(){for(super.removeAllListeners();this._disposables&&this._disposables.length>0;){const t=this._disposables.pop();t&&t()}this._rpcListeners=void 0,this.inputs=void 0,this.outputs=void 0,this._iframe&&this._iframe.parentNode&&this._iframe.parentNode.removeChild(this._iframe),this._iframe=void 0,this._bufferMessages=void 0,this._bufferTimeout&&(window.clearInterval(this._bufferTimeout),this._bufferTimeout=void 0),this._metapage=void 0}register(){var t={iframeId:this.id,parentId:this._parentId,plugin:this._plugin,state:{inputs:this.inputs},version:s.VERSION_METAPAGE};this.sendRpcInternal(e.JsonRpcMethodsFromParent.SetupIframeServerResponse,t)}registered(t){if(this.log({m:"MetapageIFrameRpcClient.registered",inputs:this.inputs}),!this._loaded){if(!t)throw"Cannot register without a version";for(this.version=t,this._loaded=!0;this._onLoaded&&this._onLoaded.length>0;)this._onLoaded.pop()();this._sendInputsAfterRegistration&&this.sendInputs(this.inputs)}}async sendInputs(t){t=await(0,a.serializeInputs)(t),this.sendRpc(e.JsonRpcMethodsFromParent.InputsUpdate,{inputs:t,parentId:this._parentId})}sendRpc(t,s){if(this._iframe.parentNode&&this._loaded)this.sendRpcInternal(t,s);else{this._metapage.error("sending rpc later");const e=this;this._onLoaded.push(()=>{e.sendRpcInternal(t,s)})}}ack(t){if(this.log("⚒ ⚒ ⚒ calling ack"),this._debug){this.log("⚒ ⚒ ⚒ sending ack from client to frame");var s={message:t};this.sendRpc(e.JsonRpcMethodsFromParent.MessageAck,s)}else this.log("⚒ ⚒ ⚒ NOT sending ack from client to frame since not debug mode")}log(t){this._debug&&this.logInternal(t)}logInternal(t){let s;s="string"==typeof t?t:"string"==typeof t?t+"":JSON.stringify(t),(0,i.log)(`Metapage[${this._parentId}] Metaframe[${this.id}] ${s}`,this._color,this._consoleBackgroundColor)}sendRpcInternal(t,s){const e={id:"_",iframeId:this.id,jsonrpc:"2.0",method:t,params:s,parentId:this._parentId};this._iframe?this.sendOrBufferPostMessage(e):this._metapage.error(`Cannot send to child iframe messageJSON=${JSON.stringify(e).substring(0,200)}`)}sendOrBufferPostMessage(t){if(this._iframe&&this._iframe.contentWindow)this._iframe.contentWindow.postMessage(t,this.url);else if(this._bufferMessages)this._bufferMessages.push(t);else{this._bufferMessages=[t];const s=this;this._bufferTimeout=window.setInterval(function(){s._iframe&&s._iframe.contentWindow&&(s._bufferMessages.forEach(t=>s._iframe.contentWindow.postMessage(t,s.url)),window.clearInterval(s._bufferTimeout),s._bufferTimeout=void 0,s._bufferMessages=void 0)},0)}}}exports.MetapageIFrameRpcClient=o;
34
- },{"eventemitter3":"UASB","./Constants":"Xnuv","./v0_4":"1svx","./MetapageTools":"f0H1","./Shared":"Q9lO","./v0_4/events":"jX2q","./data":"+Kmw"}],"Vntl":[function(require,module,exports) {
35
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.matchPipe=exports.getLibraryVersionMatching=exports.MetapageEventStateType=exports.Metapage=void 0;var t,e=p(require("object-hash")),s=require("./Constants"),i=require("./v0_4"),a=require("./MetapageTools"),n=require("./Shared"),r=require("./v0_4/events"),h=require("./MetapageIFrameRpcClient"),o=require("./data");function u(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,s=new WeakMap;return(u=function(t){return t?s:e})(t)}function p(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var s=u(e);if(s&&s.has(t))return s.get(t);var i={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in t)if("default"!==n&&Object.prototype.hasOwnProperty.call(t,n)){var r=a?Object.getOwnPropertyDescriptor(t,n):null;r&&(r.get||r.set)?Object.defineProperty(i,n,r):i[n]=t[n]}return i.default=t,s&&s.set(t,i),i}exports.MetapageEventStateType=t,function(t){t.all="all",t.delta="delta"}(t||(exports.MetapageEventStateType=t={}));const m=()=>({metaframes:{inputs:{},outputs:{}},plugins:{inputs:{},outputs:{}}}),g=t=>(0,a.getMatchingVersion)(t);exports.getLibraryVersionMatching=g;const f=(t,e)=>!e||"*"===e||(t===e||(e.endsWith("*")?t.startsWith(e.slice(0,-1)):!!e.startsWith("*")&&t.endsWith(e.slice(1))));exports.matchPipe=f;const d="bcbcbc";class l extends n.MetapageShared{constructor(t){super(),this._state=m(),this._metaframes={},this._plugins={},this._pluginOrder=[],this.debug=(0,a.isDebugFromUrlsParams)(),this._internalReceivedMessageCounter=0,this._cachedInputLookupMap={},this._inputMap={},this._id=t&&t.id?t.id:(0,a.generateMetapageId)(),this._consoleBackgroundColor=t&&t.color?t.color:d,this.addPipe=this.addPipe.bind(this),this.dispose=this.dispose.bind(this),this.addMetaframe=this.addMetaframe.bind(this),this.addPlugin=this.addPlugin.bind(this),this.getInputsFromOutput=this.getInputsFromOutput.bind(this),this.getMetaframe=this.getMetaframe.bind(this),this.getMetaframeIds=this.getMetaframeIds.bind(this),this.getMetaframeOrPlugin=this.getMetaframeOrPlugin.bind(this),this.getMetaframes=this.getMetaframes.bind(this),this.getPlugin=this.getPlugin.bind(this),this.getPluginIds=this.getPluginIds.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.pluginIds=this.pluginIds.bind(this),this.plugins=this.plugins.bind(this),this.removeAll=this.removeAll.bind(this),this.removeMetaframe=this.removeMetaframe.bind(this),this.removePlugin=this.removePlugin.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.setInputStateOnly=this.setInputStateOnly.bind(this),this.setMetaframeClientInputAndSentClientEvent=this.setMetaframeClientInputAndSentClientEvent.bind(this),this.setOutputStateOnly=this.setOutputStateOnly.bind(this),this.setState=this.setState.bind(this),this.isDisposed=this.isDisposed.bind(this),this.updatePluginsWithDefinition=this.updatePluginsWithDefinition.bind(this),this._emitDefinitionEvent=this._emitDefinitionEvent.bind(this),(0,a.pageLoaded)().then(()=>{this.isDisposed()||(window.addEventListener("message",this.onMessage),this.log("Initialized"))})}static from(t,e){if(null==t)throw"Metapage definition cannot be null";if("string"==typeof t)try{t=JSON.parse(t)}catch(s){throw"Cannot parse into JSON:\n${metaPageDef}"}return(new l).setDefinition(t)}isDisposed(){return void 0===this._metaframes}addListenerReturnDisposer(t,e){super.addListener(t,e);return()=>{super.removeListener(t,e)}}setDebugFromUrlParams(){return this.debug=(0,a.existsAnyUrlParam)(["MP_DEBUG","DEBUG","debug","mp_debug"]),this}getState(){return this._state}setState(t){this._state=t,this.getMetaframeIds().forEach(t=>{this.getMetaframe(t).setInputs(this._state.metaframes.inputs[t]),this.getMetaframe(t).setOutputs(this._state.metaframes.outputs[t])}),this.getPluginIds().forEach(t=>{this.getPlugin(t).setInputs(this._state.plugins.inputs[t]),this.getPlugin(t).setOutputs(this._state.plugins.outputs[t])}),this.emit(r.MetapageEvents.State,this._state)}getStateMetaframes(){return this._state.metaframes}getDefinition(){return this._definition}setDefinition(t,e){if(!t.version)throw"Metapage definition must have a version";const s=(0,a.convertMetapageDefinitionToCurrentVersion)(t);s.metaframes&&Object.keys(s.metaframes).forEach(t=>{if(s.plugins&&s.plugins.includes(t))throw this.emitErrorMessage(`Plugin with url=${t} matches metaframe. Metaframe ids and plugin urls are not allowed to collide`),`Plugin with url=${t} matches metaframe. Metaframe ids and plugin urls are not allowed to collide`;var e=s.metaframes[t];if("object"!=typeof e)throw this.emitErrorMessage(`Metaframe "${t}" is not an object`),`Metaframe "${t}" is not an object`;if(!e.url)throw this.emitErrorMessage(`Metaframe "${t}" missing field: url`),`Metaframe "${t}" missing field: url`});const i=this._definition;return this._definition=s,Object.keys(this._metaframes).forEach(t=>{s.metaframes&&s.metaframes[t]||this.removeMetaframe(t)}),Object.keys(this._plugins).forEach(t=>{s.plugins&&!s.plugins.includes(t)&&this.removePlugin(t)}),this._pluginOrder=s.plugins?s.plugins:[],e&&(this._state=e),s.metaframes&&Object.keys(s.metaframes).forEach(t=>{if(!this._metaframes.hasOwnProperty(t)){const e=s.metaframes[t];this.addMetaframe(t,e)}}),s.plugins&&s.plugins.forEach(t=>{this._plugins.hasOwnProperty(t)||this.addPlugin(t)}),i!==n.INITIAL_NULL_METAPAGE_DEFINITION&&window.setTimeout(()=>{this.isDisposed()||s!==this._definition||(this._emitDefinitionEvent(),e&&this.emit(r.MetapageEvents.State,this._state))},0),this}_emitDefinitionEvent(){const t={definition:this._definition,metaframes:this._metaframes,plugins:this._plugins};this.emit(r.MetapageEvents.Definition,t)}addPipe(t,e){this._inputMap[t]||(this._inputMap[t]=[]),this._inputMap[t].push(e)}removeMetaframe(t){this._metaframes[t]&&(this._metaframes[t].dispose(),delete this._metaframes[t],delete this._state.metaframes.inputs[t],delete this._state.metaframes.outputs[t],delete this._inputMap[t],Object.keys(this._inputMap).forEach(e=>{const s=this._inputMap[e];let i=0;for(;i<=s.length;)s[i]&&s[i].metaframe===t?s.splice(i,1):i++}),this._cachedInputLookupMap={})}removePlugin(t){this._plugins[t]&&(this._plugins[t].dispose(),delete this._plugins[t],delete this._state.plugins.inputs[t],delete this._state.plugins.outputs[t])}removeAll(){Object.keys(this._metaframes).forEach(t=>this._metaframes[t].dispose()),Object.keys(this._plugins).forEach(t=>this._plugins[t].dispose()),this._metaframes={},this._plugins={},this._state=m(),this._inputMap={},this._cachedInputLookupMap={}}metaframes(){return this.getMetaframes()}metaframeIds(){return this.getMetaframeIds()}getMetaframeIds(){return Object.keys(this._metaframes)}getMetaframes(){return Object.assign({},this._metaframes)}plugins(){return Object.assign({},this._plugins)}pluginIds(){return this.getPluginIds()}getPluginIds(){return this._pluginOrder.slice(0)}getMetaframe(t){return this._metaframes[t]}getPlugin(t){return this._plugins[t]}addMetaframe(t,e){if(!t)throw"addMetaframe missing metaframeId";if(!e)throw"addMetaframe missing definition";if(this._metaframes[t])throw this.emitErrorMessage(`Existing metaframe for id=${t}`),`Existing metaframe for id=${t}`;if(!e.url)throw this.emitErrorMessage(`Metaframe definition missing url id=${t}`),`Metaframe definition missing url id=${t}`;var s=new h.MetapageIFrameRpcClient(this,e.url,t,this._id,this._consoleBackgroundColor,this.debug).setMetapage(this);return this._metaframes[t]=s,s.addListener(r.MetapageEvents.Error,t=>{this.emit(r.MetapageEvents.Error,{metaframeId:s.id,metaframeUrl:s.url,error:t})}),e.inputs&&e.inputs.forEach(e=>this.addPipe(t,e)),s.setInputs(this._state.metaframes.inputs[t]),s}addPlugin(t){if(!t)throw"Plugin missing url";const e=new h.MetapageIFrameRpcClient(this,t,t,this._id,this._consoleBackgroundColor,this.debug).setInputs(this._state.plugins.inputs[t]).setMetapage(this).setPlugin();return c(this,e),this._plugins[t]=e,e}dispose(){this.log("disposing"),super.removeAllListeners(),window.removeEventListener("message",this.onMessage),this._metaframes&&Object.keys(this._metaframes).forEach(t=>this._metaframes[t].dispose()),this._plugins&&Object.keys(this._plugins).forEach(t=>this._plugins[t].dispose()),this._id=void 0,this._metaframes=void 0,this._plugins=void 0,this._state=void 0,this._cachedInputLookupMap=void 0,this._inputMap=void 0}log(t,e,s){this.debug&&this.logInternal(t,e,s)}error(t){this.logInternal(t,"f00",this._consoleBackgroundColor),this.emitErrorMessage(`${t}`)}emitErrorMessage(t){this.emit(r.MetapageEvents.Error,t)}getInputsFromOutput(t,e){if(this._cachedInputLookupMap[t]||(this._cachedInputLookupMap[t]={}),!this._cachedInputLookupMap[t][e]){var s=[];this._cachedInputLookupMap[t][e]=s,Object.keys(this._inputMap).forEach(i=>{i!==t&&this._inputMap[i].forEach(a=>{if(a.metaframe==t&&f(e,a.source)){var n=a.target;a.target&&!a.target.startsWith("*")&&""!==a.target||(n=e),s.push({metaframe:i,pipe:n})}})})}return this._cachedInputLookupMap[t][e]}isValidJSONRpcMessage(t){if("2.0"!==t.jsonrpc)return!1;switch(t.method){case i.JsonRpcMethodsFromChild.SetupIframeClientRequest:return!0;default:var e=t.iframeId;return!(e&&(t.parentId!==this._id||!this._metaframes[e]&&!this._plugins[e]))}}setInput(t,e,s){this.setInputStateOnly(t,e,s),this.setMetaframeClientInputAndSentClientEvent(t,e,s),this.emit(r.MetapageEvents.State,this._state),this.emit(r.MetapageEvents.Inputs,this._state)}setMetaframeClientInputAndSentClientEvent(t,e,s){if("object"==typeof t){if(e||s)throw"bad arguments, see API docs";const i=t;Object.keys(i).forEach(t=>{var e=t,s=i[e];if("object"!=typeof s)throw"bad arguments, see API docs";var a=this._metaframes[e];a?a.setInputs(s):this.error("No iframe id=$metaframeId")})}else{if("string"!=typeof t)throw"bad arguments, see API docs";{const i=this._metaframes[t];if(null==i&&this.error(`No iframe id=${t}`),"string"==typeof e)i.setInput(e,s);else{if("object"!=typeof e)throw"bad arguments, see API docs";i.setInputs(e)}}}}setInputs(t,e,s){this.setInput(t,e,s)}setOutputStateOnly(t,e,s){this._setStateOnly(!1,t,e,s)}setInputStateOnly(t,e,s){this._setStateOnly(!0,t,e,s)}_setStateOnly(t,e,s,i){if("object"==typeof e){if(s||i)throw"If first argument is an object, subsequent args should be undefined";const a=e;Object.keys(a).forEach(e=>{var s=a[e];if("object"!=typeof s)throw"Object values must be objects";const i=this._metaframes.hasOwnProperty(e);if(!i&&!this._plugins.hasOwnProperty(e))throw"No metaframe or plugin: ${metaframeId}";const n=i?t?this._state.metaframes.inputs:this._state.metaframes.outputs:t?this._state.plugins.inputs:this._state.plugins.outputs;n[e]=n[e]?n[e]:{},Object.keys(s).forEach(t=>{void 0===s[t]?delete n[e][t]:n[e][t]=s[t]})})}else{if("string"!=typeof e)throw"First argument must be a string or an object";{const a=e,n=this._metaframes.hasOwnProperty(a);if(!n&&!this._plugins.hasOwnProperty(a))throw`No metaframe or plugin: ${a}`;const r=n?t?this._state.metaframes.inputs:this._state.metaframes.outputs:t?this._state.plugins.inputs:this._state.plugins.outputs;if("string"==typeof s){r[a]=r[a]?r[a]:{};const t=s;void 0===i?delete r[a][t]:r[a][t]=i}else{if("object"!=typeof s)throw"Second argument must be a string or an object";{r[a]=r[a]?r[a]:{};const t=s;Object.keys(t).forEach(e=>{void 0===t[e]?delete r[a][e]:r[a][e]=t[e]})}}}}}getMetaframeOrPlugin(t){var e=this._metaframes[t];return e||(e=this._plugins[t]),e}onMessage(t){if("object"==typeof t.data){const o=t.data;if(!this.isValidJSONRpcMessage(o))return;var e=o.method;const u=o.iframeId;if(!u)return;const p=this.getMetaframeOrPlugin(u),m=this._plugins[u];switch(o._messageCount=++this._internalReceivedMessageCounter,this.debug&&this.log(`processing ${JSON.stringify(o,null," ").substr(0,500)}`),e){case i.JsonRpcMethodsFromChild.SetupIframeClientRequest:p&&p.register();break;case i.JsonRpcMethodsFromChild.SetupIframeServerResponseAck:if(p){const t=o.params;p.registered(t.version)}break;case i.JsonRpcMethodsFromChild.OutputsUpdate:const t=o.params;if(this._metaframes[u]){var a=this._metaframes[u];this.setOutputStateOnly(u,t),a.setOutputs(t),this.emit(r.MetapageEvents.State,this._state);var n=!1;const e=Object.keys(t),s={};e.forEach((e,i)=>{const a=this.getInputsFromOutput(u,e);a.length>0&&a.forEach(i=>{s[i.metaframe]||(s[i.metaframe]={}),s[i.metaframe][i.pipe]=t[e],this.setInputStateOnly(i.metaframe,i.pipe,t[e]),n=!0})}),Object.keys(s).forEach(t=>{this._metaframes[t].setInputs(s[t])}),n&&this.emit(r.MetapageEvents.State,this._state),this.debug&&a.ack({jsonrpc:o,state:this._state})}else if(this._plugins[u]){const e=!t[s.METAPAGE_KEY_STATE]&&!t[s.METAPAGE_KEY_DEFINITION];e&&this.setOutputStateOnly(u,t),this._plugins[u].setOutputs(t),e&&this.emit(r.MetapageEvents.State,this._state),this.debug&&this._plugins[u].ack({jsonrpc:o,state:this._state})}else this.error("missing metaframe/plugin=$metaframeId");break;case i.JsonRpcMethodsFromChild.InputsUpdate:var h=o.params;if(this.debug&&this.log(`inputs ${JSON.stringify(h)} from ${u}`),this._metaframes[u])this.setInputStateOnly(u,h),this._metaframes[u].setInputs(h),this.emit(r.MetapageEvents.State,this._state),this.debug&&this._metaframes[u].ack({jsonrpc:o,state:this._state});else if(this._plugins[u]){const t=!h[s.METAPAGE_KEY_STATE]&&!h[s.METAPAGE_KEY_DEFINITION];t&&this.setInputStateOnly(u,h),this._plugins[u].setInputs(h),t&&this.emit(r.MetapageEvents.State,this._state),this.debug&&this._plugins[u].ack({jsonrpc:o,state:this._state})}else console.error(`InputsUpdate failed no metaframe or plugin id: "${u}"`),this.error(`InputsUpdate failed no metaframe or plugin id: "${u}"`);break;case i.JsonRpcMethodsFromChild.PluginRequest:m&&p&&p.hasPermissionsState()&&(p.setInput(s.METAPAGE_KEY_STATE,this._state),this.debug&&p.ack({jsonrpc:o,state:this._state}));break;case i.JsonRpcMethodsFromChild.HashParamsUpdate:if(!m&&p){const t=o.params,e=new URL(p.url);e.hash=t.hash,p.url=e.href,this._definition.metaframes[t.metaframe].url=e.href,this._emitDefinitionEvent()}break;default:this.debug&&this.log(`Unknown RPC method: "${e}"`)}this.emit(r.MetapageEvents.Message,o)}}updatePluginsWithDefinition(){this.getDefinition();Object.values(this._plugins).forEach(t=>{t.hasPermissionsDefinition()&&_(t)})}logInternal(t,e,s){let i;s=s||this._consoleBackgroundColor,i="string"==typeof t?t:"number"==typeof t?t+"":JSON.stringify(t),i=this._id?`Metapage[${this._id}] ${i}`:i,(0,a.log)(i,e,s)}}exports.Metapage=l,l.version=s.VERSION_METAPAGE,l.DEFINITION=r.MetapageEvents.Definition,l.DEFINITION_UPDATE_REQUEST=r.MetapageEvents.DefinitionUpdateRequest,l.ERROR=r.MetapageEvents.Error,l.INPUTS=r.MetapageEvents.Inputs,l.MESSAGE=r.MetapageEvents.Message,l.OUTPUTS=r.MetapageEvents.Outputs,l.STATE=r.MetapageEvents.State,l.deserializeInputs=o.deserializeInputs,l.serializeInputs=o.serializeInputs;const c=async(t,i)=>{try{const o=await i.getDefinition();if(!o)throw`${i.url}`;if(i.isDisposed())return;if(i.hasPermissionsDefinition()){var a=t.addListenerReturnDisposer(r.MetapageEvents.Definition,t=>{i.setInput(s.METAPAGE_KEY_DEFINITION,t.definition)});i._disposables.push(a);var n=t.getDefinition();if(n&&(i.setInput(s.METAPAGE_KEY_DEFINITION,n),o.outputs)){a=i.onOutput(s.METAPAGE_KEY_DEFINITION,s=>{e.sha1(s)!==e.sha1(n)&&t.emit(r.MetapageEvents.DefinitionUpdateRequest,s)});i._disposables.push(a)}}if(i.hasPermissionsState()&&o.outputs){a=i.onOutput(s.METAPAGE_KEY_STATE,e=>{t.setState(e)});i._disposables.push(a)}}catch(h){console.error(h),t.emit(r.MetapageEvents.Error,`Failed to get plugin definition from "${i.getDefinitionUrl()}", error=${h}`)}},_=t=>{const e=t._metapage.getDefinition();t.setInput(s.METAPAGE_KEY_DEFINITION,e)};
36
- },{"object-hash":"J0Ce","./Constants":"Xnuv","./v0_4":"1svx","./MetapageTools":"f0H1","./Shared":"Q9lO","./v0_4/events":"jX2q","./MetapageIFrameRpcClient":"nlP8","./data":"+Kmw"}]},{},["Vntl"], "metapage")
37
- //# sourceMappingURL=/index.js.map