!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.pluginEngine=t():e.pluginEngine=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,u)}a((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e){this.profile=e,this.requestQueue=[]}return Object.defineProperty(e.prototype,"name",{get:function(){return this.profile.name},enumerable:!0,configurable:!0}),e.prototype.activate=function(){this.onActivation&&this.onActivation()},e.prototype.deactivate=function(){this.onDeactivation&&this.onDeactivation()},e.prototype.callPluginMethod=function(e,t){if(!(e in this))throw new Error("Method "+e+" is not implemented by "+this.profile.name);return this[e].apply(this,t)},e.prototype.addRequest=function(e,t,n){var o=this;return new Promise(function(s,u){o.profile.methods&&o.profile.methods.includes(t)||u(new Error("Method "+t+" is not exposed by "+o.profile.name)),o.requestQueue.push(function(){return r(o,void 0,void 0,function(){var r,o,a,c,l=this;return i(this,function(i){switch(i.label){case 0:this.currentRequest=e,r=!1,o=function(){r&&u("call to plugin has timed out "+l.profile.name+" - "+t+" - "+JSON.stringify(l.currentRequest)),delete l.currentRequest,l.requestQueue.shift(),0!==l.requestQueue.length&&l.requestQueue[0]()},i.label=1;case 1:return i.trys.push([1,3,,4]),setTimeout(function(){r=!0,o()},1e4),[4,this.callPluginMethod(t,n)];case 2:return a=i.sent(),r?[2]:(s(a),[3,4]);case 3:return c=i.sent(),u(c),[3,4];case 4:return o(),[2]}})})}),1===o.requestQueue.length&&o.requestQueue[0]()})},e.prototype.on=function(e,t,n){throw new Error('Method "on" from '+this.name+" should be hooked by PluginEngine")},e.prototype.call=function(e,t){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];return r(this,void 0,void 0,function(){return i(this,function(e){throw new Error('Method "call" from '+this.name+" should be hooked by PluginEngine")})})},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];throw new Error('Method "emit" from '+this.name+" should be hooked by PluginEngine")},e}();t.Plugin=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(19))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(20))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(21))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(22))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(23))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(24))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(25))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(27))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(28))},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,u)}a((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}};Object.defineProperty(t,"__esModule",{value:!0});var u=n(0);t.isView=function(e){return!!e.location};var a=function(e){function t(t){var n=e.call(this,t)||this;return n.profile=t,n}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,this.call(this.profile.location,"addView",this.profile,this.render())];case 1:return t.sent(),e.prototype.activate.call(this),[2]}})})},t.prototype.deactivate=function(){this.call(this.profile.location,"removeView",this.profile)},t}(u.Plugin);t.ViewPlugin=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(12))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(13)),r(n(32))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(14))},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,u)}a((r=r.apply(e,t||[])).next())})},u=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(15),c=function(e){function t(t,n){void 0===n&&(n={});var r=e.call(this)||this;return r.plugins={},r.methods={},r.events={},r.listeners={},r.actives=[],r.settings=function(e){return o({autoActivate:!1,natives:[]},e)}(n),r.register(Object.keys(t).map(function(e){return t[e]})),r}return i(t,e),t.prototype.isRegistered=function(e){return!!this.plugins[e]},t.prototype.isActive=function(e){return!!this.actives.includes(e)},t.prototype.isNative=function(e){return!e.url||this.settings.natives.includes(e.name)},t.prototype.setSettings=function(e,t){var n;this.settings=o({},this.settings,"string"==typeof e?((n={})[e]=t,n):e)},t.prototype.register=function(e){var t=this;Array.isArray(e)?e.forEach(function(e){return t.registerOne(e)}):this.registerOne(e)},t.prototype.registerOne=function(e){if(!this.plugins[e.name]){if(!e.profile)throw new Error("Plugin "+e.name+" doesn't match the plugin interface");this.plugins[e.name]=e,this.onRegistration&&this.onRegistration(e),e.onRegistation&&e.onRegistation()}},t.prototype.activate=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){return[2,Array.isArray(e)?Promise.all(e.map(function(e){return t.activateOne(e)})):this.activateOne(e)]})})},t.prototype.activateOne=function(e){return s(this,void 0,void 0,function(){function t(t,n){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];return s(this,void 0,void 0,function(){var o,s,a,c,l;return u(this,function(u){switch(u.label){case 0:if(!this.isRegistered(t))throw new Error("Cannot call "+t+" from "+e+", because "+t+" is not registered");return o=this.plugins[t],s=this.isNative(r.profile),!this.settings.permissionHandler||s?[3,2]:o.profile.permission?[4,this.settings.permissionHandler.askPermission(r.profile,o.profile)]:[3,2];case 1:if(!u.sent())throw new Error('Plugin "'+e+'" don\'t have permission to call method "'+n+'" of plugin "'+t+'"');u.label=2;case 2:if(!this.isActive(t)){if(!this.settings.autoActivate||!s)throw new Error("Cannot call "+t+" from "+e+", because "+t+" is not activated yet");this.settings.permissionHandler&&this.settings.permissionHandler.onActivation(r.profile,o.profile),this.activateOne(t)}if(!o.profile.methods.includes(n))throw a='Cannot call method "'+n+'" of "'+t+'" from "'+e+'", because "'+n+'" is not exposed.',c="Here is the list of exposed methods: "+o.profile.methods.map(function(e){return'"'+e+'"'}).join(","),new Error(a+" "+c);return l={from:e,isFromNative:s},[2,o.addRequest(l,n,i)]}})})}function n(t,n,r){var i=a.listenEvent(t,n);this.events[e][i]||(this.events[e][i]=r),this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].includes(e)||this.listeners[i].push(e)}var r,i,c=this;return u(this,function(s){switch(s.label){case 0:if(this.isActive(e))return[2];if(!this.isRegistered(e))throw new Error("Plugin "+e+" is not register yet. It cannot be activated");return r=this.plugins[e],this.actives.push(e),r.call=t.bind(this),this.events[e]={},r.on=n.bind(this),r.emit=function(t){for(var n=this,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=a.listenEvent(e,t);this.listeners[o]&&(this.listeners[o]||[]).forEach(function(i){var s;if(!n.events[i][o])throw new Error("Plugin "+i+" should be listening on event "+t+" from "+e+". But no callback have been found");(s=n.events[i])[o].apply(s,r)})}.bind(this),i=Object.keys(this.plugins).reduce(function(e,r){var i;return o({},e,((i={})[r]=c.plugins[r].profile.methods.reduce(function(e,n){var i;return o({},e,((i={})[n]=t.bind(c,r,n),i))},{on:n.bind(c,r)}),i))},{}),r.app=Object.freeze(i),[4,r.activate()];case 1:return s.sent(),this.onActivated&&this.onActivated(r),[2]}})})},t.prototype.deactivate=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){return[2,Array.isArray(e)?Promise.all(e.map(function(e){return t.deactivateOne(e)})):this.deactivateOne(e)]})})},t.prototype.deactivateOne=function(e){return s(this,void 0,void 0,function(){var t,n,r,i=this;return u(this,function(o){switch(o.label){case 0:return[4,(t=this.plugins[e]).deactivate()];case 1:return o.sent(),n=this.actives.indexOf(e),this.actives.splice(n,1),r=function(t){return"Plugin "+e+" is currently deactivated. "+t+". Activate "+e+" first"},t.call=function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];throw new Error(r("It cannot call method "+t+" of plugin "+e+"."))},t.on=function(e,t){throw new Error(r("It cannot listen on event "+t+" of plugin "+e+"."))},t.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];throw new Error(r("It cannot emit the event "+e))},delete this.methods[e],delete this.events[e],Object.keys(this.listeners).forEach(function(t){i.listeners[t].forEach(function(n,r){n===e&&i.listeners[t].splice(r,1)})}),delete t.app,this.onDeactivated&&this.onDeactivated(t),[2]}})})},t}(function(){});t.PluginEngine=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(16))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(17)),r(n(18)),r(n(29))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callEvent=function(e,t,n){return"["+e+"] "+t+"-"+n},t.listenEvent=function(e,t){return"["+e+"] "+t}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(1)),r(n(2)),r(n(3)),r(n(4)),r(n(5)),r(n(6)),r(n(7)),r(n(26)),r(n(8)),r(n(9))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compilerProfile={name:"compiler",methods:["compile","getCompilationResult"],events:["compilationFinished"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.editorProfile={name:"editor",methods:["discardHighlight","highlight"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.filSystemProfile={name:"fs",methods:["getCurrentFile","getFile","getFolder","setFile","switchFile"],events:["currentFileChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.networkProfile={name:"network",methods:["addNetwork","detectNetwork","getEndpoint","getNetworkProvider","removeNetwork"],events:["providerChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.udappProfile={name:"udapp",methods:["createVMAccount","getAccounts","sendTransaction"],events:["newTransaction"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.themeProfile={name:"theme",methods:[],events:["themeChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unitTestProfile={name:"unitTest",methods:["testFromPath","testFromSource"]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),o=n(3),s=n(2),u=n(4),a=n(5),c=n(6),l=n(7),f=n(8),p=n(9);t.remixApi=Object.freeze({solidity:r({},i.compilerProfile,{name:"solidity"}),fileManager:r({},o.filSystemProfile,{name:"fileManager"}),solidityUnitTesting:r({},l.unitTestProfile,{name:"solidityUnitTesting"}),editor:s.editorProfile,network:u.networkProfile,udapp:a.udappProfile,contentImport:f.contentImportProfile,settings:p.settingsProfile,theme:c.themeProfile}),t.remixProfiles=Object.freeze({solidity:r({},i.compilerProfile,{name:"solidity"}),fileManager:r({},o.filSystemProfile,{name:"fileManager"}),solidityUnitTesting:r({},l.unitTestProfile,{name:"solidityUnitTesting"}),editor:s.editorProfile,network:u.networkProfile,udapp:a.udappProfile,contentImport:f.contentImportProfile,settings:p.settingsProfile,theme:c.themeProfile})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentImportProfile={name:"contentImport",methods:["resolve"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.settingsProfile={name:"settings",methods:["getGithubAccessToken"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(30))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(31))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boxProfile={name:"box",methods:["login","isEnabled","getUserAddress","openSpace","closeSpace","isSpaceOpened","getSpacePrivateValue","setSpacePrivateValue","getSpacePublicValue","setSpacePublicValue","getSpacePublicData","getSpaceName"],events:["enabled","loggedIn","loggedOut","spaceClosed","spaceOpened"]}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(0)),r(n(33)),r(n(34)),r(n(36)),r(n(10))},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(t){var n=e.call(this,t)||this;return n.profile=t,n.entities={},n}return i(t,e),t}(n(0).Plugin);t.HostPlugin=o},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,u)}a((r=r.apply(e,t||[])).next())})},u=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(10),c=n(35),l=function(e){function t(t){var n=e.call(this,t)||this;return n.profile=t,n.listener=["message",function(e){return n.getMessage(e)},!1],n.id=0,n.iframe=document.createElement("iframe"),n.pendingRequest={},n}return i(t,e),t.prototype.deactivate=function(){this.iframe.remove(),window.removeEventListener.apply(window,this.listener),e.prototype.deactivate.call(this)},t.prototype.callPluginMethod=function(e,t){var n=this;void 0===t&&(t=[]);var r=this.id++,i=this.currentRequest,o=this.name,s=new Promise(function(e,t){n.pendingRequest[r]=function(n,r){return r?t(r):e(n)}});return this.postMessage({id:r,action:"request",key:e,payload:t,requestInfo:i,name:o}),s},t.prototype.getMessage=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,s,a,c,l,f,p=this;return u(this,function(u){switch(u.label){case 0:return e.origin!==this.origin?[2]:"request"!==(t=e.data).action||"handshake"!==t.key?[3,2]:[4,this.callPluginMethod("handshake")];case 1:return(n=u.sent())&&(this.profile.methods=n),[2];case 2:switch(t.action){case"listen":return[3,3];case"notification":return[3,4];case"request":return[3,5];case"response":return[3,10]}return[3,11];case 3:return r=t.name,i=t.key,this.on(r,i,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return p.postMessage({action:"notification",name:r,key:i,payload:e})}),[3,12];case 4:return t.payload?(this.emit.apply(this,[t.key].concat(t.payload)),[3,12]):[3,12];case 5:s="response",u.label=6;case 6:return u.trys.push([6,8,,9]),[4,this.call.apply(this,[t.name,t.key].concat(t.payload))];case 7:return l=u.sent(),f=void 0,this.postMessage(o({},t,{action:s,payload:l,error:f})),[3,9];case 8:return a=u.sent(),l=void 0,f=a.message,this.postMessage(o({},t,{action:s,payload:l,error:f})),[3,9];case 9:return[3,12];case 10:return c=t.id,l=t.payload,f=t.error,this.pendingRequest[c](l,f),delete this.pendingRequest[c],[3,12];case 11:throw new Error("Message should be a notification, request or response");case 12:return[2]}})})},t.prototype.postMessage=function(e){if(!this.source)throw new Error("No window attached to Iframe yet");this.source.postMessage(e,this.origin)},t.prototype.render=function(){var e=this;if(this.iframe.contentWindow)throw new Error(this.name+" plugin is already rendered");return this.iframe.setAttribute("sandbox","allow-popups allow-scripts allow-same-origin allow-forms allow-top-navigation"),this.iframe.setAttribute("seamless","true"),this.iframe.src=c.transformUrl(this.profile.url),this.iframe.onload=function(){return s(e,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:if(!this.iframe.contentWindow)throw new Error(this.name+" plugin is cannot find url "+this.profile.url);return this.origin=new URL(this.iframe.src).origin,this.source=this.iframe.contentWindow,window.addEventListener.apply(window,this.listener),[4,this.callPluginMethod("handshake")];case 1:return(e=t.sent())&&(this.profile.methods=e),[2]}})})},this.iframe},t}(a.ViewPlugin);t.IframePlugin=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultGateways={"ipfs://":"https://ipfsgw.komputing.org/ipfs/","swarm://":"https://swarm-gateways.net/bzz-raw://"},t.transformUrl=function(e){var n=Object.keys(t.defaultGateways).find(function(t){return e.startsWith(t)});return n?e.replace(n,t.defaultGateways[n]):e}},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,u)}a((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}};Object.defineProperty(t,"__esModule",{value:!0});var u=n(0);function a(e){return!!e.location}t.isViewLibrary=a;var c=function(e){function t(t,n){var r=e.call(this,n)||this;if(r.library=t,r.profile=n,n.methods.forEach(function(e){if(!t[e])throw new Error("Method "+e+" is exposed by LibraryPlugin "+n.name+". But library doesn't expose this method")}),r.isView=a(n),r.isView&&!r.render)throw new Error("Profile "+n.name+" define the location "+n.location+', but method "render" is not implemented');return r}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){var t=this;return s(this,function(n){switch(n.label){case 0:return this.isView?[4,this.call(this.profile.location,"addView",this.profile,this.render())]:[3,2];case 1:n.sent(),n.label=2;case 2:if(e.prototype.activate.call(this),this.profile.notifications){if(!this.library.events||!this.library.events.emit)throw new Error("Library of plugin "+this.name+" should listen on notifications.\n But doesn't expose the right interface (library.events.emit)");Object.keys(this.profile.notifications).forEach(function(e){t.profile.notifications[e].forEach(function(n){t.on(e,n,function(r){var i;return(i=t.library.events).emit.apply(i,["["+e+"] "+n].concat(r))})})})}if(this.profile.events){if(!this.library.events||!this.library.events.emit)throw new Error("Library of plugin "+this.name+" should emit events but doesn't expose the right interface (library.events.emit)");this.profile.events.forEach(function(e){t.library.events.on(e,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.emit.apply(t,[e].concat(n))})})}return[2]}})})},t.prototype.deactivate=function(){this.isView&&this.call(this.profile.location,"removeView",this.profile),e.prototype.deactivate.call(this)},t.prototype.callPluginMethod=function(e,t){var n;if(!this.library[e])throw new Error("LibraryPlugin "+this.name+" doesn't expose method "+e);return(n=this.library)[e].apply(n,t)},t}(u.Plugin);t.LibraryPlugin=c}])}])}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.pluginEngine=t():e.pluginEngine=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),s=function(){function e(e){this.profile=e,this.activateService={},this.requestQueue=[]}return Object.defineProperty(e.prototype,"name",{get:function(){return this.profile.name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"methods",{get:function(){return this.profile.methods},set:function(e){this.profile.methods=e},enumerable:!0,configurable:!0}),e.prototype.activate=function(){this.onActivation&&this.onActivation()},e.prototype.deactivate=function(){this.onDeactivation&&this.onDeactivation()},e.prototype.callPluginMethod=function(e,t){var n=this.currentRequest&&this.currentRequest.path,r=o.getMethodPath(e,n);if(!(r in this))throw new Error("Method "+r+" is not implemented by "+this.profile.name);return this[r].apply(this,t)},e.prototype.addRequest=function(e,t,n){var o=this;return new Promise(function(s,a){o.requestQueue.push(function(){return r(o,void 0,void 0,function(){var r,o,u,c,l=this;return i(this,function(i){switch(i.label){case 0:this.currentRequest=e,r=!1,o=function(){r&&a("call to plugin has timed out "+l.profile.name+" - "+t+" - "+JSON.stringify(l.currentRequest)),delete l.currentRequest,l.requestQueue.shift(),0!==l.requestQueue.length&&l.requestQueue[0]()},i.label=1;case 1:return i.trys.push([1,3,,4]),setTimeout(function(){r=!0,o()},1e4),[4,this.callPluginMethod(t,n)];case 2:return u=i.sent(),r?[2]:(s(u),[3,4]);case 3:return c=i.sent(),a(c),[3,4];case 4:return o(),[2]}})})}),1===o.requestQueue.length&&o.requestQueue[0]()})},e.prototype.createService=function(e,t){return r(this,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:if(this.methods&&this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return n=o.createService(e,t),[4,o.activateService(this,n)];case 1:return r.sent(),[2,n]}})})},e.prototype.prepareService=function(e,t){var n=this;return this.activateService[e]=function(){return r(n,void 0,void 0,function(){var n,r;return i(this,function(i){switch(i.label){case 0:if(this.methods&&this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return[4,t()];case 1:return n=i.sent(),r=o.createService(e,n),[4,o.activateService(this,r)];case 2:return i.sent(),delete this.activateService[e],[2,r]}})})}},e.prototype.on=function(e,t,n){throw new Error('Method "on" from '+this.name+" should be hooked by PluginEngine")},e.prototype.once=function(e,t,n){throw new Error('Method "once" from '+this.name+" should be hooked by PluginEngine")},e.prototype.off=function(e,t){throw new Error('Method "off" from '+this.name+" should be hooked by PluginEngine")},e.prototype.call=function(e,t){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];return r(this,void 0,void 0,function(){return i(this,function(e){throw new Error('Method "call" from '+this.name+" should be hooked by PluginEngine")})})},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];throw new Error('Method "emit" from '+this.name+" should be hooked by PluginEngine")},e}();t.Plugin=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(18))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(21))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(22))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(23))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(24))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(25))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(26))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(27))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(29))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(30))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(31))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getMethodPath=function(e,t){if(!t)return e;var n=t.split(".");return n.shift(),n.push(e),n.join(".")},t.getRootPath=function(e){return e.split(".").shift()}},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(0);t.isView=function(e){return!!e.location};var u=function(e){function t(t){var n=e.call(this,t)||this;return n.profile=t,n}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,this.call(this.profile.location,"addView",this.profile,this.render())];case 1:return t.sent(),e.prototype.activate.call(this),[2]}})})},t.prototype.deactivate=function(){this.call(this.profile.location,"removeView",this.profile),e.prototype.deactivate.call(this)},t}(a.Plugin);t.ViewPlugin=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(15))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(16)),r(n(36))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(17))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),s=function(){function e(e){var t=this;this.manager=e,this.plugins={},this.events={},this.listeners={},this.isLoaded=!1,this.plugins.manager=e,this.activatePlugin("manager").then(function(){t.manager.engineActivatePlugin=function(e){return t.activatePlugin(e)},t.manager.engineDeactivatePlugin=function(e){return t.deactivatePlugin(e)},t.isLoaded=!0,t.managerLoaded&&t.managerLoaded()})}return e.prototype.onload=function(e){return r(this,void 0,void 0,function(){var t=this;return i(this,function(n){return[2,new Promise(function(n,r){t.isLoaded?(n(),e&&e()):t.managerLoaded=function(){n(),e&&e(),delete t.managerLoaded}})]})})},e.prototype.broadcast=function(e,t){for(var n=this,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var s=o.listenEvent(e,t);this.listeners[s]&&(this.listeners[s]||[]).forEach(function(i){var o;if(!n.events[i][s])throw new Error("Plugin "+i+" should be listening on event "+t+" from "+e+". But no callback have been found");(o=n.events[i])[s].apply(o,r)})},e.prototype.addListener=function(e,t,n,r){var i=o.listenEvent(t,n);this.events[e][i]||(this.events[e][i]=r),this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].includes(e)||this.listeners[i].push(e)},e.prototype.removeListener=function(e,t,n){var r=o.listenEvent(t,n);this.listeners[r]=this.listeners[r].filter(function(t){return t!==e}),delete this.events[e][r]},e.prototype.listenOnce=function(e,t,n,r){var i=this;this.addListener(e,t,n,function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];r.apply(void 0,o),i.removeListener(e,t,n)})},e.prototype.callMethod=function(e,t,n){for(var o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return r(this,void 0,void 0,function(){var r,s,a,u,c,l,f;return i(this,function(i){switch(i.label){case 0:if(r=t.split(".").shift(),!this.plugins[r])throw new Error("Cannot call "+r+" from "+e+", because "+r+" is not registered");return[4,Promise.all([this.manager.getProfile(r),this.manager.getProfile(e)])];case 1:return s=i.sent(),a=s[0],u=s[1],[4,this.manager.canCall(u,a,n)];case 2:if(!i.sent())throw new Error('Plugin "'+e+'" don\'t have permission to call method "'+n+'" of plugin "'+r+'"');return[4,this.manager.isActive(r)];case 3:return i.sent()?[3,7]:[4,this.manager.canActivate(u,a)];case 4:return i.sent()?[4,this.manager.toggleActive(r)]:[3,6];case 5:return i.sent(),[3,7];case 6:throw new Error("Cannot call "+n+" from "+r+", because "+r+" is not activated yet");case 7:if(!a.methods.includes(n))throw c='Cannot call method "'+n+'" of "'+r+'" from "'+e+'", because "'+n+'" is not exposed.',l="Here is the list of exposed methods: "+a.methods.map(function(e){return'"'+e+'"'}).join(","),new Error(c+" "+l);return f={from:e,path:t},[2,this.plugins[r].addRequest(f,n,o)]}})})},e.prototype.createApp=function(e){return r(this,void 0,void 0,function(){var t,n=this;return i(this,function(r){switch(r.label){case 0:return t=Object.keys(this.plugins).map(function(e){return n.manager.getProfile(e)}),[4,Promise.all(t)];case 1:return[2,r.sent().reduce(function(t,r){return t[r.name]=(r.methods||[]).reduce(function(t,i){return t[i]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return n.callMethod.apply(n,[e,r.name,i].concat(t))},t},{on:function(t,i){return n.addListener(e,r.name,t,i)},once:function(t,i){return n.listenOnce(e,r.name,t,i)},off:function(t){return n.removeListener(e,r.name,t)},profile:r}),t},{})]}})})},e.prototype.activatePlugin=function(e){return r(this,void 0,void 0,function(){var t,n,r,o=this;return i(this,function(i){switch(i.label){case 0:if(!this.plugins[e])throw new Error("Cannot active plugin "+e+" because it's not registered yet");return[4,this.manager.isActive(e)];case 1:return i.sent()?[2]:(t=this.plugins[e],this.events[e]={},t.on=function(t,n,r){o.addListener(e,t,n,r)},t.once=function(t,n,r){o.listenOnce(e,t,n,r)},t.off=function(t,n){o.removeListener(e,t,n)},t.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];o.broadcast.apply(o,[e,t].concat(n))},t.call=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return o.callMethod.apply(o,[e,t,n].concat(r))},n=t,r="app",[4,this.createApp(e)]);case 2:return n[r]=i.sent(),t.createApp=function(){return o.createApp(e)},[4,t.activate()];case 3:return i.sent(),[2]}})})},e.prototype.deactivatePlugin=function(e){return r(this,void 0,void 0,function(){var t,n,r=this;return i(this,function(i){switch(i.label){case 0:if(!this.plugins[e])throw new Error("Cannot deactive plugin "+e+" because it's not registered yet");return[4,this.manager.isActive(e)];case 1:return i.sent()?[4,(t=this.plugins[e]).deactivate()]:[2];case 2:return i.sent(),n=function(t){return"Plugin "+e+" is currently deactivated. "+t+". Activate "+e+" first"},t.call=function(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];throw new Error(n("It cannot call method "+t+" of plugin "+e+"."))},t.on=function(e,t){throw new Error(n("It cannot listen on event "+t+" of plugin "+e+"."))},t.once=function(e,t){throw new Error(n("It cannot listen on event "+t+" of plugin "+e+"."))},t.off=function(e,t){throw new Error(n("All event listeners are already removed."))},t.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];throw new Error(n("It cannot emit the event "+e))},delete t.app,delete t.createApp,delete this.events[e],Object.keys(this.listeners).forEach(function(t){r.listeners[t].forEach(function(n,i){n===e&&r.listeners[t].splice(i,1)})}),[2]}})})},e.prototype.register=function(e){var t=this,n=function(e){if(t.plugins[e.name])throw new Error("Plugin "+e.name+" is already register.");t.plugins[e.name]=e,t.manager.addProfile(e.profile),e.onRegistration&&e.onRegistration(),t.onRegistration&&t.onRegistration(e)};return Array.isArray(e)?e.map(function(e){return n(e)}):n(e)},e.prototype.isRegistered=function(e){return!!this.plugins[e]},e}();t.Engine=s},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(19)),r(n(20)),r(n(32)),r(n(12)),r(n(35))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callEvent=function(e,t,n){return"["+e+"] "+t+"-"+n},t.listenEvent=function(e,t){return"["+e+"] "+t}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(2)),r(n(3)),r(n(4)),r(n(5)),r(n(6)),r(n(7)),r(n(8)),r(n(28)),r(n(9)),r(n(10)),r(n(11))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compilerProfile={name:"compiler",methods:["compile","getCompilationResult"],events:["compilationFinished"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.editorProfile={name:"editor",methods:["discardHighlight","highlight"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.filSystemProfile={name:"fs",methods:["getCurrentFile","getFile","getFolder","setFile","switchFile"],events:["currentFileChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.networkProfile={name:"network",methods:["addNetwork","detectNetwork","getEndpoint","getNetworkProvider","removeNetwork"],events:["providerChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.udappProfile={name:"udapp",methods:["createVMAccount","getAccounts","sendTransaction"],events:["newTransaction"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.themeProfile={name:"theme",methods:[],events:["themeChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unitTestProfile={name:"unitTest",methods:["testFromPath","testFromSource"]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(4),s=n(3),a=n(5),u=n(6),c=n(7),l=n(8),f=n(9),h=n(10),p=n(11);t.remixApi=Object.freeze({manager:p.pluginManagerProfile,solidity:r({},i.compilerProfile,{name:"solidity"}),fileManager:r({},o.filSystemProfile,{name:"fileManager"}),solidityUnitTesting:r({},l.unitTestProfile,{name:"solidityUnitTesting"}),editor:s.editorProfile,network:a.networkProfile,udapp:u.udappProfile,contentImport:f.contentImportProfile,settings:h.settingsProfile,theme:c.themeProfile}),t.remixProfiles=Object.freeze({manager:p.pluginManagerProfile,solidity:r({},i.compilerProfile,{name:"solidity"}),fileManager:r({},o.filSystemProfile,{name:"fileManager"}),solidityUnitTesting:r({},l.unitTestProfile,{name:"solidityUnitTesting"}),editor:s.editorProfile,network:a.networkProfile,udapp:u.udappProfile,contentImport:f.contentImportProfile,settings:h.settingsProfile,theme:c.themeProfile})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentImportProfile={name:"contentImport",methods:["resolve"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.settingsProfile={name:"settings",methods:["getGithubAccessToken"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pluginManagerProfile={name:"manager",methods:["getProfile","updateProfile","activatePlugin","deactivatePlugin"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(33))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(34))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boxProfile={name:"box",methods:["login","isEnabled","getUserAddress","openSpace","closeSpace","isSpaceOpened","getSpacePrivateValue","setSpacePrivateValue","getSpacePublicValue","setSpacePublicValue","getSpacePublicData","getSpaceName"],events:["enabled","loggedIn","loggedOut","spaceClosed","spaceOpened"]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(12),a=function(){function e(){}return e.prototype.emit=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];(t=this.plugin).emit.apply(t,[e].concat(n))},e.prototype.createService=function(e,t){return i(this,void 0,void 0,function(){var n,r;return o(this,function(i){switch(i.label){case 0:if(this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return n=this.path+"."+e,r=c(n,t),[4,l(this.plugin,r)];case 1:return i.sent(),[2,r]}})})},e.prototype.prepareService=function(e,t){var n=this;if(this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");var r=this.path+"."+e;this.plugin.activateService[r]=function(){return i(n,void 0,void 0,function(){var e,n;return o(this,function(i){switch(i.label){case 0:return e=t(),n=c(r,e),[4,l(this.plugin,n)];case 1:return i.sent(),delete this.plugin.activateService[r],[2,n]}})})}},e}();function u(e){if(e.methods){for(var t=0,n=e.methods;t<n.length;t++){var r=n[t];if(!(r in e))throw new Error("Method "+r+" is not part of serivce")}return e.methods}if(e instanceof a){var i=Object.getPrototypeOf(e);return Object.getOwnPropertyNames(i).filter(function(e){return"constructor"!==e&&!e.startsWith("_")})}return Object.getOwnPropertyNames(e).filter(function(t){return"function"==typeof e[t]&&!t.startsWith("_")})}function c(e,t){if(t.path&&s.getRootPath(t.path)!==e)throw new Error("Service path "+t.path+" is different from the one provided: "+e);for(var n=u(t),i=0,o=n;i<o.length;i++){var c=o[i];if(!(c in t))throw new Error("Method "+c+" is not part of service "+e)}return t instanceof a?(t.methods||(t.methods=n),t):r({},t,{methods:n,path:e})}function l(e,t){e.methods=(e.methods||[]).concat(t.methods);for(var n=0,r=u(t);n<r.length;n++){var i=r[n];e[t.path+"."+i]=t[i].bind(t)}return e.call("manager","updateProfile",{methods:e.methods})}t.PluginService=a,t.getMethods=u,t.createService=c,t.activateService=l},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(0)),r(n(37)),r(n(38)),r(n(40)),r(n(13)),r(n(41)),r(n(42))},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t){return e.call(this,o({},t,{methods:t.methods.concat(["focus","addView","removeView"])}))||this}return i(t,e),t}(n(0).Plugin);t.HostPlugin=s},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var u=n(13),c=n(39),l=function(e){function t(t){var n=e.call(this,t)||this;return n.profile=t,n.listener=["message",function(e){return n.getMessage(e)},!1],n.id=0,n.iframe=document.createElement("iframe"),n.pendingRequest={},n}return i(t,e),t.prototype.deactivate=function(){this.iframe.remove(),window.removeEventListener.apply(window,this.listener),e.prototype.deactivate.call(this)},t.prototype.callPluginMethod=function(e,t){var n=this;void 0===t&&(t=[]);var r=this.id++,i=this.currentRequest,o=this.name,s=new Promise(function(e,t){n.pendingRequest[r]=function(n,r){return r?t(r):e(n)}});return this.postMessage({id:r,action:"request",key:e,payload:t,requestInfo:i,name:o}),s},t.prototype.getMessage=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,s,u,c,l,f,h,p,d,v,y=this;return a(this,function(a){switch(a.label){case 0:return e.origin!==this.origin?[2]:"request"!==(t=e.data).action||"handshake"!==t.key?[3,2]:[4,this.callPluginMethod("handshake")];case 1:return(n=a.sent())&&(this.profile.methods=n),[2];case 2:switch(t.action){case"on":case"listen":return[3,3];case"off":return[3,4];case"once":return[3,5];case"emit":case"notification":return[3,6];case"call":case"request":return[3,7];case"response":return[3,12]}return[3,13];case 3:return r=t.name,i=t.key,"notification",this.on(r,i,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return y.postMessage({action:"notification",name:r,key:i,payload:e})}),[3,14];case 4:return s=t.name,u=t.key,this.off(s,u),[3,14];case 5:return c=t.name,l=t.key,"notification",this.once(c,l,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return y.postMessage({action:"notification",name:c,key:l,payload:e})}),[3,14];case 6:return t.payload?(this.emit.apply(this,[t.key].concat(t.payload)),[3,14]):[3,14];case 7:f="response",a.label=8;case 8:return a.trys.push([8,10,,11]),[4,this.call.apply(this,[t.name,t.key].concat(t.payload))];case 9:return d=a.sent(),v=void 0,this.postMessage(o({},t,{action:f,payload:d,error:v})),[3,11];case 10:return h=a.sent(),d=void 0,v=h.message,this.postMessage(o({},t,{action:f,payload:d,error:v})),[3,11];case 11:return[3,14];case 12:return p=t.id,d=t.payload,v=t.error,this.pendingRequest[p](d,v),delete this.pendingRequest[p],[3,14];case 13:throw new Error("Message should be a notification, request or response");case 14:return[2]}})})},t.prototype.postMessage=function(e){if(!this.source)throw new Error("No window attached to Iframe yet");this.source.postMessage(e,this.origin)},t.prototype.render=function(){var e=this;if(this.iframe.contentWindow)throw new Error(this.name+" plugin is already rendered");return this.iframe.setAttribute("sandbox","allow-popups allow-scripts allow-same-origin allow-forms allow-top-navigation"),this.iframe.setAttribute("seamless","true"),this.iframe.src=c.transformUrl(this.profile.url),this.iframe.onload=function(){return s(e,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:if(!this.iframe.contentWindow)throw new Error(this.name+" plugin is cannot find url "+this.profile.url);return this.origin=new URL(this.iframe.src).origin,this.source=this.iframe.contentWindow,window.addEventListener.apply(window,this.listener),[4,this.callPluginMethod("handshake")];case 1:return(e=t.sent())&&(this.profile.methods=e,this.call("manager","updateProfile",this.profile)),[2]}})})},this.iframe},t}(u.ViewPlugin);t.IframePlugin=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultGateways={"ipfs://":"https://ipfsgw.komputing.org/ipfs/","swarm://":"https://swarm-gateways.net/bzz-raw://"},t.transformUrl=function(e){var n=Object.keys(t.defaultGateways).find(function(t){return e.startsWith(t)});return n?e.replace(n,t.defaultGateways[n]):e}},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(0);function u(e){return!!e.location}t.isViewLibrary=u;var c=function(e){function t(t,n){var r=e.call(this,n)||this;if(r.library=t,r.profile=n,n.methods.forEach(function(e){if(!t[e])throw new Error("Method "+e+" is exposed by LibraryPlugin "+n.name+". But library doesn't expose this method")}),r.isView=u(n),r.isView&&!r.render)throw new Error("Profile "+n.name+" define the location "+n.location+', but method "render" is not implemented');return r}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){var t=this;return s(this,function(n){switch(n.label){case 0:return this.isView?[4,this.call(this.profile.location,"addView",this.profile,this.render())]:[3,2];case 1:n.sent(),n.label=2;case 2:if(e.prototype.activate.call(this),this.profile.notifications){if(!this.library.events||!this.library.events.emit)throw new Error('"events" object from Library of plugin '+this.name+' should implement "emit"');Object.keys(this.profile.notifications).forEach(function(e){t.profile.notifications[e].forEach(function(n){t.on(e,n,function(r){var i;return(i=t.library.events).emit.apply(i,["["+e+"] "+n].concat(r))})})})}if(this.profile.events){if(!this.library.events||!this.library.events.emit)throw new Error('"events" object from Library of plugin '+this.name+' should implement "emit"');this.profile.events.forEach(function(e){t.library.events.on(e,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.emit.apply(t,[e].concat(n))})})}return[2]}})})},t.prototype.deactivate=function(){var t=this;this.isView&&this.call(this.profile.location,"removeView",this.profile),this.profile.notifications&&Object.keys(this.profile.notifications).forEach(function(e){t.profile.notifications[e].forEach(function(n){return t.off(e,n)})}),this.profile.events&&this.library.events.off&&this.profile.events.forEach(function(e){return t.library.events.off(e)}),e.prototype.deactivate.call(this)},t.prototype.callPluginMethod=function(e,t){var n;if(!this.library[e])throw new Error("LibraryPlugin "+this.name+" doesn't expose method "+e);return(n=this.library)[e].apply(n,t)},t}(a.Plugin);t.LibraryPlugin=c},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var u=function(e){function t(t,n){void 0===n&&(n={});var r=e.call(this,t)||this;return r.profile=t,r.listener=["message",function(e){return r.getMessage(e)},!1],r.reconnectOnclose=["close",function(){return r.reconnect()},!1],r.id=0,r.pendingRequest={},r.options={reconnectDelay:1e3},r.options=o({},r.options,n),r}return i(t,e),t.prototype.activate=function(){return s(this,void 0,void 0,function(){var t;return a(this,function(n){return this.connect(),(t=this.socket).addEventListener.apply(t,this.reconnectOnclose),e.prototype.activate.call(this),[2]})})},t.prototype.deactivate=function(){var t,n;(t=this.socket).removeEventListener.apply(t,this.reconnectOnclose),(n=this.socket).removeEventListener.apply(n,this.listener),this.socket.close(),e.prototype.deactivate.call(this)},t.prototype.reconnect=function(){var e=this;setTimeout(function(){return e.connect()},this.options.reconnectDelay)},t.prototype.connect=function(){var e=this;this.socket=new WebSocket(this.profile.url),this.socket.addEventListener("open",function(){return s(e,void 0,void 0,function(){var e,t;return a(this,function(n){switch(n.label){case 0:return(t=this.socket).addEventListener.apply(t,this.listener),[4,this.callPluginMethod("handshake")];case 1:return(e=n.sent())&&(this.profile.methods=e,this.call("manager","updateProfile",this.profile)),[2]}})})})},t.prototype.callPluginMethod=function(e,t){var n=this;void 0===t&&(t=[]);var r=this.id++,i=this.currentRequest,o=this.name,s=new Promise(function(e,t){n.pendingRequest[r]=function(n,r){return r?t(r):e(n)}});return this.postMessage({id:r,action:"request",key:e,payload:t,requestInfo:i,name:o}),s},t.prototype.getMessage=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,s,u,c,l,f,h,p,d,v,y=this;return a(this,function(a){switch(a.label){case 0:return"request"!==(t=JSON.parse(e.data)).action||"handshake"!==t.key?[3,2]:[4,this.callPluginMethod("handshake")];case 1:return(n=a.sent())&&(this.profile.methods=n),[2];case 2:switch(t.action){case"on":case"listen":return[3,3];case"once":return[3,4];case"off":return[3,5];case"emit":case"notification":return[3,6];case"call":case"request":return[3,7];case"response":return[3,12]}return[3,13];case 3:return r=t.name,i=t.key,"emit",this.on(r,i,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return y.postMessage({action:"emit",name:r,key:i,payload:e})}),[3,14];case 4:return s=t.name,u=t.key,"emit",this.once(s,u,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return y.postMessage({action:"emit",name:s,key:u,payload:e})}),[3,14];case 5:return c=t.name,l=t.key,this.off(c,l),[3,14];case 6:return t.payload?(this.emit.apply(this,[t.key].concat(t.payload)),[3,14]):[3,14];case 7:f="response",a.label=8;case 8:return a.trys.push([8,10,,11]),[4,this.call.apply(this,[t.name,t.key].concat(t.payload))];case 9:return d=a.sent(),v=void 0,this.postMessage(o({},t,{action:f,payload:d,error:v})),[3,11];case 10:return h=a.sent(),d=void 0,v=h.message,this.postMessage(o({},t,{action:f,payload:d,error:v})),[3,11];case 11:return[3,14];case 12:return p=t.id,d=t.payload,v=t.error,this.pendingRequest[p](d,v),delete this.pendingRequest[p],[3,14];case 13:throw new Error("Message should be a notification, request or response");case 14:return[2]}})})},t.prototype.postMessage=function(e){if(this.socket.readyState!==this.socket.OPEN)throw new Error("Websocket connection is not open yet");this.socket.send(JSON.stringify(e))},t}(n(0).Plugin);t.WebsocketPlugin=u},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var u=n(1),c=n(0);t.managerMethods=["getProfile","updateProfile","activatePlugin","deactivatePlugin"];var l=function(e){function t(t){void 0===t&&(t=u.pluginManagerProfile);var n=e.call(this,t)||this;return n.profiles={},n.actives=[],n.methods=["getProfile","updateProfile","activatePlugin","deactivatePlugin"],n.profiles[t.name]=t,n}return i(t,e),Object.defineProperty(t.prototype,"requestFrom",{get:function(){return this.currentRequest?this.currentRequest.from:"manager"},enumerable:!0,configurable:!0}),t.prototype.getProfile=function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return[2,this.profiles[e]]})})},t.prototype.updateProfile=function(e){if(e){if(e.name&&e.name!==this.requestFrom)throw new Error("A plugin cannot change its name.");var t=this.requestFrom;if(!this.profiles[t])throw new Error("Plugin "+t+" is not register, you cannot update it's profile.");if(e.url&&e.url!==this.profiles[t].url)throw new Error("Url from Profile cannot be updated.");this.profiles[t]=o({},this.profiles[t],e),this.emit("profileUpdated",this.profiles[t])}},t.prototype.addProfile=function(e){if(this.profiles[e.name])throw new Error("Plugin "+e.name+" already exist");this.profiles[e.name]=e,this.emit("profileAdded",e),this.onProfileAdded&&this.onProfileAdded(e)},t.prototype.isActive=function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return[2,this.actives.includes(e)]})})},t.prototype.activatePlugin=function(e){return s(this,void 0,void 0,function(){var t,n=this;return a(this,function(r){return t=function(e){return s(n,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return[4,this.isActive(e)];case 1:return i.sent()?[2]:[4,Promise.all([this.getProfile(e),this.getProfile(this.requestFrom)])];case 2:return t=i.sent(),n=t[0],r=t[1],[4,this.canActivate(r,n)];case 3:return i.sent()?[4,this.toggleActive(e)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error("Plugin "+this.requestFrom+" has no right to activate plugin "+e);case 6:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},t.prototype.deactivatePlugin=function(e){return s(this,void 0,void 0,function(){var t,n=this;return a(this,function(r){return t=function(e){return s(n,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return[4,this.isActive(e)];case 1:return i.sent()?[4,Promise.all([this.getProfile(e),this.getProfile(this.requestFrom)])]:[2];case 2:return t=i.sent(),n=t[0],r=t[1],[4,this.canDeactivate(r,n)];case 3:return i.sent()?[4,this.toggleActive(e)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error("Plugin "+this.requestFrom+" has no right to deactivate plugin "+e);case 6:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},t.prototype.toggleActive=function(e){return s(this,void 0,void 0,function(){var t,n=this;return a(this,function(r){return t=function(e){return s(n,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return[4,Promise.all([this.isActive(e),this.getProfile(e)])];case 1:return t=i.sent(),n=t[0],r=t[1],n?[4,this.engineDeactivatePlugin(e)]:[3,3];case 2:return i.sent(),this.actives=this.actives.filter(function(t){return t!==e}),this.emit("pluginDeactivated",r),this.onPluginDeactivated&&this.onPluginDeactivated(r),[3,5];case 3:return[4,this.engineActivatePlugin(e)];case 4:i.sent(),this.actives.push(e),this.emit("pluginActivated",r),this.onPluginActivated&&this.onPluginActivated(r),i.label=5;case 5:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},t.prototype.canActivate=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,!0]})})},t.prototype.canDeactivate=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(t){return"manager"===e.name?[2,!0]:[2,!1]})})},t.prototype.canCall=function(e,t,n){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,!0]})})},t}(c.Plugin);t.PluginManager=l}])});